[ncl-talk] Problem in masking out the ocean
Dennis Shea
shea at ucar.edu
Fri Apr 7 07:52:25 MDT 2017
Change
precip1 = mask(precip,lsm.eq.0,False)
printVarSummary(precip1) ; <=== no meta data
To
precip = mask(precip,lsm.eq.0,False)
printVarSummary(precip)
or
precip1 = mask(precip,lsm.eq.0,False)
copy_VarMeta(precip, precip1)
printVarSummary(precip1)
=====
On Fri, Apr 7, 2017 at 7:34 AM, Priyanka Silva <
priyankakeraminiya6 at gmail.com> wrote:
> Hi,
>
> I want to plot precipitation over land area. So I tried to create an
> ocean mask for global precipitation but my plot does not show precipitation
> over land areas. When I plot I could see the following warning.
>
>
>
> (0) check_for_y_lat_coord: Warning: Data either does not contain a
> valid latitude coordinate array or doesn't contain one at all.
>
> (0) A valid latitude coordinate array should have a 'units' attribute
> equal to one of the following values:
>
> (0) 'degrees_north' 'degrees-north' 'degree_north' 'degrees
> north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg
> north'
>
> (0) check_for_lon_coord: Warning: Data either does not contain a
> valid longitude coordinate array or doesn't contain one at all.
>
> (0) A valid longitude coordinate array should have a 'units'
> attribute equal to one of the following values:
>
> (0) 'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
> 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
>
>
>
> My script and plot are as follows.
>
> Greatly appreciate your help.
>
> Thank you.
>
>
>
>
>
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/diagnostics_cam.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>
> ;-----------------------------------------------------------
> -----------------
>
> begin
>
> f = addfile("mon.precip.nc","r")
>
> precip = f->precip(0,:,:)
>
>
>
> a = addfile("landsea.nc","r")
>
> lsdata = a->LSMASK
>
> lsm = landsea_mask(lsdata,precip&lat,precip&lon)
>
> precip1 = mask(precip,lsm.eq.0,False)
>
> printVarSummary(precip1)
>
>
>
> wks1 =gsn_open_wks("X11","precip_mod1")
>
> gsn_define_colormap(wks1,"BrownBlue12")
>
>
>
> res1 = True
>
> res1 at cnLinesOn = False
>
> res1 at cnFillOn = True ; turn color on
>
> res1 at gsnSpreadColors = True
>
> res1 at tiMainString = " precipitation"
>
>
>
> plot = gsn_csm_contour_map_ce(wks1,precip1,res1)
>
> end
>
>
>
>
>
> [image: Inline image 1]
>
>
>
> _______________________________________________
> 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/20170407/32e36989/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 47191 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170407/32e36989/attachment.png
More information about the ncl-talk
mailing list