Page tree
Skip to end of metadata
Go to start of metadata

I have netcdf file. I need to extract the data in polygon box. In CDO (climate data operator), the data can be mask in the rectangular box but not possible in the polygon box. Could anyone tell me that how to use CDO to extract data as polygon box 

  • No labels


  1. user-7b92a

    I wasn't familiar with the CDO tool before you asked this question but I found this user guide online. It looks like you can use MASKREGION to define a rectangular polygon box. See section 2.6.9. If you want to define an arbitrary polygon it looks like the CDO tool doesn't support that based on the documentation I found.

    1. Unknown User (kunal.bali9)

      I tried with maskregion, but it does not take polygon box. I am also trying in NCL but still not getting it. If you use NCL software, then i can show you my script.

  2. I have done something similar in the past using gdal, specifically goal_rasterize, to "burn" a mask using a shapefile, outputting it in netcdf.  According to the documentation, putting your polygon in any OGR vector format file should work:  (GeoJSON might be the easiest.)  Then either nco or GrADS can be used to apply the mask to the file, resulting in a file where the areas outside the polygon are fill values.  Here is a recipe for the GrADS option, which will work if your data is well-formatted netCDF or HDF: