[ncl-talk] YYYYMMDDHH conversion

Rick Brownrigg brownrig at ucar.edu
Thu May 11 13:40:24 MDT 2017


Hi Paolina,

As far as I can tell that is a bug in one of the supporting scripts that
has since been fixed. The version you appear to be using, 6.2.0, is a
number of years old by now. If at all possible, I would recommend you
upgrade to the latest 6.4.0.  If that's not possible, I could likely send
you the "contributed.ncl" script -- however that may be fraught with
incompatibility issues too.

Hope that helps...
Rick


On Thu, May 11, 2017 at 12:06 PM, Paolina Bongioannini Cerlini <
paolina.cerlini at unipg.it> wrote:

> Hi NCL people,
> I read some data and since I have days and hours I build a
>  time as YYYYMMDDHH then I  convert it in yrfrac:
>
> ; ***********************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> ;************************************************
> begin
> ;************************************************
> ; read in data
> ;************************************************
> ;
>    diri = "./"
>    fili = systemfunc("cd "+diri+" ; ls rce-bret-2005-rad.*.nc")
>    nfili= dimsizes(fili)
>    print("nfili="+nfili)
> ;
>    f    = addfiles(diri+fili,"r")
>    ListSetType (f, "join")
> ;
> ;    vNam = getfilevarnames (f)  ; all variables on file
> ;    print(vNam)
> ;
>     vNam1 = (/"x","y","z","p","raing","prcate1","tke","radfrc","radflx","ptsflx","qvsflx"/)
> ; manually specify
>     print(vNam1)
> ;
> ;
>      x   = f[0]->x
>      y   = f[0]->y
>      z   = f[0]->z
>      p  = f[:]->p
>      PREC= f[:]->raing
>      RADQR= f[:]->rnflx
>      LHF = f[:]->ptsflx
>      SHF = f[:]->qvsflx
> ;
>     printVarSummary(x)
>     printVarSummary(y)
>     printVarSummary(z)           ; [74]
>     printVarSummary(p)
> ;
> ; create time
>       TIME3D = yyyymmddhh_time(2017, 2017, 1, "integer")
>       printVarSummary(TIME3D)
> ;      time3D = TIME3D({2017040100:2017051000})    ; coordinate
> subscripting
>       time3D = TIME3D({2017040100:2017040203})
>       time3D!0="time"
>       time3D&time=time3D
>       printVarSummary(time3D)
> ;
> ;
> ;      print(time3D)
> ;
>       yrfrac = yyyymmddhh_to_yyyyfrac(time3D, 0)
>       print(yrfrac)
> ;
>  but it gives the following
> error:
>
> [paolina at cloud outputcheck]$ ncl energy_ARPS-PROVA_0.ncl>output.txt
> [paolina at cloud outputcheck]$ more output.txt
>  Copyright (C) 1995-2014 - All Rights Reserved
>  University Corporation for Atmospheric Research
>  NCAR Command Language Version 6.2.0
>  The use of this software is governed by a License Agreement.
>  See http://www.ncl.ucar.edu/ for more details.
> (0)     nfili=28
>
>
> Variable: vNam1
> Type: string
> Total Size: 88 bytes
>             11 values
> Number of Dimensions: 1
> Dimensions and sizes:   [11]
> Coordinates:
> (0)     x
> (1)     y
> (2)     z
> (3)     p
> (4)     raing
> (5)     prcate1
> (6)     tke
> (7)     radfrc
> (8)     radflx
> (9)     ptsflx
> (10)    qvsflx
>
> Variable: x
> Type: float
> Total Size: 780 bytes
>             195 values
> Number of Dimensions: 1
> Dimensions and sizes:   [fakeDim0 | 195]
> Coordinates:
> Number Of Attributes: 3
>   hdf_name :    x
>   units :       m
>   comment :     x coordinate
>
> Variable: y
> Type: float
> Total Size: 780 bytes
>             195 values
> Number of Dimensions: 1
> Dimensions and sizes:   [fakeDim1 | 195]
> Coordinates:
> Number Of Attributes: 3
>   hdf_name :    y
>   units :       m
>   comment :     y coordinate
>
> Variable: z
> Type: float
> Total Size: 296 bytes
>             74 values
> Number of Dimensions: 1
> Dimensions and sizes:   [fakeDim2 | 74]
> Coordinates:
> Number Of Attributes: 3
>   hdf_name :    z
>   units :       m
>   comment :     z coordinate
>
> Variable: p
> Type: float
> Total Size: 315151200 bytes
>             78787800 values
> Number of Dimensions: 4
> Dimensions and sizes:   [ncl_join | 28] x [fakeDim39 | 74] x [fakeDim40 |
> 195] x [fakeDim41 | 195]
> Coordinates:
> Number Of Attributes: 6
>   hdf_name :    p
>   stag_dim :    0
>   units :       Pascal
>   comment :     Pressure
>   hdf_comp_prm :        6
>   hdf_comp_code :       4
>
> Variable: TIME3D
> Type: integer
> Total Size: 35040 bytes
>             8760 values
> Number of Dimensions: 1
> Dimensions and sizes:   [time | 8760]
> Coordinates:
>             time: [2017010100..2017123123]
> Number Of Attributes: 2
>   long_name :   time
>   units :       YYYYMMDDHH
>
> Variable: time3D
> Type: integer
> Total Size: 112 bytes
>             28 values
> Number of Dimensions: 1
> Dimensions and sizes:   [time | 28]
> Coordinates:
>             time: [2017040100..2017040203]
> Number Of Attributes: 2
>   units :       YYYYMMDDHH
>   long_name :   time
>
>
> Variable: time3D
> Type: integer
> Total Size: 112 bytes
>             28 values
> Number of Dimensions: 1
> Dimensions and sizes:   [time | 28]
> Coordinates:
>             time: [2017040100..2017040203]
> Number Of Attributes: 2
>   units :       YYYYMMDDHH
>   long_name :   time
> (0)     2017040100
> (1)     2017040101
> (2)     2017040102
> (3)     2017040103
> (4)     2017040104
> (5)     2017040105
> (6)     2017040106
> (7)     2017040107
> (8)     2017040108
> (9)     2017040109
> (10)    2017040110
> (11)    2017040111
> (12)    2017040112
> (13)    2017040113
> (14)    2017040114
> (15)    2017040115
> (16)    2017040116
> (17)    2017040117
> (18)    2017040118
> (19)    2017040119
> (20)    2017040120
> (21)    2017040121
> (22)    2017040122
> (23)    2017040123
> (24)    2017040200
> (25)    2017040201
> (26)    2017040202
> (27)    2017040203
> fatal:Variable (nDay) is undefined
> fatal:["Execute.c":8567]:Execute: Error occurred at or near line 7879 in
> file $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl
>
> fatal:["Execute.c":8567]:Execute: Error occurred at or near line 7937 in
> file $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl
>
> fatal:["Execute.c":8567]:Execute: Error occurred at or near line 63 in
> file energy_ARPS-PROVA_0.ncl
> ------------------------------------------------------------
> ------------------------------------------------------------
> -------------------
> In attachment the files.
> Thank you for your help.
>
> Paolina
>
>
>
> --
> Paolina Bongioannini Cerlini Ph.D.
> University of Perugia
> CIRIAF -room 8
> 06125 - Perugia
>
> Tel.+39 075 5853576
> e-mail: paolina.cerlini at unipg.it
> skype: pcerlini
> --
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170511/f057ae9a/attachment.html 


More information about the ncl-talk mailing list