What is the correct command for extracting a period from a netcdf ?
Added by Eléonore R over 2 years ago
I am a beginner with CDO and I would like to extract a period from a NetCDF file.
CDO is well installed. I am using python 3.10.
I try the following command :
from netCDF4 import Dataset
import pandas as pd
import numpy as np
from cdo import *
data = Dataset("PATH/temperature.nc",'r')
cdo select,startdate=2000-01-01,enddate=2010-12-31 data output.nc
and have this message : "SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers"
Do you know how to fix that?
Replies (1)
RE: What is the correct command for extracting a period from a netcdf ? - Added by Karin Meier-Fleischer over 2 years ago
Hi Eléonore,
you have mixed up the python and the command line use of CDO.
If you want to generate an output file with python-cdo:
from cdo import * cdo = Cdo() cdo.select('startdate=2000-01-01,end_date=2010-12-31', input='temperature.nc', output='output.nc')
-Karin