Is there any fast method to extract land area data from the global area in netcdf files?
Added by Wi Du over 7 years ago
Hello, everyone,
I have a lot of global netcdf files. I want to extract the data of land area to for saving time to calculate for other things. In other words, I donot need the sea area's data.
So is there some fast method to do?
Thanks a lot!
Best regards,
Du
Replies (1)
RE: Is there any fast method to extract land area data from the global area in netcdf files? - Added by Karin Meier-Fleischer over 7 years ago
Hi Wi,
first, let us assume that all files have the same grid and are netcdf files.
file1.nc: one of your data files
file_mask_ocean.nc: mask file to be created
You have to create a mask file only once where land has a value greater 0 from your infile
cdo -f nc -gtc,0 -topo,*file1.nc* *file_mask_ocean.nc*
Then you can mask the ocean values of your data file ('cdo ifthen': select all field elements of file1.nc if the corresponding field element of file_mask_ocean.nc is greater than 0)
cdo ifthen file_mask_ocean.nc file1.nc file1_only_data_on_land.nc
-Karin