Project

General

Profile

Removing spatial area from dataset, defined by another NetCDF file

Added by P Ruess almost 3 years ago

I have two files, one contains data in a latlon box larger than the continental united states, and the other contains (irrelevant) data inside only the continental united states. All data values are between 0 and 1, and all mask values are equal to 2.

I want to take the larger dataset and remove all values where data is present in the smaller dataset. So effectively I want to cut out the CONUS and keep only the data remaining in Canada and Mexico.

This seems like a good solution for cutting out an area defined by a latlon box: https://stackoverflow.com/questions/43514609/nco-how-to-remove-cut-values-from-a-specific-area. But I instead want to cut out using a mask file.

Thank you for any help!


Replies (1)

RE: Removing spatial area from dataset, defined by another NetCDF file - Added by Karin Meier-Fleischer almost 3 years ago

Hi P,

that is quite simple because both data sets are on the same grid. Use the ifthen operator to get only the data given by mask.nc:

cdo ifthen mask.nc data.nc masked_data.nc

-Karin

    (1-1/1)