Reputation: 457
As the title indicates, I want to extract a time period e.g january for a variable, wind_speed
, from a .nc
file that consists of wind speeds with 3-hourly resolution during one year. I would like to do this in nco if possible.
I tried the following method: ncrcat -O -F -d time,1,248 -v wind_speed sfcWind.nc out.nc
and it works. For this method I need to calculate the time span during the chosen month. Is there any other method in nco where one can specify the month and get the corresponding data?
Another thing is that if one wants data for dec, jan, feb then this method cannot be used, or at least to my knowledge. Any suggestions here?
Best Smail
Upvotes: 3
Views: 1498
Reputation: 8107
cdo can do the trick, set the index to the month of your choice.
cdo selmon,1 sfcWind.nc sfcWind_jan.nc
If you want to select several months as you mention, you can just provide a comma separated list (of course if you have a single year of data, then your december will not be "adjacent" to the Jan, Feb).
Upvotes: 0
Reputation: 6352
NCO supports multislabs, i.e., multiple time hyperslabs in one command. With this you can group together arbitrary months, and the --msa switch will keep them in order. The manual is your friend.
Upvotes: 3