geoips.plugins.classes.readers.utils package#
Submodules#
geoips.plugins.classes.readers.utils.geostationary_geolocation module#
Generalized geolocation calculations for geostationary satellites.
- exception geoips.plugins.classes.readers.utils.geostationary_geolocation.AutoGenError[source]#
Bases:
ExceptionRaise exception on auto generated geolocation error.
- exception geoips.plugins.classes.readers.utils.geostationary_geolocation.CacheNotFoundError[source]#
Bases:
FileNotFoundErrorRaise exception if cached data is not found.
- exception geoips.plugins.classes.readers.utils.geostationary_geolocation.CachedGeolocationIndexError[source]#
Bases:
IndexErrorRaise exception on cached geolocation IndexError.
- geoips.plugins.classes.readers.utils.geostationary_geolocation.calculate_solar_angles(metadata, lats, lons, dt, resource_tracker=None, area_def=None, geolocation_cache_backend=None, chunk_size=None, cache_solar_angles=False, scan_datetime=None, cache_timeout_seconds=30)[source]#
Calculate solar angles.
- geoips.plugins.classes.readers.utils.geostationary_geolocation.check_for_partial_cache(cache_filename, partial_cache_filename, cache_timeout_seconds=30)[source]#
Check if a partial data cache exists.
These partial (temporary) caches are created when the cache is being created, and is renamed once complete. If a partial cache is found, try for 30 seconds (default) to see if it is renamed to the final cache_filename
- Parameters:
cache_filename (str) – Full path to complete cache
partial_cache_filename (str) – Full path to temporary/partial cache
cache_timeout_seconds (int, optional) – Retry window to check for final cache if a partial cache is found, by default 30
- Raises:
CacheNotFoundError – If cache_filename is not found after retry window
- geoips.plugins.classes.readers.utils.geostationary_geolocation.check_geolocation_cache_backend(cache_backend, supported_backends=('memmap', 'zarr'))[source]#
Check if requested geolocation cache backend is supported.
Perhaps this should be converted to a decorator later on?
- Parameters:
cache_backend (str) – Library name used to create cached geolocation files (e.g. zarr or memmap)
supported_backends (list or tuple, optional) – Supported cache backends, by default (“memmap”, “zarr”)
- Raises:
ValueError – If cache_backend is not in supported_backends
- geoips.plugins.classes.readers.utils.geostationary_geolocation.construct_cache_filename(pref, metadata, area_def=None, cache_backend='memmap', chunk_size=None)[source]#
Construct a cached file name.
- Parameters:
pref (str) – Prefix to identify type of cached data
metadata (dict) – Top level metadata for dataset
area_def (pyresample.area_definition, optional) – Area definition subsector of data, by default None
cache_backend (str, optional) – Specify to use either numpy.memmao or zarray for cache, by default “memmap”
chunk_size (int, optional) – zarray cache chunk size, by default None
- Returns:
File name for cached data
- Return type:
str
- geoips.plugins.classes.readers.utils.geostationary_geolocation.create_empty_partial_cache(partial_cache_filename, cache_backend)[source]#
Create an empty cache with temporary name to denote cache is being processed.
Supported backends include zarray and memmap.
- Parameters:
partial_cache_filename (str) – Full path to temporary/partial cache
cache_backend (str) – Backend format of cache
- geoips.plugins.classes.readers.utils.geostationary_geolocation.get_data_cache_filename(pref, metadata, area_def=None, cache_backend='memmap', chunk_size=None, scan_datetime=None)[source]#
Get the full file path for a cached calibrated data file.
- Parameters:
pref (str) – Prefix to identify type of cached data
metadata (dict) – Top level metadata for dataset
area_def (pyresample.area_definition, optional) – Area definition subsector of data, by default None
cache_backend (str, optional) – Specify to use either numpy.memmao or zarray for cache, by default “memmap”
chunk_size (int, optional) – zarray cache chunk size, by default None
- Returns:
Full file path for cached data
- Return type:
str
- geoips.plugins.classes.readers.utils.geostationary_geolocation.get_geolocation(dt, gmd, fldk_lats, fldk_lons, BADVALS, area_def=None, resolution=None, geolocation_cache_backend='memmap', chunk_size=None, cache_solar_angles=False, scan_datetime=None, resource_tracker=None, cache_timeout_seconds=30)[source]#
Gather and return the geolocation data for the input metadata.
Input metadata should be the metadata for a single ABI data file.
If latitude/longitude have not been calculated with the metadata form the input data file they will be recalculated and stored for future use. They shouldn’t change often. This will be slow the first time it is called after a metadata update, but fast thereafter.
The same is true for satellite zenith and azimuth angles.
Solar zenith ang azimuth angles are always calculated on the fly. This is because they actually change. This may be slow for full-disk images.
- geoips.plugins.classes.readers.utils.geostationary_geolocation.get_geolocation_cache_filename(pref, metadata, area_def=None, geolocation_cache_backend='memmap', chunk_size=None, solar_angles=False)[source]#
Set the location and filename format for the cached geolocation files.
There is a separate filename format for satellite latlons and sector latlons
Notes
Changing geolocation filename format will force recreation of all files, which can be problematic for large numbers of sectors.
- geoips.plugins.classes.readers.utils.geostationary_geolocation.get_indexes(metadata, lats, lons, area_def, geolocation_cache_backend='memmap', chunk_size=None, resource_tracker=None, cache_timeout_seconds=30)[source]#
Return two 2-D arrays containing the X and Y indexes.
These are indices that should be used from the raw data for the input sector definition.
- geoips.plugins.classes.readers.utils.geostationary_geolocation.get_satellite_angles(metadata, lats, lons, BADVALS, sect=None, geolocation_cache_backend='memmap', chunk_size=None, resource_tracker=None, cache_timeout_seconds=30)[source]#
Get satellite angles.
- geoips.plugins.classes.readers.utils.geostationary_geolocation.rename_partial_cache(partial_cache_filename, final_cache_filename)[source]#
Rename partial cache to final cache file name.
- Parameters:
partial_cache_filename (str) – Full path to temporary/partial cache
final_cache_filename (str) – Full path to complete cache
geoips.plugins.classes.readers.utils.hrit_reader module#
Utility for reading HRIT datasets.
- class geoips.plugins.classes.readers.utils.hrit_reader.HritDtype[source]#
Bases:
objectHRIT data type.
- types = {'byte': 'B', 'int16': '>i2', 'int32': '>i4', 'int64': '>i8', 'int8': 'i1', 'uint16': '>u2', 'uint32': '>u4', 'uint64': '>u8', 'uint8': 'u1', 'unicode': 'U'}#
- exception geoips.plugins.classes.readers.utils.hrit_reader.HritError(msg, code=None)[source]#
Bases:
ExceptionRaise exception when errors occur in reading xRIT data files.
- class geoips.plugins.classes.readers.utils.hrit_reader.HritFile(fname)[source]#
Bases:
objectHrit File class.
- property annotation_metadata#
Return annotation metadata (ie, platform, start time, etc).
- property band#
Return band specified in block_128, if it exists.
- property basename#
Return file basename.
- property block_info#
Block info.
- property block_map#
Return block map.
- property compressed#
Return True if compressed, False if not.
- decompress(outdir)[source]#
Decompress an xRIT file and return a file handle.
The file will be decompressed to outdir and read from there.
Returns an HritFile instance for the decompressed file. If already decompressed, raises an HritError.
- property dirname#
Return file dirname.
- property epilogue#
Return epilogue.
- property file_type#
Return file_type.
- property geolocation_metadata#
Return geolocation metadata.
- property metadata#
Return metadata.
- property name#
Return name.
- property prologue#
Return prologue.
- property segment#
Return segment specified in block_128, if it exists.
- property start_datetime#
Return start_datetime.
geoips.plugins.classes.readers.utils.remss_reader module#
Read derived surface winds from REMSS SMAP, WINDSAT, and AMSR netcdf data.
Module contents#
geoips reader utils init file.