Dear Mary,
I've tried your suggestion, but the data are still overlaid on the map incorrectly.
Here is my code and attached please find the data "crain24h.nc"
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
fi = addfile("./crain24h.nc", "r")
wks = gsn_open_wks("eps", "crain1h")
gsn_define_colormap(wks, "precip")
lat = fi->lat
lon = fi->lon
time = fi->time
ntimes = dimsizes(time) ; number of times in the file
;;;;;;;;;;;;
do it = 0, ntimes-1 ; time loop
crain = fi->crain(it,0,:,:)
crain@_FillValue = -999
crain@lat2d = lat
crain@lon2d = lon
res = True
res@gsnAddCyclic = False
;;;;;;;;;;;;;;set for the map
res@mpDataBaseVersion = "HighRes"
res@mpDataSetName = "Earth..4"
res@mpGridAndLimbOn = False ; Turn off lat/lon lines
res@mpOutlineOn = True ; Turn on map outlines
res@mpGeophysicalLineColor = "Black" ; Change the outline line color
res@mpGeophysicalLineThicknessF= 2. ; double the thickness of geophysical boundaries
res@mpOutlineSpecifiers = (/"China","Taiwan","Disputed area between India and China","India:Arunachal Pradesh"/)
;;;;;;;;;;;;;;;ZOOM
res@mpMinLatF = 27.7
res@mpMaxLatF = 32
res@mpMinLonF = 113
res@mpMaxLonF = 122
res@pmTickMarkDisplayMode = "Always"
res@cnFillOn = True
res@cnLinesOn = False ; Turn off contour lines
res@cnLevelSelectionMode = "ExplicitLevels"
res@cnLevels = (/1, 2, 6, 10, 15, 20, 30, 40, 50, 70, 90, 110, 130, 150, 200/)
res@lbBoxLinesOn = False
plot = gsn_csm_contour_map(wks, crain, res)
;;;;;;;;;;;;;;;;;;;;;
end do
end
-------------------------
ncl_filedump crain24h.nc
Variable: f
Type: file
filename: crain24h
path: crain24h.nc
file global attributes:
CDI : Climate Data Interface version 1.6.2 (http://code.zmaw.de/projects/cdi)
Conventions : CF-1.4
history : Mon Jun 02 15:42:14 2014: cdo -f nc import_binary crain24h.ctl crain24h.nc
CDO : Climate Data Operators version 1.6.2 (http://code.zmaw.de/projects/cdo)
dimensions:
lon = 700
lat = 440
lev = 1
time = 24 // unlimited
variables:
double lon ( lon )
standard_name : longitude
long_name : longitude
units : degrees_east
axis : X
double lat ( lat )
standard_name : latitude
long_name : latitude
units : degrees_north
axis : Y
double lev ( lev )
long_name : generic
units : level
axis : Z
double time ( time )
standard_name : time
units : hours since 2011-06-14 01:00:00
calendar : standard
float crain ( time, lev, lat, lon )
long_name : CH01 combined analysis (mm/Hour)
_FillValue : -999
missing_value : -999
float gsamp ( time, lev, lat, lon )
long_name : CH02 gauge numbers
_FillValue : -999
missing_value : -999
------------------ Original ------------------
From: "Mary Haley";<haley@ucar.edu>;
Date: Tue, Jun 3, 2014 01:30 AM
To: "Li Qi"<liqi123sh@qq.com>;
Cc: "ncl-talk"<ncl-talk@ucar.edu>;
Subject: Re: [ncl-talk] is_valid_latlon2d_attr: Warning:
Li,
This is not quite enough information. Are you getting any other errors?
You might try setting the gsnAddCyclic resource to False:
res@gsnAddCyclic = False
--Mary
On Jun 2, 2014, at 1:39 AM, Li Qi <liqi123sh@qq.com> wrote:
> hello,
>
> I got a warning:
>
> (0) is_valid_latlon2d_attr: Warning: The 'lat2d' attribute must either be the same dimension sizes as the data, or one element larger in both directions. Your data will most likely not be overlaid on the map correctly.
>
> How to solve it?
>
> Thanks in advance for any advice!
>
> Li Qi
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
.
从QQ邮箱发来的超大附件
crain24h.nc (56.4M, 2014年07月03日 10:22 到期)进入下载页面:http://mail.qq.com/cgi-bin/ftnExs_download?t=exs_ftn_download&k=78353664011d40c4a68ed57043630b17095354070005000a15515551034e0d5b08001b5d01055c1501045751505a095d5b5055066568395b4a545f0a5757511656563659&code=856dec98
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jun 2 20:29:21 2014
This archive was generated by hypermail 2.1.8 : Tue Jun 03 2014 - 11:40:09 MDT