Miscellaneous
Reading data
The
read_data()
method allows to read data from a
source, in order to have a look at it without performing any diagnostic.Read the requested fields and rename them according to the
dictionary.
Parameters
----------
fields
Dictionary of fields names matched to their source.
start
Starting date of the data to get.
end
Ending date of the data to get.
include_end
Whether to include the end date or not.
alt_source
Whether to use fields' alternative source or not.
Returns
-------
:
Fields values as a Dataset
from casys import DateHandler, Field
start = DateHandler("2016/06/01 12:00")
end = DateHandler("2016/06/01 12:10")
sla = Field(
name="SLA",
source="ORBIT.ALTI - RANGE.ALTI - MEAN_SEA_SURFACE.MODEL.CNESCLS15",
unit="m"
)
sig0 = Field(name="sig0", source="SIGMA0.ALTI")
ad.read_data(fields=[sla, sig0], start=start, end=end)
<xarray.Dataset> Size: 14kB Dimensions: (time: 598) Coordinates: * time (time) datetime64[ns] 5kB 2016-06-01T12:00:00.437302 ... 2016-06... Data variables: SLA (time) float64 5kB -2.585 -2.702 -2.634 -2.693 ... nan nan nan nan sig0 (time) float64 5kB 23.18 21.93 22.63 23.82 ... nan nan nan nan
Information level logging
Enabling information level logging allows to follow computation steps in details in
addition to non critical but sometimes useful information.
The INFO level can be set using the logging module or directly with the
enable_loginfo()
method.from casys import NadirData
NadirData.enable_loginfo()
It can be disabled using the
disable_loginfo()
method.NadirData.disable_loginfo()
Removing diagnostics
Previously added diagnostics might be removed using the
clear()
methods:Clear all or the specified diagnostic from this AltiData.
Parameters
----------
name
Name of the data to remove (Not providing a name will remove all data).
Storing and loading
NadirData and SwathData objects can be stored and loaded in order to be shared or reused without
having to read, configure or compute everything again.
These operations are done using the
store()
method.Storing method
Store this AltiData object into a pickle format.
Parameters
----------
name
Name and path of the file.
overwrite
Whether to overwrite any existing file or not.
Returns
-------
Loading method
Load a previously stored AltiData object.
Parameters
----------
name
Name and path of the file.
Returns
-------
:
The loaded object.
Example
# Storing
ad.store(data_path, overwrite=True)
# Loading
loaded_data = NadirData.load(data_path)