>
> Hello
>
> I've been one of those loking forward to the feature of plotting
> curvi-linear grids being implemented in ncl. So when I realised it was
> in 4.2.0.a026 I downloaded and installed and tried to plot the
> bathymetry of the North Sea (the curvi-linear grid was generated using
> the seagrid program).
>
> I could not make it work....
>
> Here is the output of running the attached script on the data file also
> provided:
>
> orca% ncl < topo.ncl
> .
> .
> .
> fatal:Attributes only have one dimension, 2 subscripts used
> fatal:Execute: Error occurred at or near line 2752 in file
> $NCARG_ROOT/lib/ncarg
> /nclscripts/csm/gsn_csm.ncl
Dear Karsten,
This error message looks like an old bug that we already
fixed. However, you appear to be running the latest version of NCL, so
you should have the bug fix that goes with this version. You can look
at the second line of the gsn_code.ncl and gsn_csm.ncl scripts and see
their version numbers. They should be 1.93 and 1.105 respectively.
If you don't seem to have the latest versions, you can download them
from:
http://ngwww.ucar.edu/ngdoc/ng/ug/ncl/gsun/scripts/gsn_csm.ncl
http://ngwww.ucar.edu/ngdoc/ng/ug/ncl/gsun/scripts/gsn_code.ncl
Here are some things I changed in your script to make it run properly,
and to have the plot look a little cleaner:
1) Your data seems to contain missing values, but no _FillValue
attribute was set. I looked at your netCDF file, and saw that
a *global* _FillValue attribute had been set, so I did the
following:
t@_FillValue = f@_FillValue
2) Since your data is not global, you don't want "gsnAddCyclic" to
be on, so I set this to False.
3) I zoomed in on the part of the map that contains the data, because
otherwise it's too hard to see the plot.
4) I set "gsnMaximize" to True so that the plot is maximized in the
window.
5) I set "lbLabelStride" to 2 so that the labelbar labels don't run
into each other.
6) I set "mpFillDrawOrder" to "PostDraw" so that you get the land
filled (in a light gray). Since "LightGray" is not part of the
"gui_default" colormap, I added it by using the
"gsn_merge_colormaps" procedure.
If you do not desire filled land, then remove the setting of
"mpFillDrawOrder", and also set "mpFillOn" to False.
There's one thing I don't like about the new script, however, and that
is that it takes a long time to run. I think it's a problem at our
end, so I'm going to pass it on to our developers.
Below is your script with all the modifications I made. If you have
any questions, feel free to email me directly.
Cheers,
--Mary Haley
haley@ucar.edu
;************************************************
; commonly loaded
;************************************************
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
;************************************************
; open netCDF file: read in selected variables
;************************************************
diri = "./"
fili = "topo.nc"
f = addfile(diri+fili,"r")
lat2d = f->latc
lon2d = f->lonc
printVarSummary(lat2d)
printVarSummary(lon2d)
t = f->h
t@_FillValue = f@_FillValue ; Set t's _FillValue to global _FillValue
t@lon2d = lon2d
t@lat2d = lat2d
;************************************************
; open graphic wkstation
;************************************************
wks = gsn_open_wks("x11","topo")
; wks = gsn_open_wks("ps","topo")
gsn_merge_colormaps (wks, "gui_default","LightGray")
;************************************************
; plot options (NCL refers to these as resources)
;************************************************
res = True ; options desired
res@gsnAddCyclic = False
res@gsnMaximize = True ; maximize size of plot
res@tiMainString = "North Sea Bathymetry (curvi)"
res@mpFillDrawOrder = "PostDraw"
res@mpMinLatF = min(lat2d) ; zoom in on map
res@mpMaxLatF = max(lat2d)
res@mpMinLonF = min(lon2d)
res@mpMaxLonF = max(lon2d)
res@cnFillOn = True
res@cnRasterModeOn = True
res@cnLinesOn = False
res@cnLineLabelsOn = False
res@cnLevelSelectionMode = "ManualLevels"
res@cnMinLevelValF = 0.
res@cnMaxLevelValF = 400.
res@cnLevelSpacingF = 25.
res@lbLabelStride = 2 ; Only label every other label box.
plot = gsn_csm_contour_map_ce(wks,t,res) ; Draw a contour plot.
end
_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Fri Oct 11 2002 - 10:54:06 MDT