Re: Pressure/Height vs. Time

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed Nov 16 2011 - 09:57:37 MST

You are not really providing enough data values for a decent plot, so I assume this dataset was just a small subset?
Also, the height values don't look correct. They are not increasing monotonically as the pressure values decrease.

Please read over our ASCII reading examples. You've asked multiple questions about reading ASCII data, and we've already provide you with several examples:

http://www.ncl.ucar.edu/Applications/read_ascii.shtml

To plot this data, you can start with:

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"

begin
  filename = "nlcheng.txt"
  ncols = 8

  opt = 1 ; skip the first line which is a header

;---Read as double because we need this for "date" values.
  data = readAsciiTable(filename,ncols,"double",opt)
  lat = data(1:,3)
  lon = data(1:,4)
  pres = data(1:,5)
  hgt = data(1:,6)
  so2 = data(1:,7)
  nvals = dimsizes(so2)
  time = ispan(0,nvals-1,1) ; For X axis

;
; Time values are special. We need to convert them to a
; readable format for the plot's X axis.
;
  date = tostring(toint(data(1:,0)))
  yyyy = str_get_cols(date,0,3)
  mm = str_get_cols(date,4,5)
  dd = str_get_cols(date,6,7)
  time_labels = yyyy + "/" + mm + "/" + dd

;
; Generate pressure levels at "nice" height levels for labeling
; the right Y axis later.
;
  hnice = (/2230, 2240, 2250, 2260/)
  pnice = ftcurv(hgt,pres,hnice) ; Get pres vals at nice hgt vals.
print(pnice)
;---Start the graphics
  wks = gsn_open_wks("x11","pres_time")

  res = True
  res@gsnMaximize = True

  res@sfXArray = time
  res@sfYArray = pres

  res@cnFillOn = True
  res@lbLabelAutoStride = True

  res@tiYAxisString = "pressure"

  res@tmXBMode = "Explicit"
  res@tmXBValues = time
  res@tmXBLabels = time_labels
  res@tmYLFormat = "f" ; no unnecessary zeroes

  res@tmYUseLeft = False
  res@tmYROn = True
  res@tmYRLabelsOn = True

  res@tmYRMode = "Explicit"
  res@tmYRValues = pnice
  res@tmYRLabels = ""+hnice

  contour = gsn_csm_contour(wks,so2,res)
end

On Nov 15, 2011, at 10:17 PM, nlcheng wrote:

>
> My data file called nlcheng.txt .the contents were below :
>
> <截图1.png>
> it is not a netcdf file
> and I want to draw a picture of SO2,lile this:
> SO2
> <截图2.png>
> and i know the fuction of gsn_csm_pres_hgt can not deal with this data file.
> how can i dispose this problem.
> hope for your help! thank you very much
>
>
>
> _______________________________________________
> 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 Nov 16 09:57:43 2011

This archive was generated by hypermail 2.1.8 : Thu Nov 17 2011 - 11:50:12 MST