[ncl-talk] [RE]Re: Problem with ClmDayTLLL - "Variable (yyyy) is stillundefined, unable to reference attribute calendar"

Dennis Shea shea at ucar.edu
Wed Jun 24 07:53:44 MDT 2020


I have daily sea-level-pressure files spanning:

(0) SLP/slp.1995.nc
(1) SLP/slp.1996.nc
(2) SLP/slp.1997.nc
(3) SLP/slp.1998.nc
(4) SLP/slp.1999.nc
(5) SLP/slp.2000.nc
(6) SLP/slp.2001.nc
(7) SLP/slp.2002.nc
(8) SLP/slp.2003.nc
(9) SLP/slp.2004.nc
(10) SLP/slp.2005.nc
(11) SLP/slp.2006.nc
(12) SLP/slp.2007.nc
(13) SLP/slp.2008.nc
(14) SLP/slp.2009.nc
(15) SLP/slp.2010.nc
(16) SLP/slp.2011.nc
(17) SLP/slp.2012.nc
(18) SLP/slp.2013.nc
(19) SLP/slp.2014.nc

Variable: *yyyyddd*
Type: integer
Total Size: 29220 bytes
            7305 values
Number of Dimensions: 1
Dimensions and sizes:* [7305]*
Coordinates:
Number Of Attributes: 1
  calendar : standard

Variable: *slp*
Type: float
Total Size: 307160640 bytes
            76790160 values
Number of Dimensions: 3
Dimensions and sizes: *[time | 7305] x [lat | 73] x [lon | 144]   <=== 3D*
Coordinates:


*time: [1709328..1884624]            lat: [90..-90]            lon: [
0..357.5]*
Number Of Attributes: 15
  long_name : mean Daily Sea Level Pressure
  units : Pascals
  precision : 0
  least_significant_digit : -1
  GRIB_id : 2
  GRIB_name : PRMSL
  var_desc : Sea Level Pressure
  dataset : NCEP Reanalysis Daily Averages
  level_desc : Sea Level
  statistic : Mean
  parent_stat : Individual Obs
  missing_value : -9.96921e+36
  actual_range : ( 93510, 110860 )
  valid_range : ( 87000, 115000 )
  _FillValue : -9.96921e+36

Variable: *climatology*
Type: float
Total Size: 15389568 bytes
            3847392 values
Number of Dimensions: 3
Dimensions and sizes: *[year_day | 366] x [lat | 73] x [lon | 144]*



*Coordinates:             year_day: [1..366]            lat: [90..-90]
      lon: [ 0..357.5]*
Number Of Attributes: 5
  long_name : Daily Climatology: mean Daily Sea Level Pressure
  units : Pascals
  information : Raw daily averages across all years
  smoothing : None
  calendar : standard

================================================
SInce, slp is three-dimensional   (time,lat,lon), I used


climatology=*clmDayTLL*(slp, yyyyddd)       ; 3D
=======================================

I created a 4D (time,level,lat,lon) and ran it also. I had no problems.

Variable: climatology
Type: float
Total Size: 261622656 bytes
            65405664 values

*Number of Dimensions: 4Dimensions and sizes: [year_day | 366] x [plevel |
17] x [lat | 73] x [lon | 144]*

On Tue, Jun 23, 2020 at 9:24 PM 아나 유즈바시츠 <ajuzbasic at pusan.ac.kr> wrote:

> Thank you for all the suggestions. I tried all You suggested, but
> everything looks fine to me ?
>
> last few lines from print(year+" "+month+" "+day+" "+ddd+" "+yyyyddd)
>
> (14604) 2018 12 26 360 2018360
>
> (14605) 2018 12 27 361 2018361
>
> (14606) 2018 12 28 362 2018362
>
> (14607) 2018 12 29 363 2018363
>
> (14608) 2018 12 30 364 2018364
>
> (14609) 2018 12 31 365 2018365
>
>
> Variable: hgt
>
> Type: float
>
> Total Size: 10443461760 bytes
>
>             2610865440 values
>
> Number of Dimensions: 4
>
> Dimensions and sizes: [time | 14610] x [level | 17] x [lat | 73] x [lon |
> 144]
>
> Coordinates:
>
>             time: [1569072..1919688]
>
>             level: [1000..10]
>
>             lat: [90..-90]
>
>             lon: [ 0..357.5]
>
> Number Of Attributes: 17
>
>   long_name : Daily Geopotential Heights on Pressure Levels
>
>   units : m
>
>   precision : 0
>
>   least_significant_digit : 0
>
>   GRIB_id : 7
>
>   GRIB_name : HGT
>
>   var_desc : Geopotential height
>
>   dataset : NCEP/DOE AMIP-II Reanalysis (Reanalysis-2) Daily Averages
>
>   level_desc : Pressure Levels
>
>   statistic : Mean
>
>   parent_stat : Individual Obs
>
>   standard_name : geopotential_height
>
>   cell_methods : time: mean (of 4 6-hourly values in one day)
>
>   missing_value : -9.96921e+36
>
>   actual_range : ( -530, 32289 )
>
>   valid_range : ( -1500, 35800 )
>
>   _FillValue : -9.96921e+36
>
>
> Variable: yyyyddd
>
> Type: integer
>
> Total Size: 58440 bytes
>
>             14610 values
>
> Number of Dimensions: 1
>
> Dimensions and sizes: [14610]
>
> Coordinates:
>
> Number Of Attributes: 1
>
>   calendar : standard
>
> (0) min=1979001   max=2018365
>
>
>
> ----- Original Message -----
> From : Dennis Shea <shea at ucar.edu>
> To : "Ana Juzbasic" <ajuzbasic at pusan.ac.kr>
> Cc : "Ncl-talk" <ncl-talk at ucar.edu>
> Sent : 2020-06-23 22:31:32
> Subject : Re: [ncl-talk] Problem with ClmDayTLLL - "Variable (yyyy) is
> stillundefined, unable to reference attribute calendar"
>
>
> 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/20200624/25b37830/attachment.html>


More information about the ncl-talk mailing list