Closed jypeter closed 3 years ago
@jypeter thanks for the comments, regarding
runCmorDemo.py
uses cdms2..
When you install cmor
using conda you get:
[duro:~] duro% conda create -n cmorTest -c conda-forge -c pcmdi cmor
Fetching package metadata ...............
Solving package specifications: .
Package plan for installation in environment /Users/duro/anaconda2/envs/cmorTest:
The following NEW packages will be INSTALLED:
...
cdat_info: 2.12-py27_1 conda-forge
cdms2: 2.12-np113py27_0 conda-forge
cdtime: 2.12-np113py27_2 conda-forge
...
cmor: 3.2.8-py27h36f1b5e_0 pcmdi
...
esmf: 7.0.0-6 conda-forge
esmpy: 7.0.0-py27_1 conda-forge
...
hdf4: 4.2.13-0 conda-forge
hdf5: 1.8.18-2 conda-forge
...
libcdms: 2.12-0 conda-forge
libcf: 1.0.1-py27_0 conda-forge
libdrs: 2.12-0 conda-forge
libdrs_f: 2.12-1 conda-forge
libffi: 3.2.1-3 conda-forge
libgcc: 4.8.5-hdbeacc1_10
libgfortran: 3.0.1-h93005f0_2
libnetcdf: 4.4.1.1-9 conda-forge
...
netcdf-fortran: 4.4.4-3 conda-forge
numpy: 1.13.3-py27h62f9060_0
...
python: 2.7.14-1 conda-forge
...
So there is no need to specify additional packages to be installed, as the `cmor` conda install provides a full-featured working environment
@jypeter regarding
runCmorDemo.py
, I think that you convert a cdms2 variable to a straight numpy variable, with values = np.array(d[:],np.float32)
. But I think (I could be wrong!) that you should either use values = d.filled()
if you want to get rid of the mask (knowing that you have used missing_value=d.missing
above, or use values = np.ma.asarray(d,np.float32)
if you want to preserve the mask and get a numpy.ma variable. I have several times had problems when using np instead of np.ma on actually masked variablesIt would be great if you could provide a demo for a masked dataset, the prw
example that we have doesn't include missing/masked data
@dnadeau4 can you provide a comment about using numpy
vs cdms
references when passing data to cmor
? So a response for "best practise" to @jypeter's https://github.com/PCMDI/obs4MIPs-cmor-tables/issues/134#issuecomment-343258071 above?
@doutriaux1 you may also have a perspective here
Oh, OK! I did not know that installing cmor would get you cdms2 and its dependencies as well, but it makes sense. Also I did not know that you could now safely install cdms2 independently of the full uv-cdat, which is good to know.
Maybe the sentence CMOR can be obtained via Anaconda at https://anaconda.org/PCMDI/cmor once the user has installed Anaconda (https://continuum.io) in the demo page could be replaced with a link to CMOR Anaconda Installation, and CMOR installation can mention CDMS2: https://github.com/PCMDI/cmor/issues/268
I have looked for missing on the CMOR API page, and read the definition of data in the cmor_write
function, but it does not say if it is allowed to use a np.ma or a cdms2 variable, or if you have to pass it a filled np variable. I guess you would have to declare the missing_value in cmor_variable
anyway
Thanks @durack1 for the
demo/
directory! I have not run the demo but I have some questions:readme.md
file says that you need a conda-based python and cmor, butrunCmorDemo.py
uses cdms2. Maybe you should add a note that people wanting to run the demo as is should install uv-cdat?runCmorDemo.py
, I think that you convert a cdms2 variable to a straight numpy variable, withvalues = np.array(d[:],np.float32)
. But I think (I could be wrong!) that you should either usevalues = d.filled()
if you want to get rid of the mask (knowing that you have usedmissing_value=d.missing
above, or usevalues = np.ma.asarray(d,np.float32)
if you want to preserve the mask and get a numpy.ma variable. I have several times had problems when using np instead of np.ma on actually masked variables