tropy package

Submodules

tropy.MSGtools.channel_segment_sets(set_name)

Outputs a predefined set of channels and segments’

Parameters:set_name (str) – name of a predefined set
Returns:chan_seg – Dictionary of channels with a list of segments.
Return type:dict
tropy.MSGtools.get_HRIT_from_arch(day, chan_set='nc-full', scan_type='pzs', arch_dir=None, out_path=None)

Gets and decompresses the original HRIT files from archive. A typical set of channels and segments can be chosen.

Parameters:
  • day (datetime object) – day and time of MSG time slot
  • chan_set (str, optional, default = 'nc-full') – name of a predefined channels set
  • scan_type (str, optional, default = 'pzs') – one of the two Meteosat scan types
  • arch_dir (str, optional, default = None) – archive directory where NWC-SAF files are saved
  • out_path (str, optional, default = None) – directory where the HRIT files are saved.
Returns:

file_list – list of extracted HRIT files

Return type:

list

tropy.MSGtools.get_berendes_prod(prod, t, region='de', scan_type='rss', arch='none')

Reads product of Berendes Cloud type product for a given date.

Parameters:
  • prod (str) – name of Berendes product, either ccm or texture
  • t (datetime object) – day and time of MSG time slot
  • region (str, optional, default = 'de') – string that defines regional cutout
  • scan_type (str, optional, default = 'rss') –
  • arch (str, optional, default = "none") – archive directory where NWC-SAF files are saved (OPTIONAL)
Returns:

var – Berendes product as field

Return type:

numpy array

tropy.MSGtools.get_cmsaf_prod(prod, day, scan_type='rss', region='eu', arch='none', calibrate=False, switch2new=True)

Reads product of CM-SAF (KNMI retrieval) for a given date.

Parameters:
  • prod (str) – name of CMSAF product
  • day (datetime object) – day and time of MSG time slot
  • region (str, optional, default = 'eu') – string that defines regional cutout
  • scan_type (str, optional, default = 'rss') – one of the two Meteosat scan types
  • arch (str, optional, default = "none") – archive directory where NWC-SAF files are saved
  • calibrate (bool, optional, default = False) – switch for slope/offset calibration
  • switch2new (bool, optional, default = True) – if the “new” set of CMSAF products should be selected “new” means collection two: “c2”
Returns:

  • product (numpy array, optional) – calibrated CMSAF product data (if calibrate == True)
  • counts (numpy array, optional) – CMSAF product count data (if calibrate == False)
  • scal (float, optional) – scale factor for CMSAF products (if calibrate == False)
  • offset (float, optional) – offset for CMSAF products (if calibrate == False)

Notes

Data are saved as integer via: DATA = scal * count + offset

The following structures can be returned:

counts, scal, offset = get_cmsaf_prod(prod, day, calibrate = False)

OR

product = get_cmsaf_prod(prod, day, calibrate = True)

tropy.MSGtools.get_cos_zen(day, scan_type='rss', arch='none')

Reads sun zenith angle from the partical satellite hdf file and calculates the cosine of the sun zenith.

Parameters:
  • day (datetime object) – day and time of MSG time slot
  • scan_type (str, optional, default = 'rss') – one of the two Meteosat scan types
Returns:

coszen – cosine of sun zenith angle

Return type:

numpy array, optional

tropy.MSGtools.get_highres_cma(t, region='de', scan_type='rss', arch='none')

Reads product of High-Res Cloud Mask product (Bley et al., 2013) for a given date.

Parameters:
  • t (datetime object) – day and time of MSG time slot
  • region (str, optional, default = 'de') – string that defines regional cutout
  • scan_type (str, optional, default = 'rss') –
  • arch (str, optional, default = "none") – archive directory where NWC-SAF files are saved (OPTIONAL)
Returns:

var – Cma product as field

Return type:

numpy array

tropy.MSGtools.get_msg_lon_lat(region, scan_type='rss', arch_dir='none')

Reads longitudes and latitudes of Meteosat8 pixels saved in an auxiliary file in the MSG archive.

Parameters:
  • region (str) – predefined cutout of MSG fulldisk, e.g. ‘eu’
  • scan_type (str, optional, default = 'rss') – one of the two Meteosat scan types
  • arch_dir (str, optional, default = "none") – archive directory where NWC-SAF files are saved
Returns:

  • lon (numpy array) – longitudes of pixels
  • lat (numpy array) – latitudes of pixels

tropy.MSGtools.get_msg_lsm(region, scan_type='rss', arch_dir='none')

Reads land sea mask of Meteosat8 pixels saved in an auxiliary file in the MSG archive.

Parameters:
  • region (str) – predefined cutout of MSG fulldisk, e.g. ‘eu’
  • scan_type (str) – which type of msg is used, * ) allowed keys are: ‘pzs’,rss’
  • arch_dir (str, optional, default = "none") – archive directory where NWC-SAF files are saved
