original_docstring: 
      Collects the ancillary data required for surface brightness
      temperature.
  
      :param acquisition:
          An instance of an `Acquisition` object.
  
      :param lonlats:
          A `list` of tuples containing (longitude, latitude) coordinates.
  
      :param ancillary_path:
          A `str` containing the directory pathname to the ECMWF
          ancillary data.
  
      :param invariant_fname:
          A `str` containing the file pathname to the invariant geopotential
          data.
  
      :param out_group:
          If set to None (default) then the results will be returned
          as an in-memory hdf5 file, i.e. the `core` driver. Otherwise,
          a writeable HDF5 `Group` object.
  
      :param compression:
          The compression filter to use.
          Default is H5CompressionFilter.LZF 
  
      :filter_opts:
          A dict of key value pairs available to the given configuration
          instance of H5CompressionFilter. For example
          H5CompressionFilter.LZF has the keywords *chunks* and *shuffle*
          available.
          Default is None, which will use the default settings for the
          chosen H5CompressionFilter instance.
  
      :return:
          An opened `h5py.File` object, that is either in-memory using the
          `core` driver, or on disk.
      
docstring: Collects the ancillary data required for surface brightness
  temperature.
docstring_tokens: Collects the ancillary data required for surface brightness temperature .
code: def collect_sbt_ancillary(acquisition, lonlats, ancillary_path,
                            invariant_fname=None, out_group=None,
                            compression=H5CompressionFilter.LZF,
                            filter_opts=None):
      """
      Collects the ancillary data required for surface brightness
      temperature.
  
      :param acquisition:
          An instance of an `Acquisition` object.
  
      :param lonlats:
          A `list` of tuples containing (longitude, latitude) coordinates.
  
      :param ancillary_path:
          A `str` containing the directory pathname to the ECMWF
          ancillary data.
  
      :param invariant_fname:
          A `str` containing the file pathname to the invariant geopotential
          data.
  
      :param out_group:
          If set to None (default) then the results will be returned
          as an in-memory hdf5 file, i.e. the `core` driver. Otherwise,
          a writeable HDF5 `Group` object.
  
      :param compression:
          The compression filter to use.
          Default is H5CompressionFilter.LZF 
  
      :filter_opts:
          A dict of key value pairs available to the given configuration
          instance of H5CompressionFilter. For example
          H5CompressionFilter.LZF has the keywords *chunks* and *shuffle*
          available.
          Default is None, which will use the default settings for the
          chosen H5CompressionFilter instance.
  
      :return:
          An opened `h5py.File` object, that is either in-memory using the
          `core` driver, or on disk.
      """
      # Initialise the output files
      if out_group is None:
          fid = h5py.File('sbt-ancillary.h5', driver='core', backing_store=False)
      else:
          fid = out_group
  
      fid.attrs['sbt-ancillary'] = True
  
      dt = acquisition.acquisition_datetime
  
      description = ('Combined Surface and Pressure Layer data retrieved from '
                     'the ECWMF catalogue.')
      attrs = {'description': description,
               'Date used for querying ECWMF': dt}
  
      for i, lonlat in enumerate(lonlats):
          pnt = POINT_FMT.format(p=i)
          # get data located at the surface
          dew = ecwmf_dewpoint_temperature(ancillary_path, lonlat, dt)
          t2m = ecwmf_temperature_2metre(ancillary_path, lonlat, dt)
          sfc_prs = ecwmf_surface_pressure(ancillary_path, lonlat, dt)
          sfc_hgt = ecwmf_elevation(invariant_fname, lonlat)
          sfc_rh = relative_humdity(t2m[0], dew[0])
  
          # output the scalar data along with the attrs
          dname = ppjoin(pnt, DatasetName.DEWPOINT_TEMPERATURE.value)
          write_scalar(dew[0], dname, fid, dew[1])
  
          dname = ppjoin(pnt, DatasetName.TEMPERATURE_2M.value)
          write_scalar(t2m[0], dname, fid, t2m[1])
  
          dname = ppjoin(pnt, DatasetName.SURFACE_PRESSURE.value)
          write_scalar(sfc_prs[0], dname, fid, sfc_prs[1])
  
          dname = ppjoin(pnt, DatasetName.SURFACE_GEOPOTENTIAL.value)
          write_scalar(sfc_hgt[0], dname, fid, sfc_hgt[1])
  
          dname = ppjoin(pnt, DatasetName.SURFACE_RELATIVE_HUMIDITY.value)
          attrs = {'description': 'Relative Humidity calculated at the surface'}
          write_scalar(sfc_rh, dname, fid, attrs)
  
          # get the data from each of the pressure levels (1 -> 1000 ISBL)
          gph = ecwmf_geo_potential(ancillary_path, lonlat, dt)
          tmp = ecwmf_temperature(ancillary_path, lonlat, dt)
          rh = ecwmf_relative_humidity(ancillary_path, lonlat, dt)
  
          dname = ppjoin(pnt, DatasetName.GEOPOTENTIAL.value)
          write_dataframe(gph[0], dname, fid, compression, attrs=gph[1],
                          filter_opts=filter_opts)
  
          dname = ppjoin(pnt, DatasetName.TEMPERATURE.value)
          write_dataframe(tmp[0], dname, fid, compression, attrs=tmp[1],
                          filter_opts=filter_opts)
  
          dname = ppjoin(pnt, DatasetName.RELATIVE_HUMIDITY.value)
          write_dataframe(rh[0], dname, fid, compression, attrs=rh[1],
                          filter_opts=filter_opts)
  
          # combine the surface and higher pressure layers into a single array
          cols = ['GeoPotential_Height', 'Pressure', 'Temperature',
                  'Relative_Humidity']
          layers = pandas.DataFrame(columns=cols, index=range(rh[0].shape[0]),
                                    dtype='float64')
  
          layers['GeoPotential_Height'] = gph[0]['GeoPotential_Height'].values
          layers['Pressure'] = ECWMF_LEVELS[::-1]
          layers['Temperature'] = tmp[0]['Temperature'].values
          layers['Relative_Humidity'] = rh[0]['Relative_Humidity'].values
  
          # define the surface level
          df = pandas.DataFrame({'GeoPotential_Height': sfc_hgt[0],
                                 'Pressure': sfc_prs[0],
                                 'Temperature': kelvin_2_celcius(t2m[0]),
                                 'Relative_Humidity': sfc_rh}, index=[0])
  
          # MODTRAN requires the height to be ascending
          # and the pressure to be descending
          wh = ((layers['GeoPotential_Height'] > sfc_hgt[0]) &
                (layers['Pressure'] < sfc_prs[0].round()))
          df = df.append(layers[wh])
          df.reset_index(drop=True, inplace=True)
  
          dname = ppjoin(pnt, DatasetName.ATMOSPHERIC_PROFILE.value)
          write_dataframe(df, dname, fid, compression, attrs=attrs,
                          filter_opts=filter_opts)
  
          fid[pnt].attrs['lonlat'] = lonlat
  
      if out_group is None:
          return fid
