[ncl-talk] help in xy-plot

Karin Meier-Fleischer meier-fleischer at dkrz.de
Mon Oct 28 07:55:31 MDT 2019


Hi DP,

if you read the following two examples pages you should be able to read 
and plot your ASCII file.

See xy-plots example page: http://ncl.ucar.edu/Applications/xy.shtml
See Read ASCII: http://ncl.ucar.edu/Applications/read_ascii.shtml

But here is a short script to do it:

   fname = "tst1.txt"

   nrow     = numAsciiRow(fname)
   data     = asciiread(fname,-1,"string")
   date     = str_get_field(data(1:),1,"    ")
   pressure = toint(str_get_field(data(1:),2,"    "))
   wind     = toint(str_get_field(data(1:),3,"    "))

   idate = ispan(0,dimsizes(date)-1,1)

   wks = gsn_open_wks("x11","plot_tst1")

   res                 = True
   res at trXMinF         = idate(0)
   res at trXMaxF         = idate(nrow-2)
   res at trYMinF         = -100
   res at trYMaxF         = max(pressure)+100
   res at tmXBMode        = "Explicit"
   res at tmXBValues      = idate
   res at tmXBLabels      = date
   res at tmXBLabelAngleF = 45

   plot = gsn_csm_xy(wks,idate,(/pressure,wind/),res)

-Karin

Am 28.10.19 um 13:06 schrieb Debashis Paul via ncl-talk:
> Hello NCL community, I have a text file containing date 
> minimum pressure and wind speed, which I need to plot as an XY plot 
> with the two variables with time as the x-axis. I tried according to 
> the examples given in NCL examples but am not able to produce it. So 
> if anyone can help me in this regard I will be much grateful.
>  The text file will be attached to this email.
>
> With regards,
> DP
> ******************************************************************
> */Debashis Paul/*
> */Research Scholar,NIT-RKL
> /*
> */Ph:+916002713628/*
> */E-mail: Debgeo668 at gmail.com <mailto:Debgeo668 at gmail.com>/*
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191028/8432a54c/attachment.html>


More information about the ncl-talk mailing list