[ncl-talk] (no subject)
Rick Brownrigg
brownrig at ucar.edu
Wed Sep 14 05:54:36 MDT 2016
Hi,
I think you are close. By convention and definition, a coordinate variable
is a 1D array with its dimension named the same as its variable. So when
you set up the variable "u", it should look something like:
lat := b->Latitude ; set up coordinate variables....
lat!0 = "lat"
lon := b->Longitude
lon!0 = "lon"
u!0 = "lat" ; assign coordinates to data variable...
u!1 = "lon"
u&lat = lat
u&lon = lon
u&lon at units = "degrees_east"
u&lat at units = "degrees_north"
The same applies to your variable "s" earlier in the script. I'm a bit
confused by the mixed case lat/LAT and lon/LON -- you want to make sure
everything is consistent.
Hope that helps...
Rick
On Tue, Sep 13, 2016 at 11:55 PM, Sunil Oulkar <sunil.oulkar16 at gmail.com>
wrote:
> *Hello, *
> *I have some problem when defining coordinate variables, the error message
> is: *
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *fatal:No coordinate variable exists for dimension (lat) in variable
> (s)fatal:["Execute.c":8567]:Execute: Error occurred at or near line 51 in
> file contour_slope.nclMy code is: load
> "/usr/local/ncl/lib/ncarg/nclscripts/csm/gsn_code.ncl" load
> "/usr/local/ncl/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load
> "/usr/local/ncl/lib/ncarg/nclscripts/csm/contributed.ncl"load
> "/usr/local/ncl/lib/ncarg/nclscripts/csm/shea_util.ncl"begin a =
> addfile("elevation_0.5.nc <http://elevation_0.5.nc/>","r")
> TOPO = a->E({28:36},{70:78}) LON = a->LONGITUDE({70:78}) LAT
> = a->LATITUDE({28:36}) lats = LAT({28.2:35.9}) lons =
> LON({70.2:77.9}) nLAT = dimsizes(LAT)-2 nLON =
> dimsizes(LON)-2 sres = 50000 ;5600 s =
> new((/nLAT+1,nLON+1/),double) do i = 1,nLAT,1
> do j = 1,nLON,1 TOPOto = TOPO(i+1,j)
> TOPObo = TOPO(i-1,j) TOPOri = TOPO(i,j+1)
> TOPOle = TOPO(i,j-1) s(i,j) =
> sqrt((((TOPOri-TOPOle)/(2*sres))^2)+((TOPOto-TOPObo)/(2*sres))^2)
> end do end do s =
> tan(s)*100 s!0 = "LAT" s!1 = "LON" s&lat = lats s&lon =
> lons s&lon at units = "degrees_east" s&lat at units = "degrees_north"
> b = addfile("LISOTD_HRFC_V2.3.2014.nc
> <http://lisotd_hrfc_v2.3.2014.nc/>","r") u = b->HRFC_COM_FR lat :=
> b->Latitude lon := b->Longitude u!0 = "lat" u!1 = "lon" u&lat = lat u&lon =
> lon u&lon at units = "degrees_east" u&lat at units = "degrees_north" wks =
> gsn_open_wks("x11","contour_slope_NE") ;---Set resources res =
> True res at gsnDraw = False res at gsnFrame = False res at gsnMaximize =
> True res at gsnAddCyclic = False res at tiYAxisString = ""
> ;"Longitude" res at gsnLeftString = "" res at gsnRightString =
> "" res at cnLevelSelectionMode = "ExplicitLevels" ; set explicit contour
> levels res at cnLevels = ((/ 0.4, 0.8, 1, 2, 4, 6, 8, 10, 12, 14, 16, 18,
> 20, 22, 24, 26, 28, 30/)) ; set levels res at cnFillOn =
> True res at cnFillPalette = "precip3_16lev" res at cnLinesOn =
> False res at mpMinLatF = 28 ; Zoom in on map. res at mpMaxLatF =
> 36 res at mpMinLonF = 70 res at mpMaxLonF = 78 res at mpDataBaseVersion =
> "MediumRes" res at mpFillOn = False res at pmTickMarkDisplayMode =
> "Always" res at mpFillDrawOrder ="PreDraw" res at lbOrientation =
> "vertical" res at amJust =
> "TopRight" res at pmLabelBarOrthogonalPosF = 0.02 res at lbLabelFontHeightF =
> 0.02 res at lbLabelAutoStride = True res at pmLabelBarWidthF =
> 0.1 res at tiXAxisFontHeightF = 0.025 res at tiYAxisFontHeightF = 0.025 res2
> = True res2 at cnLineLabelsOn =
> True res2 at gsnAddCyclic = False res2 at cnLineThicknessF = 2
> ; line thickness res2 at cnLevelSelectionMode =
> "ExplicitLevels" res2 at cnLevels = (/0,10,20/)
> ;NE res2 at cnLabelMasking = True res2 at cnInfoLabelOn =
> False ; turn off contour
> label res2 at cnLineLabelInterval = 1 ; default =
> 2 res2 at cnLineLabelFontHeightF = 0.015 plot =
> gsn_csm_contour_map_overlay(wks,u,s,res,res2) draw(plot) frame(wks) end*
>
> _______________________________________________
> 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/20160914/58c6452a/attachment.html
More information about the ncl-talk
mailing list