code_tokens: def collect_sbt_ancillary ( acquisition , lonlats , ancillary_path , invariant_fname = None , out_group = None , compression = H5CompressionFilter . LZF , filter_opts = None ) : if out_group is None : fid = h5py . File ( 'sbt-ancillary.h5' , driver = 'core' , backing_store = False ) else : fid = out_group fid . attrs [ 'sbt-ancillary' ] = True dt = acquisition . acquisition_datetime description = ( 'Combined Surface and Pressure Layer data retrieved from ' 'the ECWMF catalogue.' ) attrs = { 'description' : description , 'Date used for querying ECWMF' : dt } for i , lonlat in enumerate ( lonlats ) : pnt = POINT_FMT . format ( p = i ) dew = ecwmf_dewpoint_temperature ( ancillary_path , lonlat , dt ) t2m = ecwmf_temperature_2metre ( ancillary_path , lonlat , dt ) sfc_prs = ecwmf_surface_pressure ( ancillary_path , lonlat , dt ) sfc_hgt = ecwmf_elevation ( invariant_fname , lonlat ) sfc_rh = relative_humdity ( t2m [ 0 ] , dew [ 0 ] ) dname = ppjoin ( pnt , DatasetName . DEWPOINT_TEMPERATURE . value ) write_scalar ( dew [ 0 ] , dname , fid , dew [ 1 ] ) dname = ppjoin ( pnt , DatasetName . TEMPERATURE_2M . value ) write_scalar ( t2m [ 0 ] , dname , fid , t2m [ 1 ] ) dname = ppjoin ( pnt , DatasetName . SURFACE_PRESSURE . value ) write_scalar ( sfc_prs [ 0 ] , dname , fid , sfc_prs [ 1 ] ) dname = ppjoin ( pnt , DatasetName . SURFACE_GEOPOTENTIAL . value ) write_scalar ( sfc_hgt [ 0 ] , dname , fid , sfc_hgt [ 1 ] ) dname = ppjoin ( pnt , DatasetName . SURFACE_RELATIVE_HUMIDITY . value ) attrs = { 'description' : 'Relative Humidity calculated at the surface' } write_scalar ( sfc_rh , dname , fid , attrs ) gph = ecwmf_geo_potential ( ancillary_path , lonlat , dt ) tmp = ecwmf_temperature ( ancillary_path , lonlat , dt ) rh = ecwmf_relative_humidity ( ancillary_path , lonlat , dt ) dname = ppjoin ( pnt , DatasetName . GEOPOTENTIAL . value ) write_dataframe ( gph [ 0 ] , dname , fid , compression , attrs = gph [ 1 ] , filter_opts = filter_opts ) dname = ppjoin ( pnt , DatasetName . TEMPERATURE . value ) write_dataframe ( tmp [ 0 ] , dname , fid , compression , attrs = tmp [ 1 ] , filter_opts = filter_opts ) dname = ppjoin ( pnt , DatasetName . RELATIVE_HUMIDITY . value ) write_dataframe ( rh [ 0 ] , dname , fid , compression , attrs = rh [ 1 ] , filter_opts = filter_opts ) cols = [ 'GeoPotential_Height' , 'Pressure' , 'Temperature' , 'Relative_Humidity' ] layers = pandas . DataFrame ( columns = cols , index = range ( rh [ 0 ] . shape [ 0 ] ) , dtype = 'float64' ) layers [ 'GeoPotential_Height' ] = gph [ 0 ] [ 'GeoPotential_Height' ] . values layers [ 'Pressure' ] = ECWMF_LEVELS [ : : - 1 ] layers [ 'Temperature' ] = tmp [ 0 ] [ 'Temperature' ] . values layers [ 'Relative_Humidity' ] = rh [ 0 ] [ 'Relative_Humidity' ] . values df = pandas . DataFrame ( { 'GeoPotential_Height' : sfc_hgt [ 0 ] , 'Pressure' : sfc_prs [ 0 ] , 'Temperature' : kelvin_2_celcius ( t2m [ 0 ] ) , 'Relative_Humidity' : sfc_rh } , index = [ 0 ] ) wh = ( ( layers [ 'GeoPotential_Height' ] > sfc_hgt [ 0 ] ) & ( layers [ 'Pressure' ] < sfc_prs [ 0 ] . round ( ) ) ) df = df . append ( layers [ wh ] ) df . reset_index ( drop = True , inplace = True ) dname = ppjoin ( pnt , DatasetName . ATMOSPHERIC_PROFILE . value ) write_dataframe ( df , dname , fid , compression , attrs = attrs , filter_opts = filter_opts ) fid [ pnt ] . attrs [ 'lonlat' ] = lonlat if out_group is None : return fid
short_docstring: Collects the ancillary data required for surface brightness
  temperature.
