Yi,
In order to plot random data, you must provide X, Y, Z 1D data arrays that are all the same length.
Please see this page for examples on contouring 1D data:
http://www.ncl.ucar.edu/Applications/contour1d.shtml
I see that you attempted to do this (I think) with the following code:
data@lat=nlat ; lat is reserved name
data@lon=mlon ; lon is reserved name
Setting "lat" and "lon" attributes has no meaning for the gsn_csm_xxx scripts. You may be thinking of "lat2d" and "lon2d", which do have
some meaning, but these are for if you have 2D lat/lon coordinate arrays.
With 1D data, you need to set the resources sfXArray and sfYArray to the corresponding 1D arrays for X and Y.
I tried this with your code:
res@sfXArray = lon
res@sfYArray = colat
but it failed because your "lon" values are all equal to 180.
By the way, you have this code:
nlat=new( (/n/), float )
mlon=new( (/n/), float )
do i = 0, n-1
nlat(i) = 90. - colat(i)
end do
do i = 0, n-1
mlon(i) = lon(i)
if (mlon(i).gt.180)
mlon(i) = mlon(i) - 360.
end if
end do
You don't need to have do loops to accomplish all this. You can simply do this:
nlat = 90. - colat
mlon = where(lon.gt.180,lon-360,lon)
You will still have a problem with "mlon" however, because it is still all equal to the same value. Are you sure that "Longitude__899" has the correct values on the file?
--Mary
On Jun 29, 2010, at 8:52 AM, Yi Wang wrote:
> Hi Friends,
>
> I made some codes (in CER_ES4_Aqua_FM3_Edition1_CV_024032_200908_Net_radiant_flux_2_5_deg_zon.ncl, see attachment) to plot CER_ES4_Aqua-FM3_Edition1-CV_024032.200908.hdf ( ftp://ftp.hdfgroup.uiuc.edu/pub/outgoing/veer/MAP_DATA/files/CERES/CER_ES4_Aqua-FM3_Edition1-CV_024032.200908.hdf ).
>
> But I got the following message:
> Error: scalar_field: If the input data is 1-dimensional, you must set sfXArray and sfYArray to 1-dimensional arrays of the same length. warning:create: Bad HLU id passed to create, ignoring it
>
> What should I do? Thanks a lot.
>
> Best,
> Yi
> <CER_ES4_Aqua_FM3_Edition1_CV_024032_200908_Net_radiant_flux_2_5_deg_zon.ncl>_______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jun 29 10:01:58 2010
This archive was generated by hypermail 2.1.8 : Fri Jul 02 2010 - 07:45:13 MDT