CDO outputtab in python
Added by Rodrigo Sousa over 3 years ago
Hello,
I would like to know how is the outputtab command in CDO.
At the moment I'm using os.system and it works fine.
os.system("cdo -outputtab,nohead,value -remapnn,lon=-35.8776_lat=-5.29844 -selvar,10v " + path_ifile + " >" + path_output)
where:
path_ifile = ifile.nc
path_output = outfile.txt
Thanks
Replies (2)
RE: CDO outputtab in python - Added by Rodrigo Sousa over 3 years ago
Sorry,
*outputtab command in PYTHON.
RE: CDO outputtab in python - Added by Karin Meier-Fleischer over 3 years ago
Hi Rodrigo,
you don't need os.system when you install python-cdo. You can do it with
conda install -c conda-forge python-cdo
Then the python script would look like this
from cdo import * path_ifile = "ifile.nc" path_output = "outfile.txt" cdo = Cdo() cdo.outputtab('nohead,value', input='-remapnn,lon=-35.8776_lat=-5.29844 -selvar,10v ' + path_ifile +" > "+ path_output)
-Karin