Feng is correct.
The variable being input to the graphics plotting function
--- Variable: c1 Dimensions and sizes: [lon | 7178] x [lat | 201] Coordinates: lon: [ 0..359.95] lat: [-65..-75] --- is ordered (lon,lat). The graphical functions that plot over maps (eg: gsn_csm_contour_map_ce) require (lat,lon) order for two-dimensional arrays. To reorder dimensions, use NCL's dimension reordering syntax: http://www.ncl.ucar.edu/Document/Language/reorder.shtml In your case: plot = gsn_csm_contour_map_ce(wks,c1(lat|:,lon|:),False) -- See: http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_csm_contour_map_ce.shtml Specifically, see the Description section. On 12/25/12 7:02 PM, ChenFeng wrote: > did you change the last command? > plot = gsn_csm_contour_map_ce(wks,c1(lat|:,lon|:),False) ;modified by feng > > you can check you code in 3 steps: > 1. you can see the function description in http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_csm_contour_map_ce.shtml . > If data is two-dimensional, then the leftmost dimension is represented on the Y (latitude) axis, and the rightmost dimension on the X (longitude) axis. > 2. make sure the data(here is c1) must have two dimension --lon/lat. > 3. assign coordinate. Coordinate variables are single-dimension arrays that have the same name and size as the dimension they are assigned to. > (you can see the description in http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml#Coordinates ) > > good luck! > > > > > Feng > > > From: Wenshan Wang > Date: 2012-12-26 09:32 > To: ChenFeng > Subject: Re: Re: [ncl-talk] 'units' attribute of coordinate array > Dear Feng, > > Thank you very much for the instant reply! > > It's getting weirder, since I do have the coordinate information in c1. You can find it in the output information I posted in the above thread. > > Your script works fine without any warning. However even if I added these two lines into my scripts, there is still the warning: > > c1!0="lat" ;added by feng > c1!1="lon" ;added by feng > > Might be something wrong with my data? > But the printVarSummary doesn't show anything unusual. > So may I ask for your suggestion about where to begin to check the dataset? > > Thank you very much! > > best, > Wenshan > > > > > > > On Tue, Dec 25, 2012 at 5:15 PM, ChenFeng <fengfengabc003@163.com> wrote: > > Hi, Wang, > > when you use the coordinate information of a data, the data must have it. > you can try the script below. Since I don't have your data "c1", so I create it myself. > > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" > begin > lat1 = fspan(-65,-75,201) > lat1@units = "degrees_north" > lat1!0 = "lat" > lat1@long_name = "latitude" > lat1@standard_name = "latitude" > lat1@axis = "Y" > print(lat1) > lon1 = fspan(0,359.95,7178) > lon1@units = "degrees_east" > lon1!0 = "lon" > lon1@long_name = "longitude" > lon1@standard_name = "longitude" > lon1@axis = "X" > c1=random_normal(10.,3.,(/201,7178/)) ;added by feng > c1!0="lat" ;added by feng > c1!1="lon" ;added by feng > c1&lat = lat1 > c1&lon = lon1 > printVarSummary(c1) > printVarSummary(c1&lat) > printVarSummary(c1&lon) > ; plot > wks = gsn_open_wks("x11","plot_grid-reg.ncl_bsa_AA") > plot = gsn_csm_contour_map_ce(wks,c1(lat|:,lon|:),False) ;modified by feng > end > > > > > > Feng > From: Wenshan Wang > Date: 2012-12-26 07:06 > To: ChenFeng > CC: ncl-talk > Subject: Re: Re: [ncl-talk] 'units' attribute of coordinate array > Tried but the same error message. > > Thank you anyway! > > Best, > Wenshan > > > > > On Mon, Dec 24, 2012 at 5:45 PM, ChenFeng <fengfengabc003@163.com> wrote: > > Try to use this command to draw the map. > > plot = gsn_csm_contour_map_ce(wks,c1(lat|:,lon|:),False) > > good luck > > > > Feng > From: Wenshan Wang > Date: 2012-12-25 08:30 > To: Adam Phillips > CC: ncl-talk > Subject: Re: 'units' attribute of coordinate array > Dear Adam, > > Thank you very much for the reply! > > Here is the output of these three printVarSummary: > Variable: c1 > Type: float > Total Size: 5771112 bytes > 1442778 values > Number of Dimensions: 2 > Dimensions and sizes: [lon | 7178] x [lat | 201] > Coordinates: > lon: [ 0..359.95] > lat: [-65..-75] > Number Of Attributes: 2 > long_name : regression coefficient (slope) > _FillValue : 9.96921e+36 > > Variable: lat (coordinate) > Type: float > Total Size: 804 bytes > 201 values > Number of Dimensions: 1 > Dimensions and sizes: [lat | 201] > Coordinates: > Number Of Attributes: 4 > units : degrees_north > long_name : latitude > standard_name : latitude > axis : Y > > Variable: lon (coordinate) > Type: float > Total Size: 28712 bytes > 7178 values > Number of Dimensions: 1 > Dimensions and sizes: [lon | 7178] > Coordinates: > Number Of Attributes: 4 > units : degrees_east > long_name : longitude > standard_name : longitude > axis : X > > ================================================= > I am not in a hurry. Just post it in case I may forget. > Thank you! > > Merry Christmas! > > Best Regards, > Wenshan > > > > > On Mon, Dec 24, 2012 at 3:18 PM, Adam Phillips <asphilli@ucar.edu> wrote: > > Hi Wenshan, > I see you have 3 printVarSummary statements in your code. Please send ncl-talk the output from these statements. At first glance, I do not see anything wrong. As another ncl-talk contributor has posted, as it is Christmas Eve and tomorrow is Christmas, a reply from someone on the list is not likely until the 26th at the earliest. > Thanks, Adam > > > On Dec 23, 2012, at 21:50, Wenshan Wang <wenshanw@uci.edu> wrote: > >> Dear all, >> >> I know it is an old problem but I just couldn't fix it. The error message is: >> check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all. >> (0) A valid latitude coordinate array should have a 'units' attribute equal to one of the following values: >> (0) 'degrees_north' 'degrees-north' 'degree_north' 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north' >> >> My did add this unit and give it to my variable, but it didn't work. Here is my scripts concerning the problem: >> lat1 = fspan(-65,-75,201) >> lat1@units = "degrees_north" >> lat1!0 = "lat" >> lat1@long_name = "latitude" >> lat1@standard_name = "latitude" >> lat1@axis = "Y" >> print(lat1) >> >> lon1 = fspan(0,359.95,7178) >> lon1@units = "degrees_east" >> lon1!0 = "lon" >> lon1@long_name = "longitude" >> lon1@standard_name = "longitude" >> lon1@axis = "X" >> >> c1&lat = lat1 >> c1&lon = lon1 >> printVarSummary(c1) >> printVarSummary(c1&lat) >> printVarSummary(c1&lon) >> >> ; plot >> wks = gsn_open_wks("x11","plot_grid-reg.ncl_bsa_AA") >> plot = gsn_csm_contour_map_ce(wks,c1,False) >> >> I really appreciate it if anyone can give me a clue. >> Thank you very much! >> Merry Christmas! >> >> Best, >> Wenshan >> > >> _______________________________________________ >> 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 _______________________________________________ ncl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Wed Dec 26 07:37:41 2012
This archive was generated by hypermail 2.1.8 : Fri Jan 04 2013 - 15:32:29 MST