[ncl-talk] Masking Data with NCL Map Databases

Dennis Shea shea at ucar.edu
Mon Oct 10 12:11:53 MDT 2016


Maybe ?

http://www.ncl.ucar.edu/Applications/mask.shtml
Example 5

NCL is distributed with a 5-category 1x1 l(land/sea/lake/island/..) mask
file. See:

   http://www.ncl.ucar.edu/Document/Functions/Shea_util/landsea_mask.shtml

    f        = addfile(....)
    var    = f->FOO
                               ; if rectilinear
    LAT   = f->lat      ; or,  var&lat
    LON  = f->lon     ;       var&lon

                              ; if curvilinear
     LAT  = f->lat2d
     LON = f->lon2d
                             ; open 1x1 land sea mask file
     b = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/landsea.nc","r")

  lsm = landsea_mask(b->LSMASK, LAT, LON) ; import land sea mask
                                          ; return mask array

  var_land = *mask*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/mask.shtml>(var,lsm.eq.1,False)

  printVarSummary(lar_land)

  copy_VarMeta(var,var_land)

  var_13   = *mask*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/mask.shtml>(var,lsm.eq.1
.or. lsm.eq.3,False)

  copy_VarMeta(var,var_13)

----

If 1x1 is too crude, I have attached a much higher resolution
2-category land/sea mask


netcdf CERES.HiResLandSeaMask {
dimensions:
	lat = 1080 ;
	lon = 2160 ;
variables:
	byte LandSea(lat, lon) ;
		LandSea:info = "Land=1, Sea=0" ;
		LandSea:long_name = "CERES: Land-Sea Mask" ;
		LandSea:units = "" ;
	float lat(lat) ;
		lat:long_name = "latitude" ;
		lat:units = "degrees_north" ;
	float lon(lon) ;
		lon:long_name = "longitude" ;
		lon:units = "degrees_east" ;


I have other land/sea mask files also.

Good luck

On Mon, Oct 10, 2016 at 10:13 AM, Clapp, Corey Elstein <
cclapp at fas.harvard.edu> wrote:

> Hi Rick,
>
>
> Thanks for your response, I hope my question isn't redundant with the
> available documentation. The examples provided that use the built-in map
> database seem to be doing so with map resources and so the masking is only
> occurring with what is drawn on a plot.
>
>
> I was looking to use the built-in map databases to mask a dataset before
> plotting. In other words using a built-in database as the marray for the
> mask function, or using a built-in database as the shapefile in
> shapefile_mask_data function.
>
>
> Thanks,
>
> Corey
> ------------------------------
> *From:* Rick Brownrigg <brownrig at ucar.edu>
> *Sent:* Monday, October 10, 2016 11:46:16 AM
> *To:* Clapp, Corey Elstein
> *Cc:* ncl-talk at ucar.edu
> *Subject:* Re: [ncl-talk] Masking Data with NCL Map Databases
>
> Hi,
>
> There are a number of examples of masking with the built-in map database
> at:
>
> http://ncl.ucar.edu/Applications/mask.shtml
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__ncl.ucar.edu_Applications_mask.shtml&d=CwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=c6V7gIN5OFgXqiVE70-k0s95A9XeCqpkaHUsidujhr8&m=Pshm_NtyJvZSnkbXxEGYKsKCfWczqp7N8Umqr70LaPk&s=1C6yjCHcUe4PRJ9h64Y6oI385xebNOLX1bG3hAmwtUo&e=>
>
> Do you need to do something more specific?
>
> HTH...
> Rick
>
> On Fri, Oct 7, 2016 at 3:33 PM, Clapp, Corey Elstein <
> cclapp at fas.harvard.edu> wrote:
>
>> Hi,
>>
>>
>> I was wondering if it were possible to mask data using the areas of the
>> NCL map databases (Earth 1-4) instead of using a shapefile.
>>
>>
>> Thanks,
>>
>> Corey
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.ucar.edu_mailman_listinfo_ncl-2Dtalk&d=CwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=c6V7gIN5OFgXqiVE70-k0s95A9XeCqpkaHUsidujhr8&m=Pshm_NtyJvZSnkbXxEGYKsKCfWczqp7N8Umqr70LaPk&s=w3Ci8GW2uAFvT46JQfW_cP7L6W-P3-88G9kNwF6oJS4&e=>
>>
>>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161010/29bdb463/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CERES.HiResLandSeaMask.nc.gz
Type: application/x-gzip
Size: 37512 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161010/29bdb463/attachment.gz 


More information about the ncl-talk mailing list