[ncl-talk] Problem with lat/lon units
Dennis Shea
shea at ucar.edu
Fri Dec 16 12:03:02 MST 2016
The grids are curvilinear ... not rectilinear. This necessitates using the
reserved 'lat2d/lon2d' attributes
qv = a->DPT_P0_L103_GLC0 ; (:,:)
tk = a->TMP_P0_L103_GLC0 ;(:,:)
lat = a->gridlat_0 ; (:,:)
lon = a->gridlon_0 ; (:,:)
tk at lat2d = lat
tk at lon2d = lon
same for 'qv'
Good luck
On Fri, Dec 16, 2016 at 11:55 AM, Michael Buban - NOAA Affiliate <
michael.buban at noaa.gov> wrote:
> Hello,
>
> I'm trying to plot up HRRR data and am getting the following error about
> the lat/lon units. Here is the code I'm trying to execute and the
> following output.
>
> ___________________________________
>
> SCRIPT:
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> begin
>
>
> a = addfile("hrrr.t12z.wrfsfcf01.grib2","r")
>
>
> qv = a->DPT_P0_L103_GLC0(:,:) ;
>
> tk = a->TMP_P0_L103_GLC0(:,:) ;
>
>
> lat = a->gridlat_0(:,:)
>
> lon = a->gridlon_0(:,:)
>
>
> printVarSummary(lat)
>
> printVarSummary(lon)
>
>
> nx = 71
>
> ny = 82
>
>
> ; print(tk)
>
>
> wks = gsn_open_wks("X11","gsn_contour") ; open a ps file
>
>
>
> ;*****************************
>
> ; create first plot
>
> ;*****************************
>
> resn = True ; create vector resource array
>
> resn at cnFillOn = True ; color fill
>
> resn at cnLinesOn = False ; no contour lines
>
>
> resn at gsnLeftString = "" ; no titles
>
> resn at gsnRightString = ""
>
> resn at tiXAxisString = ""
>
> resn at tiYAxisString = ""
>
>
> resn at gsnDraw = False ; don't draw
>
> resn at gsnFrame = False ; don't advance frame
>
>
> resn at vpWidthF = 0.8 ; change the aspect ratio
>
> resn at vpHeightF = 0.6
>
>
>
> resn at gsnAddCyclic = False ; regional data
>
>
> resn at mpProjection = "LambertConformal"
>
>
> resn at mpLimitMode = "Corners" ; choose region of map
>
> resn at mpLeftCornerLatF = lat(0,0)
>
> resn at mpLeftCornerLonF = lon(0,0)
>
> resn at mpRightCornerLatF = lat(ny-1,nx-1)
>
> resn at mpRightCornerLonF = lon(ny-1,nx-1)
>
>
>
>
> resn at cnLevelSelectionMode = "ManualLevels" ; manually set the
> contour levels
>
> resn at cnMinLevelValF = 260.0
>
> resn at cnMaxLevelValF = 288.0
>
> resn at cnLevelSpacingF = 1.0
>
>
>
> resn at pmLegendDisplayMode = "Never"
>
> resn at tiMainOn = False
>
>
> plot1 = gsn_csm_contour_map(wks,tk,resn)
>
>
> draw(plot1)
>
> frame(wks)
>
>
> end
>
> ------------------------------------------------------------
> OUTPUT:
>
> Copyright (C) 1995-2015 - All Rights Reserved
>
> University Corporation for Atmospheric Research
>
> NCAR Command Language Version 6.3.0
>
> The use of this software is governed by a License Agreement.
>
> See http://www.ncl.ucar.edu/ for more details.
>
>
> Variable: lat
>
> Type: float
>
> Total Size: 23288 bytes
>
> 5822 values
>
> Number of Dimensions: 2
>
> Dimensions and sizes: [ygrid_0 | 82] x [xgrid_0 | 71]
>
> Coordinates:
>
> Number Of Attributes: 11
>
> corners : ( 34.05317, 33.7815, 35.9347, 36.21489 )
>
> long_name : latitude
>
> grid_type : Lambert Conformal (secant, tangent, conical or bipolar)
>
> units : degrees_north
>
> Latin2 : 38.5
>
> Latin1 : 38.5
>
> Dy : 3
>
> Dx : 3
>
> Lov : 262.5
>
> Lo1 : 274.705
>
> La1 : 34.05317
>
>
> Variable: lon
>
> Type: float
>
> Total Size: 23288 bytes
>
> 5822 values
>
> Number of Dimensions: 2
>
> Dimensions and sizes: [ygrid_0 | 82] x [xgrid_0 | 71]
>
> Coordinates:
>
> Number Of Attributes: 11
>
> corners : ( -85.29497, -83.05004, -82.62847, -84.93713 )
>
> long_name : longitude
>
> grid_type : Lambert Conformal (secant, tangent, conical or bipolar)
>
> units : degrees_east
>
> Latin2 : 38.5
>
> Latin1 : 38.5
>
> Dy : 3
>
> Dx : 3
>
> Lov : 262.5
>
> Lo1 : 274.705
>
> La1 : 34.05317
>
> (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'
>
> warning:MapSetTrans: map limits invalid - using maximal area
>
> XIO: fatal IO error 35 (Resource temporarily unavailable) on X server
> "/private/tmp/com.apple.launchd.3vDJHBflwq/org.macosforge.xquartz:0"
>
> after 1087 requests (1084 known processed) with 0 events remaining.
> ____________________________________
>
> It seems like the units have valid arrays. Any help would be appreciated!
>
> Thanks,
>
> Mike
>
>
> --
> Michael S. Buban, Ph.D.
> Research Associate
> NOAA/ARL Atmospheric Turbulence and Diffusion Division
> and Oak Ridge Associated Universities
> 456 South Illinois Avenue
> Oak Ridge, TN 37830
>
> _______________________________________________
> 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/20161216/ad2bff29/attachment.html
More information about the ncl-talk
mailing list