Abstraction of the base CDF C library and its state.
Not normally intended for end-user use. An instance of this class is created at package load time as the lib variable, providing access to the underlying C library if necessary. The CDF library itself is described in section 2.1 of the CDF user’s guide, as well as the CDF C reference manual.
Calling the C library directly requires knowledge of ctypes.
Instantiating this object loads the C library, see pycdf - Python interface to CDF files docs for details.
call(*args, **kwargs) | Call the CDF internal interface |
check_status(status[, ignore]) | Raise exception or warning based on return status of CDF call |
datetime_to_epoch(dt) | Converts a Python datetime to a CDF Epoch value |
datetime_to_epoch16(dt) | Converts a Python datetime to a CDF Epoch16 value |
datetime_to_tt2000(dt) | Converts a Python datetime to a CDF TT2000 value |
epoch_to_datetime(epoch) | Converts a CDF epoch value to a datetime |
epoch_to_epoch16(epoch) | Converts a CDF EPOCH to a CDF EPOCH16 value |
epoch_to_tt2000(epoch) | Converts a CDF EPOCH to a CDF TT2000 value |
epoch16_to_datetime(epoch0, epoch1) | Converts a CDF epoch16 value to a datetime |
epoch16_to_epoch(epoch16) | Converts a CDF EPOCH16 to a CDF EPOCH value |
epoch16_to_tt2000(epoch0, epoch1) | Converts a CDF epoch16 value to TT2000 |
set_backward([backward]) | Set backward compatibility mode for new CDFs |
supports_int8 | |
tt2000_to_datetime(tt2000) | Converts a CDF TT2000 value to a datetime |
tt2000_to_epoch(tt2000) | Converts a CDF TT2000 value to a CDF EPOCH |
tt2000_to_epoch16(tt2000) | Converts a CDF TT2000 value to a CDF EPOCH16 |
v_datetime_to_epoch | |
v_datetime_to_epoch16 | |
v_datetime_to_tt2000 | |
v_epoch_to_datetime | |
v_epoch_to_tt2000 | |
v_epoch16_to_datetime | |
v_epoch16_to_tt2000 | |
v_tt2000_to_datetime | |
v_tt2000_to_epoch | |
v_tt2000_to_epoch16 | |
Library.version |
Call the CDF internal interface
Passes all parameters directly through to the CDFlib routine of the CDF library’s C internal interface. Checks the return value with check_status().
Terminal NULL is automatically added to args.
Parameters: | args : various, see ctypes
|
---|---|
Returns: | out : int
|
Other Parameters: | |
ignore : sequence of CDF statuses
|
|
Raises: | CDFError : if CDF library reports an error |
Warns: | CDFWarning : if CDF library reports a warning |
Raise exception or warning based on return status of CDF call
Parameters: | status : int
|
---|---|
Returns: | out : int
|
Other Parameters: | |
ignore : sequence of ctypes.c_long
|
|
Raises: | CDFError : if status < CDF_WARN, indicating an error |
Warns: | CDFWarning : if CDF_WARN <= status < CDF_OK, indicating a warning. |
Converts a Python datetime to a CDF Epoch value
Parameters: | dt : datetime.datetime
|
---|---|
Returns: | out : float
|
See also
Converts a Python datetime to a CDF Epoch16 value
Parameters: | dt : datetime.datetime
|
---|---|
Returns: | out : list of float
|
See also
Converts a Python datetime to a CDF TT2000 value
Parameters: | dt : datetime.datetime
|
---|---|
Returns: | out : int
|
See also
Converts a CDF epoch value to a datetime
Parameters: | epoch : float
|
---|---|
Returns: | out : datetime.datetime
|
See also
Converts a CDF EPOCH to a CDF EPOCH16 value
Parameters: | epoch : double
|
---|---|
Returns: | out : (double, double)
|
Converts a CDF EPOCH to a CDF TT2000 value
Parameters: | epoch : double
|
---|---|
Returns: | out : int
|
See also
Converts a CDF epoch16 value to a datetime
Note
The call signature has changed since SpacePy 0.1.2. Formerly this method took a single argument with two values; now it requires two arguments (one for each value). To convert existing code, replace epoch16_to_datetime(epoch) with epoch16_to_datetime(*epoch).
Parameters: | epoch0 : float
epoch1 : float
|
---|---|
Returns: | out : datetime.datetime
|
Raises: | EpochError : if input invalid |
See also
Converts a CDF EPOCH16 to a CDF EPOCH value
Parameters: | epoch16 : (double, double)
|
---|---|
Returns: | out : double
|
Converts a CDF epoch16 value to TT2000
Note
Because TT2000 does not support picoseconds, the picoseconds value in epoch is ignored (i.e., truncated.)
Parameters: | epoch0 : float
epoch1 : float
|
---|---|
Returns: | out : long
|
Raises: | EpochError : if input invalid |
See also
Set backward compatibility mode for new CDFs
Unless backward compatible mode is set, CDF files created by the version 3 library can not be read by V2.
Parameters: | backward : boolean
|
---|---|
Raises: | ValueError : if backward=False and underlying CDF library is V2 |
True if this library supports INT8 and TIME_TT2000 types; else False.
Converts a CDF TT2000 value to a datetime
Note
Although TT2000 values support leapseconds, Python’s datetime object does not. Any times after 23:59:59.999999 will be truncated to 23:59:59.999999.
Parameters: | tt2000 : int
|
---|---|
Returns: | out : datetime.datetime
|
Raises: | EpochError : if input invalid |
See also
Converts a CDF TT2000 value to a CDF EPOCH
Note
Although TT2000 values support leapseconds, CDF EPOCH values do not. Times during leapseconds are rounded up to beginning of the next day.
Parameters: | tt2000 : int
|
---|---|
Returns: | out : double
|
Raises: | EpochError : if input invalid |
See also
Converts a CDF TT2000 value to a CDF EPOCH16
Note
Although TT2000 values support leapseconds, CDF EPOCH16 values do not. Times during leapseconds are rounded up to beginning of the next day.
Parameters: | tt2000 : int
|
---|---|
Returns: | out : double, double
|
Raises: | EpochError : if input invalid |
See also
A vectorized version of datetime_to_epoch() which takes a numpy array of datetimes as input and returns an array of epochs.
A vectorized version of datetime_to_epoch16() which takes a numpy array of datetimes as input and returns an array of epoch16.
A vectorized version of datetime_to_tt2000() which takes a numpy array of datetimes as input and returns an array of TT2000.
A vectorized version of epoch_to_datetime() which takes a numpy array of epochs as input and returns an array of datetimes.
A vectorized version of epoch_to_tt2000() which takes a numpy array of epochs as input and returns an array of tt2000s.
A vectorized version of epoch16_to_datetime() which takes a numpy array of epoch16 as input and returns an array of datetimes. An epoch16 is a pair of doubles; the input array’s last dimension must be two (and the returned array will have one fewer dimension).
A vectorized version of epoch16_to_tt2000() which takes a numpy array of epoch16 as input and returns an array of tt2000s. An epoch16 is a pair of doubles; the input array’s last dimension must be two (and the returned array will have one fewer dimension).
A vectorized version of tt2000_to_datetime() which takes a numpy array of tt2000 as input and returns an array of datetimes.
A vectorized version of tt2000_to_epoch() which takes a numpy array of tt2000 as input and returns an array of epochs.
A vectorized version of tt2000_to_epoch16() which takes a numpy array of tt2000 as input and returns an array of epoch16.
Version of the CDF library, (version, release, increment, subincrement)