Re: 2D contour plot

From: juki juki <juky_emc2_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 27 2013 - 14:28:05 MST

Hi Mary; Thank you so much. It works, again thank you ! Joukey ________________________________ From: Mary Haley <haley_at_ucar.edu> To: juki juki <juky_emc2_at_yahoo.com> Cc: NCL Talk <ncl-talk_at_ucar.edu> Sent: Thursday, February 28, 2013 12:51 AM Subject: Re: 2D contour plot Hi Joukey, Thanks for providing the script and data. It seems that setting the following will fix your problem, although I'm not sure why:    res_at_trGridType = "TriangularMesh" The issue appears to be with the x and y coordinate; the default contouring algorithm doesn't work with them. I will file a ticket on this. It may be that we need to improve the error message. --Mary On Feb 26, 2013, at 7:31 PM, juki juki wrote: > >Mary, > > >>It sounds like maybe your data has some missing values, but _FillValue is not set, or >>perhaps the contour levels you've chosen are out-of-range of your data?  > > > >No missing value in this data  and contour levels are in the data range. > > >Simply, the code and the input data are attached, as well as the sample of the plot result. Probably, you or other ncl users have time to look at it and suggest some improvement on the code. Thank you so much.. > > >Joukey > > > > > > > > > >________________________________ > From: Mary Haley <haley_at_ucar.edu> >To: juki juki <juky_emc2_at_yahoo.com> >Cc: NCL Talk <ncl-talk_at_ucar.edu> >Sent: Wednesday, February 27, 2013 8:12 AM >Subject: Re: [ncl-talk] 2D contour plot > >Joueky, > >One of the first rules of debugging: look at your data. > >  printVarSummary(Z) >  printMinMax(Z,0) > >It sounds like maybe your data has some missing values, but _FillValue is not set, or >perhaps the contour levels you've chosen are out-of-range of your data? > >You will need to load "contributed.ncl" to use printMinMax: > >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" > >As for the tickmark problem, perhaps your X/Y values need to >be scale down? Do they look correct as well? > >  printMinMax(X,0) >  printMinMax(Y,0) > >--Mary > >On Feb 26, 2013, at 3:22 PM, juki juki wrote: > >> >>  Mary, >> Thank you for your suggestion. >> >> Now I implemented your suggestion and  give a warning as below: >> warning:ContourPlotDraw: data boundary is out of range. >> >> Moreover, NCL still does not draw x-y axes and tickmarks. >> >> Again, thank you >> >> Joueky >> >> >> >> From: Mary Haley <haley_at_ucar.edu> >> To: juki juki <juky_emc2_at_yahoo.com> >> Cc: NCL Talk <ncl-talk_at_ucar.edu> >> Sent: Wednesday, February 27, 2013 12:45 AM >> Subject: Re: [ncl-talk] 2D contour plot >> >> Hi, >> >> See example "contour1d_1.ncl" at: >> >> http://www.ncl.ucar.edu/Applications/contour1d.shtml >> >> This example draws a map, but the same principle applies. >> >> You need to set: >> >>  res_at_sfXArray = X >>  res_at_sfYArray = Y >> >> --Mary >> >> On Feb 26, 2013, at 4:09 AM, juki juki wrote: >> >> > Hi all ncl users; >> > >> > I would like to make a 2D contour plot without map for my data. Suppose we have X, Y and Z data and we want to generate 2D contour with X and Y axis. I simply use the following code, for my data (X=distance, Y = distance, Z=data1): >> > >> > 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/contrib/time_axis_labels.ncl" >> > >> >  >> > begin >> > ; read in data                                  >> >    ncols    = 200  >> >    nrows    = 4800 >> >    data    = asciiread ("inactmeanRXradar.txt", (/nrows,ncols/), "float") >> >    distance    = asciiread ("distance.txt", (/200,1/), "float") >> >    >> >  data1=data(1:200,:) >> >    wks  = gsn_open_wks("png","conwomap")    ; open a wks >> >  gsn_define_colormap(wks,"gui_default")  ; choose a colormap >> > >> > X = distance >> > Y = distance >> > Z=data1 >> > >> >    res = True >> >    res_at_cnRasterModeOn = False >> >    res_at_cnFillOn      =  True >> >    res_at_cnLinesOn      =  False >> >    res_at_cnLineLabelsOn =  False >> >    res_at_tmYLMinorOn = True >> >    res_at_tmXBMinorOn = True >> >    res_at_tiYAxisFontHeightF = 0.015 >> >    res_at_tiXAxisFontHeightF = 0.015 >> > >> >  res_at_vpWidthF            = 0.5          ; change aspect ratio of plot >> >  res_at_vpHeightF          = 0.3 >> >  res_at_cnLevelSelectionMode = "ManualLevels" >> >  res_at_cnMinLevelValF = 0 >> >  res_at_cnMaxLevelValF = 2 >> >  res_at_cnLevelSpacingF = 0.05 >> > >> >  plot = gsn_csm_contour(wks,Z,res)      ; contour the variable >> >  >> > end >> > >> > Question: By using the current code, X and Y axis represent the grid number of Z. Actually what I need is X = distance, and Y = distance (from distance.txt file). How to involve X and Y in gsn_csm_contour directly ? Or are there any other option to plot this kind of data ? >> > >> > Thanks very much for sharing. >> > >> > Joueky >> > >> > >> > >> > >> > _______________________________________________ >> > 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 > > > ><data_test.txt><x_test.txt><y_test.txt><testMatlab.png><test1test1NCL_withsfXArray.png><test1.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 Wed Feb 27 14:28:17 2013

This archive was generated by hypermail 2.1.8 : Thu Feb 28 2013 - 14:47:31 MST