Data Manipulation¶
Todo
This section is a draft.
Methods provided by CliMetLab data objects¶
Methods provided by CliMetLab data objects (such as a Dataset, a data Source or a Reader): Depending on the data, some of these methods are or are not available.
A CliMetLab data object provides methods to access and use its data.
>>> source.to_xarray() # for gridded data
>>> source.to_pandas() # for non-gridded data
>>> source.to_numpy() # When the data is a n-dimensional array.
>>> source.to_tfrecord() # Experimental
Todo
Explain fields.to_xarray() and obs.to_pandas().
Explain data[0]
Add here more details about the .to_… methods.
Merging Data sources¶
Warning
The merger functionality is experimental, the API may change.
Todo
add documentation on merging. merge=concat(). merge=merge().
import climetlab as cml
import xarray as xr
class MyMerger():
def __init__(self, *args, **kwargs):
pass
def merge(self, paths, **kwargs):
return xr.open_mfdataset(paths)
data = cml.load_source("url-pattern",
"https://www.example.com/data-{foo}-{bar}-{qux}.csv",
foo = [1,2,3],
bar = ["a", "b"],
qux = "unique"
merger = MyMerger()
)