auromat.mapping.themis module

class auromat.mapping.themis.ThemisMappingProvider(cdfL1CacheFolder, cdfL2CacheFolder, altitude=110, minBrightness=None, maxBrightness=None, offline=False)[source]

Bases: auromat.mapping.mapping.BaseMappingProvider

Parameters:maxTimeOffset – in seconds
contains(date)[source]

Return True if there is a mapping for the given date within +-maxTimeOffset.

Parameters:date (datetime) –
Return type:bool
download(dateBegin, dateEnd)[source]

Download data in the given interval. An error is raised if self.offline is True and the data has not been downloaded yet.

get(date)[source]

Returns the mapping which is closest to the given date within +-maxTimeOffset.

Parameters:date (datetime) –
Return type:BaseMapping or MappingCollection
Raises ValueError:
 when no mapping exists for the given date
getById(identifier)[source]

Returns the mapping with the given identifier.

Parameters:identifier (string) –
Return type:BaseMapping or MappingCollection
Raises ValueError:
 when no mapping with the given identifier exists
getSequence(dateBegin, dateEnd)[source]

Returns a generator of mappings ordered by date for the given date range. If dateBegin and dateEnd are None, then all available mappings are returned.

Parameters:
  • dateBegin (datetime) –
  • dateEnd (datetime) – inclusive
Return type:

list of BaseMapping or MappingCollection objects

range

The dates of the first and last available mappings.

Return type:datetime tuple (from, to)
auromat.mapping.themis.bytscl(array, max_=None, min_=None, top=255)[source]
See:https://github.com/mperrin/misc_astro/blob/master/idlastro_ports/idlbase.py
License:https://github.com/mperrin/misc_astro/blob/master/LICENSE.rst
auromat.mapping.themis.downloadL1Data(cdfL1CacheFolder, station, date, retry404After=datetime.timedelta(30))[source]
Parameters:retry404After (datetime.timedelta) – amount of time after which 404’d requests are retried
auromat.mapping.themis.downloadL2Data(cdfL2CacheFolder, station)[source]
auromat.mapping.themis.getL1Data(cdfL1CacheFolder, station, date, maxTimeOffset=2)[source]

Loads a single image (if available) corresponding to the given date.

Parameters:
  • cdfL1CacheFolder
  • station
  • date
  • maxTimeOffset – maximum difference in seconds between nearest image and given date
auromat.mapping.themis.getL1Filename(station, date)[source]
auromat.mapping.themis.getL2Data(cdfL2CacheFolder, station)[source]
Parameters:
  • cdfL2CacheFolder – full path to folder where L2 CDF files are/should be stored
  • station – name of the station in lower case
Return type:

tuple (latASI,lonASI), az, el, latsRef, lonsRef, heightsRef (km)

Raises:

DownloadError (in case of network/IO problems)

auromat.mapping.themis.getMappings(photoTime, cdfL1CacheFolder, cdfL2CacheFolder, altitude=110, maxTimeOffset=2, minBrightness=None, maxBrightness=None, offline=False)[source]

Returns a mapping collection for all available ASIs.

auromat.mapping.themis.hasL1Data(cdfL1CacheFolder, station, date, retry404After=datetime.timedelta(30))[source]
auromat.mapping.themis.hasL2Data(cdfL2CacheFolder, station)[source]
auromat.mapping.themis.mappingSingleASI(station, date, cdfL1CacheFolder, cdfL2CacheFolder, maxTimeOffset=2, altitude=110, minBrightness=None, maxBrightness=None, offline=False)[source]
auromat.mapping.themis.maskByL2(mask, img)[source]

Masks image pixels using the L2 mask.

WARNING: Don’t use this method as the L2 masks seem to contain
inconsistent data (interpretation of 0 and 1 mixed up in one case)
Parameters:
  • mask – L2 mask of shape (w,w)
  • img (ndarray) – grayscale img (w,w)
Return type:

ndarray<float32> with masked pixels set to NaN

auromat.mapping.themis.reproject(latLonASI, latsRef, lonsRef, heightRef, heightNew)[source]
Parameters:
  • latLonASI – tuple of latitude,longitude of ASI
  • latsRef – latitudes of pixel corners for reference height in degrees
  • lonsRef – longitudes of pixel corners for reference height in degrees
  • heightRef – reference height in km (above ground)
  • heightNew – new height in km (above ground)
Return type:

tuple of reprojected latitudes and longitudes