Returns:

lsm – land sea mask

Return type:

numpy array

tropy.MSGtools.get_msg_sat_zen(day, sat_type='rss')

Reads satellite zenith angle from the partical satellite hdf file.

Parameters:
  • day (datetime object) – day and time of MSG time slot
  • sat_type (str, optional, default = 'rss') – one of the two Meteosat scan types
Returns:

satzen – satellite zenith angle

Return type:

numpy array

tropy.MSGtools.get_nwcsaf_prod(prod, day, scan_type='rss', arch='none', region='eu', calibrate=False, is_region_shifted=False)

Reads product of NWC-SAF for a given date.

Parameters:prod (str) – name of NWCSAF product prod in [‘CMa’, ‘CMa_DUST’, ‘CT’, ‘CTTH_EFFECT’, ‘CTTH_HEIGHT’, ‘CTTH_PRESS’, ‘CTTH_QUALITY’, ‘CTTH_TEMPER’, ‘CT_PHASE’]
day : datetime object
day and time of MSG time slot
region : str, optional, default = ‘eu’
string that defines regional cutout
scan_type : str, optional, default = ‘rss’
one of the two Meteosat scan types
arch : str, optional, default = “none”
archive directory where NWC-SAF files are saved
calibrate : bool, optional, default = False
switch for slope/offset calibration
is_region_shifted : bool, optional, default = False
switch if bugfix for (mistakingly) shifted regions has to be applied
Returns:
  • product (numpy array, optional) – calibrated NWCSAF product data (if calibrate == True)
  • counts (numpy array, optional) – NWCSAF product count data (if calibrate == False)
  • scal (float, optional) – scale factor for NWCSAF products (if calibrate == False)
  • offset (float, optional) – offset for NWCSAF products (if calibrate == False)

Notes

Data are saved as integer via: DATA = scal * count + offset

The following structures can be returned:

counts, scal, offset = get_nwcsaf_prod(prod, day, calibrate = False)

OR

product = get_nwcsaf_prod(prod, day, calibrate = True)

tropy.MSGtools.get_seviri_chan(ch_name, day, scan_type='rss', arch='none', calibrate=True)

Reads MSG - SEVIRI radiance of a given channel for a given date.

Parameters:
  • ch_name (str) – name of MSG SEVIRI channel, e.g. ir_108 or IR_108 (case does not matter)
  • day (datetime object) – day and time of MSG time slot
  • scan_type (str, optional, default = 'rss') – one of the two Meteosat scan types
  • arch (str, optional, default = "none") – archive directory where NWC-SAF files are saved
  • calibrate (bool, optional, default = False) – switch for slope/offset calibration if True, radiances are output
Returns:

out_field – radiance/counts (depending on calibrate option) of channel <ch_name> at date <day>

Return type:

numpy array

info : dict
meta info list which includes calibration coefficients
tropy.MSGtools.list_cmsaf_prod(day, arch='none')

Lists products contained in a specific CM-SAF (KNMI retrieval) file at a given date.

Parameters:
  • day (datetime object) – day and time of MSG time slot
  • arch (str, optional, default = "none") – archive directory where NWC-SAF files are saved
Returns:

L – list of cmsaf products

Return type:

list

tropy.MSGtools.prod_reference(prod)

Given a NWC-SAF product, the routine returns the correspondig substring to address the product file.

Parameters:prod (str) – name of NWC-SAF product, e.g. CMa, CT, CRR
Returns:name – substring in the NWC-SAF product file
Return type:str

Notes

Further products with its corresponding substrings should be included in future.

tropy.MSGtools.rad2bt(rad, info)

Calculates brightness temperature of infrared channels given the radiance and info list containing calibration coefficients.

Parameters:
  • rad (numpy array) – radiance of an infrared channel
  • info (dict) – dictionary which contains information about calibration coefficients.
Returns:

bt – brightness temperature

Return type:

numpy array

tropy.MSGtools.rad2refl(rad, info, day, coszen)

Conversion of satellite radiances in reflectances.

Parameters:
  • rad (numpy array) – radiance of a visible channel
  • info (dict) – dictionary which contains information about calibration coefficients
  • day (datetime object) – day and time of MSG time slot
  • coszen (numpy array) – cosine of sun zenith angle
Returns:

refl – reflectance

Return type:

numpy array

tropy.MSGtools.read_rad_from_hdf(hfile)

Reads radiances from synthetic satellite calculation which are intermediately saved in an hdf file.

Parameters:hfile (str) – file name of the hdf file where synthetic radiances are stored.
Returns:RAD – dictionary of radiances
the channel name, e.g. IR_108, is used as key to access the
data array (e.g. saved on COSMO grid)
Return type:dict