This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
other:python:jyp_steps [2021/09/22 13:18] jypeter [CDAT-related resources] uv-cdat => cdat |
other:python:jyp_steps [2021/09/22 13:42] jypeter Added xarray |
||
---|---|---|---|
Line 141: | Line 141: | ||
* [[https://numpy.org/doc/stable/reference/routines.err.html|Floating point error handling]] | * [[https://numpy.org/doc/stable/reference/routines.err.html|Floating point error handling]] | ||
- | ===== cdms2 and netCDF4 ===== | + | ===== NetCDF files: using cdms2, xarray and netCDF4 ===== |
There is a good chance that your input array data will come from a file in the [[other:newppl:starting#netcdf_and_file_formats|NetCDF format]]. | There is a good chance that your input array data will come from a file in the [[other:newppl:starting#netcdf_and_file_formats|NetCDF format]]. | ||
- | Depending on which [[other:python:starting#some_python_distributions|python distribution]] you are using, you can use the //cdms2// or or //netCDF4// modules to read the data. | + | Depending on which [[other:python:starting#some_python_distributions|python distribution]] you are using, you can use the //cdms2//, //xarray// or //netCDF4// modules to read the data. |
==== cdms2 ==== | ==== cdms2 ==== | ||
- | Summary: cdms2 can read/write netCDF files (and read //grads// dat+ctl files) and provides a higher level interface than netCDF4. cdms2 is available in the [[other:python:starting#uv-cdat|UV-CDAT distribution]], and can theoretically be installed independently of UV-CDAT (e.g. it will be installed when you install [[https://cmor.llnl.gov/mydoc_cmor3_conda/|CMOR in conda)]]. When you can use cdms2, you also have access to //cdtime//, that is very useful for handling time axis data. | + | Summary: cdms2 can read/write netCDF files (and read //grads// dat+ctl files) and provides a higher level interface than netCDF4. cdms2 is available in the [[other:python:starting#cdat|CDAT distribution]], and can theoretically be installed independently of CDAT (e.g. it will be installed when you install [[https://cmor.llnl.gov/mydoc_cmor3_conda/|CMOR in conda)]]. When you can use cdms2, you also have access to //cdtime//, that is very useful for handling time axis data. |
How to get started: | How to get started: | ||
Line 156: | Line 156: | ||
- you have to replace //cdms// with **cdms2**, and //MV// with **MV2** (sooorry about that, the tutorial was written when CDAT was based on //Numeric// instead of //numpy// to handle array data) | - you have to replace //cdms// with **cdms2**, and //MV// with **MV2** (sooorry about that, the tutorial was written when CDAT was based on //Numeric// instead of //numpy// to handle array data) | ||
- read the [[http://cdms.readthedocs.io/en/docstanya/index.html|official cdms documentation]] (link may change) | - read the [[http://cdms.readthedocs.io/en/docstanya/index.html|official cdms documentation]] (link may change) | ||
+ | |||
+ | ==== xarray ==== | ||
+ | |||
+ | Summary: [[http://xarray.pydata.org/en/stable/|xarray]] is an open source project and Python package that makes working with labelled multi-dimensional arrays simple, efficient, and fun! [...] It is particularly tailored to working with netCDF files | ||