[ncl-talk] XY plot from .ascii file

NB nbarlow30 at gmail.com
Sat Nov 11 18:39:13 MST 2017


I'm running NCL 6.4.0, OpenDAP enabled, in a linux environment.

I want to make a basic xy graph, using .asiii files from NCEP's NOMADS
server.

Here is the beginning of my script:
------------------------------------------

*;Query and download for tmp2m, times, lat, lon*
plot = systemfunc("wget
http://nomads.ncep.noaa.gov:9090/dods/hrrr/hrrr20171111/hrrr_sfc_23z.ascii?tmp2m[0:18][808][412]
-O /usr/local/ncl/data/hrrr")

*;Read .asciifile*
f1 = asciiread("/usr/local/ncl/data/hrrr",-1,"float")

*;Define tmp2m array*
temp = f1(6:60:3)
print(temp)

Variable: temp
Type: float
Total Size: 76 bytes
            19 values
Number of Dimensions: 1
Dimensions and sizes:   [19]
Coordinates:
Number Of Attributes: 1
  _FillValue :  9.96921e+36
(0)     273.0365
(1)     272.9575
(2)     272.2889
(3)     271.8959
(4)     271.7046
(5)     271.8002
(6)     272.0746
(7)     272.3098
(8)     272.1751
(9)     272.0324
(10)    271.9301
(11)    271.9724
(12)    271.9315
(13)    271.8347
(14)    271.7155
(15)    271.5002
(16)    271.3636
(17)    271.5006
(18)    272.4438

*;Define time array*
time = f1(62:80)
print(time)

Variable: time
Type: float
Total Size: 76 bytes
            19 values
Number of Dimensions: 1
Dimensions and sizes:   [19]
Coordinates:
Number Of Attributes: 1
  _FillValue :  9.96921e+36
(0)     736645.9
(1)     736646
(2)     736646.1
(3)     736646.1
(4)     736646.1
(5)     736646.2
(6)     736646.2
(7)     736646.2
(8)     736646.3
(9)     736646.3
(10)    736646.4
(11)    736646.4
(12)    736646.4
(13)    736646.5
(14)    736646.6
(15)    736646.6
(16)    736646.6
(17)    736646.7
(18)    736646.7

*;Convert Time to **YYYYMMDDHH*
time at units = "days since 1-1-1 00:00:0.0"
xtime = cd_calendar(time,3)
print(xtime)

Variable: xtime
Type: double
Total Size: 152 bytes
            19 values
Number of Dimensions: 1
Dimensions and sizes:   [19]
Coordinates:
Number Of Attributes: 2
  _FillValue :  9.969209968386869e+36
  calendar :    standard
(0)     2017111122
(1)     2017111200
(2)     2017111201
(3)     2017111201
(4)     2017111203
(5)     2017111204
(6)     2017111204
(7)     2017111206
(8)     2017111207
(9)     2017111207
(10)    2017111209
(11)    2017111210
(12)    2017111210
(13)    2017111212
(14)    2017111213
(15)    2017111213
(16)    2017111215
(17)    2017111216
(18)    2017111216
-----------------------------------------------------------
I am able to make plots using gsn_csm_xy(wks,xtime,temp,res), but the
x-axis tick spacing is always erratic. Sometimes, it will plot 2 values for
the same time step. No  "res@" options seem to fix it.

My question is - how do I deal with a time dimension like the one above? I
have 2 arrays of equal size(time & temp), it seems that the coordinates
should be easy to plot, but they're not. I've tried several conversion
tactics via cd_calendar, but it doesn't solve it. I'd like the x-axis ticks
to be "12z 11/Nov" for example.



Thanks in advance,

nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171112/35bf0be9/attachment.html>


More information about the ncl-talk mailing list