Dear friends,
I met a problem when I used NCL. The warning is "ContourPlotInitialize: 0.0
not currently supported as a missing value; expect inaccurate plot". Is
there any kind friend can help me handle this problem? Thanks a lot. I
attach the codes as below.
Best,
Yi
load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
; This is an example of a 2-D data field.
; It is assumed users know how to obtain information such as _FillValue from
HDFView.
; For information about HDFView, visit
http://www.hdfgroup.org/hdf-java-html/hdfview/.
begin
eos_file=addfile("C1978303124834.L2_MLAC.hdf", "r") ; Read file.
; Since the file is not HDF-EOS2, it is not necessary to append .he2
data=eos_file->nLw_443 ; read data field
; Here, because the file is not HDF-EOS2, it is not necessary to append the
group name
data@_FillValue=0b
lat=eos_file->latitude
lon=eos_file->longitude
dimsize = dimsizes(data)
numlat = dimsize(0)
numlon = dimsize(1)
; define new latitude
nlat=new( (/numlat,numlon/), float)
mlon=new( (/numlat,numlon/), float)
do i = 0, numlat-1
do j =0, 246
;when j = 0
if(j.eq.0)
nlat(i,j) = lat(i,j)
mlon(i,j) = lon(i,j)
continue
end if
;when j = 1, ..., 245
if((j.ge.1).and.(j.le.245))
count=8*(j-1)+1
arr_fill=fspan(lat(i,(j-1)), lat(i, j), 9)
nlat(i, count:count+7) = (/ arr_fill(1:8) /)
arr_fill=fspan(lon(i,(j-1)), lon(i, j), 9)
mlon(i, count:count+7) = (/ arr_fill(1:8) /)
continue
end if
;when j = 246
if(j.eq.246)
count=8*(j-1)+1
array_fill=fspan(lat(i,(j-1)), lat(i, j), 8)
nlat(i, count:count+6) = (/ array_fill(1:7) /)
array_fill=fspan(lon(i,(j-1)), lon(i, j), 8)
mlon(i, count:count+6) = (/ array_fill(1:7) /)
continue
end if
end do
end do
data@lat2d=nlat
data@lon2d=mlon
xwks=gsn_open_wks("pdf","C1978303124834.L2_MLAC_nLw_443") ; open workstation
res=True ; plot mods desired
res@cnFillOn=True ; enable contour fill
res@gsnMaximize=True; make plot large
res@gsnPaperOrientation = "portrait" ; force portrait orientation
res@cnLinesOn=False ; turn off contour lines
res@cnLineLabelsOn = False; turn off contour line labels
res@gsnSpreadColors=True ; use the entire color spectrum
res@cnFillMode="RasterFill <res@cnFillMode=%22RasterFill>" ; faster
res@lbOrientation="vertical <res@lbOrientation=%22vertical>" ; vertical
labels
res@cnMissingValFillPattern = 0 ; missing value pattern is set to
"SolidFill"
res@cnMissingValFillColor=0; white color for missing values
res@lbLabelAutoStride = True ; ensure no label overlap
gsn_define_colormap(xwks,"BlAqGrYeOrReVi200") ; define colormap
res@tiMainString="C1978303124834.L2_MLAC.hdf<res@tiMainString=%22C1978303124834.L2_MLAC.hdf>"
; create title
res@gsnCenterString="nLw_443 <res@gsnCenterString=%22nLw_443>" ; create
center text
plot=gsn_csm_contour_map_ce(xwks,data,res) ; plot on world map first
delete(plot) ; cleaning up resources used
delete(nlat)
delete(mlon)
delete(xwks)
delete(data)
delete(res)
delete(eos_file)
end
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jun 1 16:43:18 2010
This archive was generated by hypermail 2.1.8 : Mon Jun 07 2010 - 16:48:44 MDT