;*************************************************************************** ; read CXI surface met data. format: NASA-Ames ; PSD provides this code to make it easier to read the data. We do ; not support NCL and advise those with questions to read NCL webpages ; and/or contact their support staff. ; ; This code reads the CXISLAND Sfc met data into arrays and plots a variable. ; See http://www.esrl.noaa.gov/psd/enso/rapid_response/data_pub/ ;*************************************************************************** ; written by CAS 8/31/2016. V1.0 ;*************************************************************************** begin ; --- Read Data ----------------------------------------; filein="psd-sfcmet_kiritimati_20160125_cor2.na" titledate = filein cnlvl=systemfunc("/usr/local/bin/wc "+ filein) nlvl=stringtointeger(cnlvl) head1 = readAsciiHead(filein,1) ; there are two header lines strs = str_split(head1, " ") nheads = stringtointeger(strs(0)) print(nheads+" ") print(nlvl+" obs+"+nheads) skiprows=nheads+1 ncol = 15 nlvl=nlvl-skiprows print(nlvl+" lines of obs") TestData = readAsciiTable (filein , (/ncol/), "double",skiprows) TestData@_FillValue=9999 TestData@missing_value=9999 time = TestData (:,0) ; time [UTCday) year = TestData (:,1) ; years day = TestData (:,2) ; day hour = TestData (:,3) ; hour minute = TestData (:,4) ; minutes seconds= TestData (:,5) ; seconds p = TestData (:,7) ; air pressure [mb] or [hPa] tc = TestData (:,8) ; temperature [C] rh = TestData (:,9) ; relative humidity [%] wspd = TestData (:,10) ; wind speed [m/s] wdir = TestData (:,11) ; meteorological wind dir [from degrees] gust = TestData (:,12) ; wind speed of gust [m/s] rain = TestData (:,13) ; rain [mm] volt = TestData (:,14) ; battery voltage [V] i=0 ;************************* ; create plot ;************************* res=True wks = gsn_open_wks ("png", "cxi_sfcmet") res@tiMainString = "Time(UTC day) vs rain(mm) CXI" ; add title plot = gsn_csm_xy (wks,time,rain,res) ; create plot max_p = max(p) min_p = min(p) print(max_p+" max p") print(min_p+" min p") end