[ncl-talk] Problem with ClmDayTLLL - "Variable (yyyy) is still undefined, unable to reference attribute calendar"

Dennis Shea shea at ucar.edu
Tue Jun 23 07:31:13 MDT 2020


As a 1st debug step, you could do:

printVarSummary(yyyyddd)
printMinMax(yyyyddd,0)
print("=========")

Maybe look at all the 'date' values

print(year+" "+month+" "+day+" "+ddd+" "+yyyyddd)

Also, include the output from:

printVarSummary(hgt)


On Tue, Jun 23, 2020 at 4:48 AM Ana Juzbasic via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Hello all,
>
> I am trying to use ClmDayTLLL to calculate daily geopotential height
> climatology. I'm using data from NCEP NCAR reanalyis 2, daily means for
> period 1979 to 1918.
> yyyyddd is calculated correctly, but I get following error when I try to
> run ClmDayTLL:
>
>
> fatal:Variable (yyyy) is still undefined, unable to reference attribute
> calendar
>
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 4394 in
> file /usr/local/ncl/lib/ncarg/nclscripts/csm/contributed.ncl
>
> Tried on ncl 6.3.0 and ncl 6.4.0, same error. I also tried adding "yyyy=
> year" line, but it didn't change anything. Any suggestions on what I'm
> doing wrong?
>
> Here's the full script:
>
>
> begin
>
>
> dir            ="./daily/"
>
>  hgtlist        =systemfunc("ls "+dir+"hgt/hgt"+"*.nc")
>
>  hgtfile        = addfiles(hgtlist,"r")
>
>  time           =hgtfile[:]->time
>
>
>    TIME    = cd_calendar(time, 0)             ; type float
>
>    year    = toint( TIME(:,0) )               ; toint strips meta data
>
>    month   = toint( TIME(:,1) )
>
>    day     = toint( TIME(:,2) )
>
>                                                                  ; check
> for calendar attribute
>
>    if (isatt(TIME,"calendar")) then           ; default is gregorian
>
>        year at calendar = TIME at calendar
>
>    end if
>
>
>    ddd     = day_of_year(year, month, day)
>
>    if (isatt(year,"calendar")) then           ; default is gregorian
>
>        ddd at calendar = year at calendar
>
>    end if
>
>
>    yyyyddd = year*1000 + ddd                                    ; needed
> for input
>
>    if (isatt(ddd,"calendar")) then           ; default is gregorian
>
>        yyyyddd at calendar = ddd at calendar
>
>   end if
>
> printVarSummary(yyyyddd)
>
>
> hgt=hgtfile[:]->hgt
>
>
> printVarSummary(hgt)
>
> climatology=clmDayTLLL(hgt, yyyyddd)
>
> printVarSummary(climatology)
>
>
>
> end
>
>
> Best regards,
>
> Ana
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200623/2d787050/attachment.html>


More information about the ncl-talk mailing list