Monthly average for a given location in a daily netcdf file

Viewed 119

I have a netcdf file with the daily precipitation (for a whole decade) in every latitude and longitude, it's in the form (lon,lat,time). I want to get the monthly average for the longitude=-118.25:-84.75 and for the latitude=13.25:33.25. I need to write another netcdf file in which the variable is monthly precipitation given by (lon,lat,time) but i dont know how to extract the ranges and how to obtain the monthly average since the months are repeated each year.

1 Answers

Just use the tool called cdo and operator sellonlatbox:

cdo -sellonlatbox -118.25,-84.75,13.25,33.25 filein fileout

filein is the name of your input file and fileout is the name of the output.

Afterwards you can use operator monmean to calculate monthly means:

cdo -monmean fileout final_file
Related