[ncl-talk] Displaying Lat in NARR Pres Hgt plot

Mary Haley haley at ucar.edu
Fri Aug 29 15:48:02 MDT 2014


It looks like you have a "curvilinear" lat/lon grid and not a "rectilinear"
one. This means that you have 2D lat/lon arrays, instead of 1D lat/lon
arrays that are attached to your data as coordinate arrays.

Whenever you have 2D coordinate locations and you create a regular contour
plot that's not over a map, your X (or Y) axis can't be labeled with a
single line of labels, because whatever labels may represent one row of
your data is not going to represent the second, third, or later rows of
your data.

If you really need to see latitude values on the X axis, you will need to
regrid your data to a rectilinear grid first.

Also, you are subscripting the array with the value "100". Note that this
is going to be an index value, and not "longitude=100", because again, you
have 2D lat/lon values, so you can't guarantee that this slice represents
the same longitude value across all latitudes.

--Mary



On Thu, Aug 28, 2014 at 4:55 PM, <cfdierking at alaska.edu> wrote:

> Below is a simple script for plotting a cross-section from a NARR grib
> file.
> It runs fine, but the result always plots the index number of the grid on
> the
> X-scale. What would I need to do to plot latitude on the X-scale?
>
> ;***********************
> 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"
> ;===========================
> begin
> fnm  = "merged_AWIP32.2013082200.3D.grb"            ; filename
>
>  f     = addfile (fnm , "r")                     ; add file
>  u     = f->U_GRD_221_ISBL               ; get u for January
>  lat2d   = f->gridlat_221
>  u at lat2d = lat2d
>
>  wks   = gsn_open_wks ("ps", "h_lat" )     ; open workstation
> ; ===========================
> ; Create a default plot
> ; ===========================
>  printVarSummary(u)
>  plot  = gsn_csm_pres_hgt(wks, u(:,100,:), False )
>
> end
> ;*****************************
> ;*****************************
>
> Here is the output of the "printVarSummary" for the variable "u"...
>
> Variable: u
> Type: float
> Total Size: 11214068 bytes
>             2803517 values
> Number of Dimensions: 3
> Dimensions and sizes:   [lv_ISBL0 | 29] x [gridx_221 | 277] x [gridy_221 |
> 349]
> Coordinates:
>             lv_ISBL0: [100..1000]
> Number Of Attributes: 15
>   lat2d :       <ARRAY of 96673 elements>
>   sub_center :  The North American Regional Reanalysis (NARR) Project
>   center :      US National Weather Service - NCEP (WMC)
>   long_name :   u-component of wind
>   units :       m/s
>   _FillValue :  1e+20
>   coordinates : gridlat_221 gridlon_221
>   level_indicator :     100
>   grid_number : 221
>   parameter_table_version :     131
>   parameter_number :    33
>   model :       North American Regional Reanalysis (NARR)
>   forecast_time :       0
>   forecast_time_units : hours
>   initial_time :        08/22/2013 (00:00)
> _______________________________________________
> 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/20140829/94cd752f/attachment.html 


More information about the ncl-talk mailing list