irfpy.imacommon.imaextra2
¶
Common functionality and data structures for IMA extra datasets.
IMA extra is a file that Andrei prepared.
This module provides classes of the netcdf formatted IMA extra datasets (gzipped).
This replaces irfpy.imacommon.imaextra
module.
This module provides low-level functionality and data structures commonly used for ASPERA-3 and -4 IMA extra. The users do not need to use this module directly.
For developer
This module contains several classes, but most of them do not need to be used by user.
The classes in this module are extended at mima.imaextra
or vima.imaextra
modules.
Nevertheless, it is worthwhile to create a list of class with a bit high-level explanation.
ImaDdNcFileCommon
represents a single file.ImaExtraFileCommon
represents a single file ofimaextra
data, extendingImaDdNcFileCommon
ImaParamFileCommon
represents a single file ofimaparam
data, extendingImaDdNcFileCommon
ImaDdNcDatabase
represents a tree of dataset, both forimaextra
andimaparam
ImaDdNcFileFactory
is a caching system, namely, from the data tree (ImaDdNcDatabase
), a single file object (ImaExtraFileCommon
orImaParamFileCommon
) is producedImaParamCommon
represents a time series ofimaparam
data.ImaExtraCommon
represents a time series ofimaextra
data.
(END for developer)
- class irfpy.imacommon.imaextra2.ImaDdNcFileCommon(filename, gunzip=True)[source]¶
Bases:
object
A common functionality of IMA DD/NC file.
This will be extened to classes
irfpy.mima.imaextra.ImaExtraFile
,irfpy.vima.imaextra.ImaExtraFile
, etc.It has a member variable
dim
andvar
, which respectively have informationon dimensions and variables.Open the file and read the data.
- logger = <Logger irfpy.imacommon.imaextra2.ImaDdNcFileCommon (DEBUG)>¶
- class irfpy.imacommon.imaextra2.ImaExtraFileCommon(*args, **kwds)[source]¶
Bases:
irfpy.imacommon.imaextra2.ImaDdNcFileCommon
IMAEXTRA file
Open the file and read the data.
- class irfpy.imacommon.imaextra2.ImaDdTimeSeries(data_key_list)[source]¶
Bases:
object
Represents a time series of DD data.
- class irfpy.imacommon.imaextra2.ImaParamCommon(key_list)[source]¶
Bases:
irfpy.imacommon.imaextra2.ImaDdTimeSeries
IMA parameter data class.
A common algorithm tha handles IMA parameter data. It is used for both MEX and VEX.
- class irfpy.imacommon.imaextra2.ImaExtraCommon(key_list)[source]¶
Bases:
irfpy.imacommon.imaextra2.ImaDdTimeSeries
IMA extra data class.
A common algorithm tha handles IMA extra data. It is used for both MEX and VEX.
- getHpSpec()[source]¶
Return the proton spectra. Counts. Order is AEPT (irfpy standard)
- Returns
Proton spectra, in the shape of (A16, E96, P16, Time). Counts.
- getHeavySpec()[source]¶
Return the heavy ion spectra. Counts. Order is AEPT (irfpy standard)
- Returns
Heavy ion spectra, in the shape of (A16, E96, P16, Time). Counts.
- class irfpy.imacommon.imaextra2.ImaParamFileCommon(*args, **kwds)[source]¶
Bases:
irfpy.imacommon.imaextra2.ImaDdNcFileCommon
Open the file and read the data.
- class irfpy.imacommon.imaextra2.ImaDdNcFileFactory(template_class, cachesize=5)[source]¶
Bases:
object
A factory class for IMA extra dataset.
Instead of creating
ImaExtraFile
orImaParamFile
instance directly, the class returns the instance with using aRingCache
.iexfact = ImaDdNcFileFactory.createFactory() iexfact.getImaExtraFile('imaextra20123640214.nc.gz')
- class irfpy.imacommon.imaextra2.ImaDdNcDatabase(database, prefix_name, ddncfactory, verbose=False)[source]¶
Bases:
object
IMA DD/NC database
The IMA DD/NC data base stores the filename and the start time guessed from the file name. By using this database, one can easily get the file name with a key of the observation time.
Create the database.
Use
createDatabase()
class method for creating database.- Parameters
database – Database directory path. If
None
, the [vima]-imaextrabase entry from irfpyrc is read.prefix_name – The filename should be
imaXXXXX20103091457.nc.gz
. The prefix,imaXXXXX
should be specified to identify the start of the time expression.ddncfactory – Factory object that create the object of the file contents. It should be an object of the class that extends
ImaDdNcFileFactory
. For example,ImaExtraFileFactory
can be given.verbose – The keyword is outdated. Do nothing. Use logging to display a log with the name of
irfpy.imacommon.imaextra2.ImaDdNcDatabase
.
- logger = <Logger irfpy.imacommon.imaextra2.ImaDdNcDatabase (DEBUG)>¶
- get_filename(t, nodata='exception')[source]¶
Return the filename from data file.
Users are recommended to use this method.
- Parameters
t – Time.
nodata – Set behaviour if the specified time falls into the data gap. ‘before’ returns the file name that has the previous data to
t
. ‘after’ return the file name that has the next data oft
. Otherwise, raise anirfpy.util.timeseriesdb.DataNotInDbError
.