Re: 2D contour plot

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Feb 26 2013 - 16:12:57 MST

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@ucar.edu>
> To: juki juki <juky_emc2@yahoo.com>
> Cc: NCL Talk <ncl-talk@ucar.edu>
> Sent: Wednesday, February 27, 2013 12:45 AM
> Subject: Re: 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@sfXArray = X
> res@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@cnRasterModeOn = False
> > res@cnFillOn = True
> > res@cnLinesOn = False
> > res@cnLineLabelsOn = False
> > res@tmYLMinorOn = True
> > res@tmXBMinorOn = True
> > res@tiYAxisFontHeightF = 0.015
> > res@tiXAxisFontHeightF = 0.015
> >
> > res@vpWidthF = 0.5 ; change aspect ratio of plot
> > res@vpHeightF = 0.3
> > res@cnLevelSelectionMode = "ManualLevels"
> > res@cnMinLevelValF = 0
> > res@cnMaxLevelValF = 2
> > res@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

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Feb 26 16:13:07 2013

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