geoschem / integrated_methane_inversion

Integrated Methane Inversion workflow repository.
https://imi.readthedocs.org
MIT License
26 stars 22 forks source link

ncmax command is too resource intensive #123

Closed laestrada closed 1 year ago

laestrada commented 1 year ago

These two lines seem to be limiting the system requirements capable of running the IMI:

ncmax() { ncap2 -O -C -v -s "foo=${1}.max();print(foo)" ${2} ~/foo.nc | cut -f 3- -d ' ' ; }
nElements=$(ncmax StateVector ${RunDirs}/StateVector.nc)

Running this on a c5a.8xlarge (32 vCPUs and 64 GB memory) EC2 instance fails, while a c5.9xlarge (36 vCPUs and 72GB memory) succeeds. We should update this to use a less resource-intensive function for calculating the number of statevector elements.

laestrada commented 1 year ago

@msulprizio My feeling is that we could write a short python script to extract the statevector size, but do you have any other ideas via shell commands?

msulprizio commented 1 year ago

@laestrada That may be easiest. I was thinking we could output that value from the python script that generates the state vector, but that doesn't help in the case of a user-provided state vector file.

CDO has a fldmax function, but that writes the value to yet another netCDF file which doesn't seem useful. See page 85 here: http://www.idris.fr/media/ada/cdo.pdf.

laestrada commented 1 year ago

Fixed with #124