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

Shem, Willis O. shemwo at ornl.gov
Fri Mar 23 12:49:39 MDT 2012


You could also try using the NCL function "getind_latlon2d" to get the xc, yc indices closest to your specified lat, lon. You can then proceed with nco/ncks using the indices instead of lat/lon. Hope this helps.

Willis Shem

-----Original Message-----
From: narccap-discuss-bounces at mailman.ucar.edu [mailto:narccap-discuss-bounces at mailman.ucar.edu] On Behalf Of Darrin Sharp
Sent: Thursday, March 22, 2012 7:56 PM
To: Discussion of NARCCAP data - uses and questions
Subject: [NARCCAP-discuss] Clipping a sub-domain from NARCCAP data based on lat/lon

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