Re: problem with yyyyddd_to_yyyymmdd

From: Wenshan Wang <wenshanw_at_nyahnyahspammersnyahnyah>
Date: Fri Jan 10 2014 - 22:00:22 MST

Sorry to bother but It's so unusual to receive no reply in a week.

On Fri, Jan 3, 2014 at 5:17 PM, Wenshan Wang <wenshanw@uci.edu> wrote:

> Dear all,
>
> Happy New Year!
>
> I had a problem using the function 'yyyyddd_to_yyyymmdd'.
> I read a ascii file of radiation data.
> For every year, it works fine from Jan 1st to 8th, but fails on 9th:
> ==============================================================
> fatal:The result of the conditional expression yields a missing value. NCL
> can not determine branch, see ismissing function
>
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 4670 in
> file $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl
>
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 30 in
> file yyyyddd_to_yyyymmdd_check.ncl
> ===============================================================
>
> The ascii files look normal. They are downloaded from GC-NET.
> I print all the inputs. They look fine too.
> I tried to debug contributed.ncl. There are no missing values in the
> conditional statement, where the script breaks.
> I have workarounds but really want to know why this happens.
>
> The following is my data and script.
> I attached them and put them on to 'ftp.cgd.ucar.edu:/incoming' as well.
> NCL version: 6.1.2
> System: Linux grele 3.5.0-44-generic #67~precise1-Ubuntu SMP Wed Nov 13
> 16:16:57 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
>
> Thank you very much!
>
> DATA (test.txt)
> =================================================
> Data avaiable from 1996 1.0000 to 2013 123.5000
> 1 Station Number A 01 .. 18
> 2 Year B 1995 - 1999
> 3 Julian Decimal Time C 0.0000 - 365.9583
> 4 SW_down [W m-2]
> 5 SW_up [W m-2]
> 6 Net Radiation F [W m-2]
> 7 Albedo
> 8 Zenith Angle [deg]
>
> 1 2011 8.7500 1.20 0.58 -33.12 0.85 95.97
> 1 2011 8.7917 0.20 0.14 -31.44 0.85 99.50
> 1 2011 8.8333 0.40 0.07 -30.40 0.85 103.83
> 1 2011 8.8750 0.20 0.00 -30.72 0.85 108.72
> 1 2011 8.9167 0.20 0.00 -31.84 0.85 113.91
> 1 2011 8.9583 0.20 0.00 -31.84 0.85 119.07
> 1 2011 9.0000 0.20 0.00 -32.80 0.85 123.91
> 1 2011 9.0417 0.40 0.00 -33.04 0.85 128.02
> 1 2011 9.0833 0.20 0.00 -31.12 0.85 131.00
> 1 2011 9.1250 0.20 0.07 -31.60 0.85 132.51
> 1 2011 9.1667 0.20 0.07 -32.48 0.85 132.34
> 1 2011 9.2083 0.20 0.14 -30.88 0.85 130.51
> 1 2011 9.2500 0.20 0.00 -32.24 0.85 127.26
> 1 2011 9.2917 0.20 0.00 -32.96 0.85 122.97
> 1 2011 9.3333 0.20 0.07 -29.36 0.85 118.04
> 1 2011 9.3750 0.20 0.00 -31.60 0.85 112.83
> 1 2011 9.4167 0.20 0.17 -31.36 0.85 107.66
> 1 2011 9.4583 0.20 0.14 -30.08 0.85 102.86
> 1 2011 9.5000 0.00 0.00 -24.08 0.85 98.65
> 1 2011 9.5417 0.00 0.00 -13.52 0.85 95.28
> 1 2011 9.5833 0.40 0.34 -28.24 0.85 92.96
> 1 2011 9.6250 2.00 1.70 -35.76 0.85 91.82
> 1 2011 9.6667 3.20 2.37 -36.96 0.85 91.93
> 1 2011 9.7083 2.20 1.58 -37.60 0.85 93.29
> 1 2011 9.7500 0.80 0.43 -36.72 0.85 95.81
> 1 2011 9.7917 0.40 0.07 -36.40 0.85 99.34
> 1 2011 9.8333 0.20 0.07 -37.20 0.85 103.67
> 1 2011 9.8750 0.20 0.07 -37.12 0.85 108.56
> 1 2011 9.9167 0.40 0.00 -37.12 0.85 113.74
> 1 2011 9.9583 0.40 0.00 -37.20 0.85 118.91
> 1 2011 10.0000 0.20 0.00 -37.52 0.85 123.74
>
> ==================================================
>
>
> SCRIPT (yyyyddd_to_yyyymmdd_check.ncl)
> ==================================================
> ; Complied by Wang Wenshan 2014-01-03 Friday 14:10:49
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ;*************************************************************
> ; txt --> nc
> ; GC-NET
> ; txt: each line:
> ; 0 1 2 3 4 5 6 7
> ; stn year day SW-down SW-up net albedo zenith
> ; nc: 16stn * 91day * 24 hr, 5 var
> ;************************************************************
> begin
> ; read in txt
> ;------------------------------------------------------------
> fn = "test.txt"
>
> ncol = numAsciiCol(fn)
> opt = 10
>
> dd = readAsciiTable(fn, ncol, "float", opt)
> printVarSummary(dd)
> dim_dd = dimsizes(dd)
> nrow = dim_dd(0)
>
> do j = 0, nrow - 1 ; loop: rows
> print(dd(j,0)+" "+dd(j,1)+" "+dd(j,2)+" "+dd(j,3)+" "+dd(j,4)+"
> "+dd(j,5)+" "+dd(j,6)+" "+dd(j,7))
> print(sprinti("%0.3i",toint(dd(j,2))))
> print(""+dd(j,1)+sprinti("%0.3i",toint(dd(j,2))))
>
> print(""+yyyyddd_to_yyyymmdd(tointeger(dd(j,1)+sprinti("%0.3i",toint(dd(j,2))))))
> print("--------------")
> end do
>
> print("done!")
> end
>
>
> Best,
> Wenshan
>
> ------------------------------------------------------------------------------
> Graduate Student Researcher
> Earth System Science
> University of California, Irvine
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jan 10 22:00:53 2014

This archive was generated by hypermail 2.1.8 : Sun Jan 19 2014 - 21:56:35 MST