[NARCCAP-discuss] Clipping a sub-domain from NARCCAP data based on lat/lon

Darrin Sharp dsharp at coas.oregonstate.edu
Thu Mar 22 17:55:53 MDT 2012


Is there an easy way using netcdf operators (nco) to clip a subdomain  
from the NARCCAP North American coverage?

For example, I want to look at the subdomain defined by  
(41.5N<=lat<=49.5N) and (236E<=lon<=249E). This is the Pacific  
Northwest (i.e. OR, WA, part of ID).

I'm familiar with using nco to clip based on dimensions, where in a  
case like this lat and lon would be dimensions. In that case I'd do  
something like:

ncks -h -O -d lat,41.5,49.5 -d lon,236,249  
tas_CRCM_cgcm3_1968010103.nc out.nc

But since the dimensions in NARCCAP are xc and yc (in meters) and not  
lat/lon (in degrees) that doesn't work.

I've been trying to use ncap2 with a script to mask the lat and lon  
variables, but am not having much luck. For example:

ncap2 -s 'mask_var=(lat>=41.5 && lat <= 49.5) && (lon>=236 &&  
lon<=249);' tas_CRCM_cgcm3_1968010103.nc out.nc

This ncap2 command works (i.e. produces a valid out.nc file), but I'm  
not sure what to do with it then.

Am I making this too hard? Is there an easier way?

-Darrin

======================================
Darrin Sharp
Faculty Research Assistant
Oregon Climate Change Research Inst. (OCCRI)
dsharp at coas.oregonstate.edu
970-219-6713



More information about the narccap-discuss mailing list