Re: lambert-conformal map

From: Dennis Shea (shea AT cgd.ucar.edu)
Date: Mon Jul 25 2005 - 09:34:34 MDT


>
>Trouble with lambert-conformal data file:
>
>I have a lambert conformal grb file from the eta atmospheric model. I'd
>like to make a vector wind graph, but I'm having trouble assigning the
>coordinate variables to my U and V variables. The grb file has dimension
>vars gridx_245 and gridy_245 and has 2d lat/lon vars gridlat_245 and
>gridlon_245.
>
>I am assigning my coordinate vars like so:
>
>u!0 = "lat"
>u!1 = "lon"
>u&lat = f&gridx_245
>u&lon = f&gridy_245
>
>This gives me an error that no coordinate variable exists for dimension
>gridx_245. If anyone has any suggestions or would like to take a look,
>the ncl file (east_eta_wind.ncl) and grb file (eastnmm.t18.grb)
>can be downloaded from:
>
>http://copland.udel.edu/~micahs
>

---
I saw that Adam's response but I had already drafted a response.
---
By netCDF definition, a coordinate varaiable is a one
dimensional, montonically [in/de]creasing array.
NCL "understands" true netCDF coordinate variables and
can retrieve/assign them via NCL's "&" syntax. 

As you note, the lat/lon arrays on the GRIB file are 2d. Hence, it is illegal to use the & syntax. That is why you are getting the error "no coordinate variable exists".

NCL does allow the user to 'associate' 2D coordinate arrays with a variable via the reserved attributes "lat2d" and "lon2d".

NCL associates "value added" information with the 2d lat/lon variables including the two standard parallels [Latin1 and Latin2] and the central meridion [Lov].

Try the following: ++++++++++++++++++++++++++++++++++

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" begin f = addfile("../data/eastnmm.t18.grb","r") u = f->U_GRD_245_HTGL v = f->V_GRD_245_HTGL lt = f->gridlat_245 ; [gridx_245 | 372] x [gridy_245 | 336] ln = f->gridlon_245 ; ^ [lon] ^ [lat] dimll = dimsizes(lt) nlon = dimll(0) ; 372 here nlat = dimll(1) ; 336 u@lat2d = lt ; assign to reserved attributes [lat2d and lon2d] u@lon2d = ln ; these reserved attributes will be used for v@lat2d = lt ; plotting the data. v@lon2d = ln

wks = gsn_open_wks("ps","../graphs/east_21") gsn_define_colormap(wks,"BlAqGrYeOrRevi200") ; choose colormap res = True ; plot mods desired res@gsnAddCyclic = False ; not a global grid ;res@mpLandFillColor = "gray" ; set land to be gray res@mpFillOn = False res@mpDataBaseVersion = "Ncarg4_1" ; default is "Ncarg4_0" res@mpProjection = "LambertConformal" res@mpOutlineOn = True res@mpLimitMode = "Corners" ; choose range of map res@mpLeftCornerLatF = lt(0,0) res@mpLeftCornerLonF = ln(0,0) res@mpRightCornerLatF = lt(nlon-1,nlat-1) res@mpRightCornerLonF = ln(nlon-1,nlat-1) print("mpLeftCornerLatF ="+res@mpLeftCornerLatF); FYI: print corner info print("mpLeftCornerLonF ="+res@mpLeftCornerLonF) print("mpRightCornerLatF="+res@mpRightCornerLatF) print("mpRightCornerLonF="+res@mpRightCornerLonF) res@mpLambertParallel1F = lt@Latin1 ; extract from GRIB file res@mpLambertParallel2F = lt@Latin2 ; res@mpLambertMeridianF = lt@Lov res@vcRefMagnitudeF = 2.0 ; define vector ref mag res@vcRefLengthF = 0.03 ; define length of vec ref res@vcGlyphStyle = "WindBarb" ; turn on curley vectors res@vcMinDistanceF = 0.017 ; thin out vectors plot = gsn_csm_vector_map(wks,u,v,res) end

_______________________________________________ ncl-talk mailing list ncl-talk@ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talk



This archive was generated by hypermail 2b29 : Wed Jul 27 2005 - 07:54:59 MDT