Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
other:python:jyp_steps [2021/09/22 16:23] – Added statsmodels, scikit-learn and scikit-image jypeter | other:python:jyp_steps [2023/02/01 17:42] – [Using NetCDF files with Python] Improved jypeter |
---|
| |
==== Extra numpy information ==== | ==== Extra numpy information ==== |
| |
| <WRAP center round tip 60%> |
| You can also check the [[other:python:misc_by_jyp#numpy_related_stuff|numpy section]] of the //Useful python stuff// page |
| </WRAP> |
| |
| |
* More information about **array indexing**:\\ <wrap em>Always check what you are doing on a simple test case, when you use advanced/fancy indexing!</wrap> | * More information about **array indexing**:\\ <wrap em>Always check what you are doing on a simple test case, when you use advanced/fancy indexing!</wrap> |
* [[https://numpy.org/doc/stable/reference/routines.array-creation.html|Array creation routines]] | * [[https://numpy.org/doc/stable/reference/routines.array-creation.html|Array creation routines]] |
* [[https://numpy.org/doc/stable/reference/routines.array-manipulation.html|Array manipulation routines]] | * [[https://numpy.org/doc/stable/reference/routines.array-manipulation.html|Array manipulation routines]] |
| * [[https://numpy.org/doc/stable/reference/routines.sort.html|Sorting, searching, and counting routines]] |
* [[https://numpy.org/doc/stable/reference/maskedarray.html|Masked arrays]] | * [[https://numpy.org/doc/stable/reference/maskedarray.html|Masked arrays]] |
* [[https://numpy.org/doc/stable/reference/routines.ma.html|Masked array operations]] | * [[https://numpy.org/doc/stable/reference/routines.ma.html|Masked array operations]] |
* [[https://numpy.org/doc/stable/user/misc.html#ieee-754-floating-point-special-values|Dealing with special numerical values]] (//Nan//, //inf//) | * [[https://numpy.org/doc/stable/user/misc.html#ieee-754-floating-point-special-values|Dealing with special numerical values]] (//Nan//, //inf//) |
* If you know that your data has missing values, it is cleaner and safer to handle them with [[https://numpy.org/doc/stable/reference/maskedarray.html|masked arrays]]! | * If you know that your data has missing values, it is cleaner and safer to handle them with [[https://numpy.org/doc/stable/reference/maskedarray.html|masked arrays]]! |
| * If you know that some of your data //may// have masked values, play safe by explicitly using ''np.ma.some_function()'' rather than just ''np.some_function()'' |
| * More details in the [[https://github.com/numpy/numpy/issues/18675|Why/when does np.something remove the mask of a np.ma array ?]] discussion |
* [[https://numpy.org/doc/stable/user/misc.html#how-numpy-handles-numerical-exceptions|Handling numerical exceptions]] | * [[https://numpy.org/doc/stable/user/misc.html#how-numpy-handles-numerical-exceptions|Handling numerical exceptions]] |
* [[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]] |
| |
===== NetCDF files: using cdms2, xarray and netCDF4 ===== | ===== Using NetCDF files with Python ===== |
| |
| <note tip>People using CMIPn and model data on the IPSL servers can easily search and process NetCDF files using: |
| * the [[https://climaf.readthedocs.io/|Climate Model Assessment Framework (CliMAF)]] environment |
| * and the [[https://github.com/jservonnat/C-ESM-EP/wiki|CliMAF Earth System Evaluation Platform (C-ESM-EP)]] |
| </note> |
| |
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 be stored in a [[other:newppl:starting#netcdf_and_related_conventions|NetCDF]] file. |
| |
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. | * There may be different ways of dealing with NetCDF files, depending on which [[other:python:starting#some_python_distributions|python distribution]] you have access to |
| |
==== cdms2 ==== | ==== cdms2 ==== |