[ncl-talk] plot model variable without knowledge of map projection?

Mary Haley haley at ucar.edu
Tue Aug 12 15:57:55 MDT 2014


If you don't know the map projection, I suggest using the default
cylindrical equidistant projection (also know as a lat/lon projection). You
don't need to set mpProjection for this.

Then, I suggest using the "LatLon" limit mode instead of "Corners" (also
the default, so no need to set mpLimitMode), and then set these four
resources:

res at mpMinLatF      = min(lat2d)
res at mpMaxLatF      = max(lat2d)
res at mpMinLonF      = min(lon2d)
res at mpMaxLonF      = max(lon2d)

--Mary



On Tue, Aug 12, 2014 at 12:23 PM, Erik Noble <erik.u.noble at gmail.com> wrote:

> Dear NCL,
> How can I plot a model variable on a grid without knowing the native
> grid's particular map projection? I would like to see an image similar to
> what "ncview" does when I look at the file (image attached). NCVIEW seems
> to just know what to plot.
> Although I am able to extract the variable, I can't seem to plot it
> correctly at all. How do I show a decent map?
> Thank you,
> - Erik -
>
>
> [image: Inline image 2][image: Inline image 1]
>
>
> 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"
>  ; Get file
> a=addfile("ICE.2012.01-12.f06.nc","r")
> ; Get variable
>  ; and lat-lons (2D)
> s1=a->SHF
> printVarSummary(s1) ; display variable
> lat2d    = a->LAT
> lon2d    = a->LON
> s1 at lat2d=lat2d
> s1 at lon2d=lon2d
> printVarSummary(s1) ; display variable again
>
> ; plot paramaters
> res = True
> wks = gsn_open_wks("x11"  ,"x_static")
> res at pmTickMarkDisplayMode = "Always"         ; turn on lat / lon labeling
> ;************************************************
> ; set map limits
> ;************************************************
> dimll = dimsizes(lat2d)
> nlat  = dimll(0)
> mlon  = dimll(1)
> ; res at mpProjection          = ??? I HAVE NO IDEA???
> res at mpLimitMode           = "Corners"
> res at mpLeftCornerLatF      = lat2d(0,0)
> res at mpLeftCornerLonF      = lon2d(0,0)
> res at mpRightCornerLatF     = lat2d(nlat-1,mlon-1)
> res at mpRightCornerLonF     = lon2d(nlat-1,mlon-1)
> res at tfDoNDCOverlay        = True             ; True only for 'native' grid
> res at gsnAddCyclic          = False  ; data are not cyclic
> ; res at lbLabelAutoStride     = True ; let NCL determine label bar spacing
> plot = gsn_csm_contour_map (wks,s1(0,:,:),res)
>
> ; TERMINAL OUTPUT
>
> erikmbp:MAR_3.2 enoble$ ncl test_plot_080714.ncl
>  Copyright (C) 1995-2014 - All Rights Reserved
>  University Corporation for Atmospheric Research
>  NCAR Command Language Version 6.2.0
>  The use of this software is governed by a License Agreement.
>  See http://www.ncl.ucar.edu/ for more details.
>
> Variable: s1
> Type: float
> Total Size: 9662400 bytes
>             2415600 values
> Number of Dimensions: 3
> Dimensions and sizes: [TIME | 366] x [Y18_127 | 110] x [X10_69 | 60]
> Coordinates:
>             TIME: [972672.0625..981432]
>             Y18_127: [-1200.000091097248..1525.000107494753]
>             X10_69: [-775.0000471284118..700.0000440380242]
> Number Of Attributes: 3
>   units : W/m2
>   long_name : Sensible Heat Flux
>   history : From ICE.j06.2012.01.01-15
>
> Variable: s1
> Type: float
> Total Size: 9662400 bytes
>             2415600 values
> Number of Dimensions: 3
> Dimensions and sizes: [TIME | 366] x [Y18_127 | 110] x [X10_69 | 60]
> Coordinates:
>             TIME: [972672.0625..981432]
>             Y18_127: [-1200.000091097248..1525.000107494753]
>             X10_69: [-775.0000471284118..700.0000440380242]
> Number Of Attributes: 5
>   lon2d : <ARRAY of 6600 elements>
>   lat2d : <ARRAY of 6600 elements>
>   units : W/m2
>   long_name : Sensible Heat Flux
>   history : From ICE.j06.2012.01.01-15
>
> _______________________________________________
> ncl-talk mailing list
> 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/20140812/284b3601/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ncl_plot_SHF.png
Type: image/png
Size: 52962 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140812/284b3601/attachment-0002.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ncview_plot_SHF.png
Type: image/png
Size: 108680 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140812/284b3601/attachment-0003.png 


More information about the ncl-talk mailing list