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

Seth McGinnis mcginnis at ucar.edu
Fri Mar 23 08:54:55 MDT 2012


Hi Darrin,

It sounds like you want ncap2's "where" statement.  I've never used it, but the
example in section 4.1.13 of the NCO documentation matches almost exactly what
you're trying to do.

Cheers,

--Seth

P.S.: If you get it working, share your technique with the list, would you?

On Thu, 22 Mar 2012 17:55:53 -0600
 Darrin Sharp <dsharp at coas.oregonstate.edu> wrote:
>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
>
>_______________________________________________
>narccap-discuss mailing list
>narccap-discuss at mailman.ucar.edu
>http://mailman.ucar.edu/mailman/listinfo/narccap-discuss



More information about the narccap-discuss mailing list