On Dec 2, 2012, at 7:23 AM, Ipsita Putatunda wrote:
> Dear NCL users,
> I want to get a regional contour plot [lon 60:100,lat -5:28] of my 2D variable, using binary (direct access) file.
> While running my script am getting error regarding my lat, lon. My script is as follows, and I have already ftp my binary file (2012_RH.dat) to ftp ftp.cgd.ucar.edu.I also want to put the red shades only in my color scheme.
Ipsita,
You created lat/lon variables, but you never associated them with your "rh" variable. You are therefore trying to plot "rh" over a map, with no lat/lon information.
Since lat_g and lon_g are 1D arrays that are the same length as the dimensions of "rh", this means you can treat them as "coordinate arrays" and hence attach them to "rh" as follows:
rh!0 = "lat" ; name the dimensions of rh
rh!1 = "lon"
rh&lat = lat_g ; attach the coordinate arrays
rh&lon = lon_g
You will now get no errors, and a plot, but I don't know if the plot is correct.
You can now subscript "rh" using coordinate values, and you don't need rlat and rlon:
res@gsnAddCyclic = False
res@mpMinLatF = minlat
res@mpMaxLatF = maxlat
res@mpMinLonF = minlon
res@mpMaxLonF = maxlon
res@mpCenterLonF = (maxlon+minlon)/2.
plot= gsn_csm_contour_map(wks,rh({minlat:maxlat},{minlon:maxlon}),res)
--Mary
> **************************************************
> ;Plot relative humidity
> ; drawing a color filled contours using color map
>
> ;******************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> ;******************************************************
>
>
> nrec=0
> dims=(/561,3601/)
> rh=fbindirread("H:/2012_RH.dat",0,dims,"float")
> lat_g = latGlobeF(561, "lat", "latitude", "degrees_north")
> lon_g=lonGlobeF(3601, "lon","longitude","degrees_east")
> lon_g=(/lon_g-180. /)
> lon_g&lon=lon_g
> rlon=lon_g({60.1:100})
> rlat=lat_g({-5.1:28})
> ;******************************************
> wks=gsn_open_wks("pdf","color")
>
> res =True
> res@tiMainString = "RH: 2012"
> res@cnFillOn= True
> plot= gsn_csm_contour_map(wks,rh,res)
>
> Thanks,
> Ipsita
>
> _______________________________________________
> 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 Mon Dec 3 09:21:24 2012
This archive was generated by hypermail 2.1.8 : Fri Dec 07 2012 - 13:30:06 MST