short_docstring_tokens: Collects the ancillary data required for surface brightness temperature .
comment: """
      Collects the ancillary data required for surface brightness
      temperature.
  
      :param acquisition:
          An instance of an `Acquisition` object.
  
      :param lonlats:
          A `list` of tuples containing (longitude, latitude) coordinates.
  
      :param ancillary_path:
          A `str` containing the directory pathname to the ECMWF
          ancillary data.
  
      :param invariant_fname:
          A `str` containing the file pathname to the invariant geopotential
          data.
  
      :param out_group:
          If set to None (default) then the results will be returned
          as an in-memory hdf5 file, i.e. the `core` driver. Otherwise,
          a writeable HDF5 `Group` object.
  
      :param compression:
          The compression filter to use.
          Default is H5CompressionFilter.LZF 
  
      :filter_opts:
          A dict of key value pairs available to the given configuration
          instance of H5CompressionFilter. For example
          H5CompressionFilter.LZF has the keywords *chunks* and *shuffle*
          available.
          Default is None, which will use the default settings for the
          chosen H5CompressionFilter instance.
  
      :return:
          An opened `h5py.File` object, that is either in-memory using the
          `core` driver, or on disk.
      """$SEP$# Initialise the output files$SEP$# get data located at the surface$SEP$# output the scalar data along with the attrs$SEP$# get the data from each of the pressure levels (1 -> 1000 ISBL)$SEP$# combine the surface and higher pressure layers into a single array$SEP$# define the surface level$SEP$# MODTRAN requires the height to be ascending$SEP$# and the pressure to be descending