Re: help: plot a variable from binary file

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon Jan 30 2012 - 12:48:27 MST

lonGlobeFo and latGlobeFo return **global** grids.
Please read the documentation.
http://www.ncl.ucar.edu/Document/Functions/Contributed/lonGlobeFo.shtml
http://www.ncl.ucar.edu/Document/Functions/Contributed/latGlobeFo.shtml

So

       tp&lon = lonGlobeFo(nlon,"lon","longitude","degrees_east")
       printVarSummary(tp&lon)

is ok because your longitude grid nominally spans 360 degerees.
This spans 0.5 to 359.5

If you want -179.5 to 179.5, then
       lon = (/ lon - 180. /) ; subtract 180 from all values
       lon&lon = lon ; update coordinates
       printVarSummary(lon)

But

       tp&lat = latGlobeFo(nlat,"lat","latitude","degrees_north")

is not correct. It spans -89.5 to 89.5. Your data spans -40 to 40.

lat = fspan(-40,40,nlat)
lat!0 = "lat"
lat@units = "degrees_north"
lat&lat = lat

printVarSummary(lat)

Then

tp&lat = lat

On 1/30/12 10:10 AM, Sha Feng wrote:
> Hi ncl-talkers,
>
> I tried to plot a binary variable using NCL. The ctl file from it is:
>
> xdef 720 linear 0.25 0.5
> ydef 161 linear -40. 0.5
>
> so I use:
>
> lat = fspan(-40,40,nlat)
> lon = fspan(0.25,359.75,nlon)
>
> tp = fbindirread(dir+fn, 0, (/nlat, nlon/), "float")
> tp@_FillValue = -9999.
> tp!0 = "lat"
> tp&lat = latGlobeFo(nlat,"lat","latitude","degrees_north")
> tp!1 = "lon"
> tp&lon = lonGlobeFo(nlon,"lon","longitude","degrees_east")
>
> to designate the attributes for it.
>
> However, the plot was just mismatched the map (dislocation) with 180 degrees in longitude.
>
> Any suggestion is appreciated.
>
> Thanks,
> Sha
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jan 31 00:48:39 2012

This archive was generated by hypermail 2.1.8 : Thu Feb 02 2012 - 03:10:31 MST