[ncl-talk] bug in ut_string_fix

Jared Lee jaredlee at ucar.edu
Wed Nov 22 11:07:08 MST 2017


Oh, and one more thing. The documentation page for ut_string_fix should say
to load ut_string_fix.ncl, rather than ut_string.ncl, in order to use the
function.

Jared

On Wed, Nov 22, 2017 at 10:38 AM, Jared Lee <jaredlee at ucar.edu> wrote:

> Hi, I and others have previously written about the bug in cd_string that
> results in "60" being written in the seconds place, instead of incrementing
> the minutes place by 1 and resetting seconds to 0. To address this,
> ut_string_fix was introduced as a temporary fix. Unfortunately, I am
> finding the same exact bug in ut_string_fix that is in both cd_string and
> ut_string. I'll attach my script as a file, but for posterity in the web
> archives, here's my short demo script, followed by the resulting output,
> which demonstrates the problem. (The values for time that I specified were
> copy-pasted from another script where I first discovered this bug.)
>
> -----
> ;; bug_ut_string_fix.ncl
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/ut_string.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/ut_string_fix.ncl"
>
> time_units = "hours since 2000-01-01 00:00:00"
> time_fmt = "%Y-%N-%D_%H:%M:%S"
>
> time = (/23375.86666666664d, 23376.33333333331d, 23376.61666666664d/)
> time at units = time_units
> time at calendar = "standard"
> print(time)
>
> time_ut_string = ut_string(time, time_fmt)
> print(time_ut_string)
> time_ut_string_fix = ut_string_fix(time, time_fmt)
> print(time_ut_string_fix)
> time_cd_string = cd_string(time, time_fmt)
> print(time_cd_string)
>
> -----
>
> And now here is the output from running the script:
>
> jaredlee at cheyenne5:~/tools/nclscripts/NREL_Alaska> ncl
> bug_ut_string_fix.ncl
>  Copyright (C) 1995-2017 - All Rights Reserved
>  University Corporation for Atmospheric Research
>  NCAR Command Language Version 6.4.0
>  The use of this software is governed by a License Agreement.
>  See http://www.ncl.ucar.edu/ for more details.
>
>
> Variable: time
> Type: double
> Total Size: 24 bytes
>             3 values
> Number of Dimensions: 1
> Dimensions and sizes: [3]
> Coordinates:
> Number Of Attributes: 2
>   calendar : standard
>   units : hours since 2000-01-01 00:00:00
> (0) 23375.86666666664
> (1) 23376.33333333331
> (2) 23376.61666666664
>
>
> Variable: time_ut_string
> Type: string
> Total Size: 24 bytes
>             3 values
> Number of Dimensions: 1
> Dimensions and sizes: [3]
> Coordinates:
> Number Of Attributes: 1
>   _FillValue : missing
> (0) 2002-08-31_23:51:60
> (1) 2002-09-01_00:19:60
> (2) 2002-09-01_00:36:60
>
>
> Variable: time_ut_string_fix
> Type: string
> Total Size: 24 bytes
>             3 values
> Number of Dimensions: 1
> Dimensions and sizes: [3]
> Coordinates:
> Number Of Attributes: 1
>   _FillValue : missing
> (0) 2002-08-31_23:51:60
> (1) 2002-09-01_00:19:60
> (2) 2002-09-01_00:36:60
>
>
> Variable: time_cd_string
> Type: string
> Total Size: 24 bytes
>             3 values
> Number of Dimensions: 1
> Dimensions and sizes: [3]
> Coordinates:
> Number Of Attributes: 1
>   _FillValue : missing
> (0) 2002-08-31_23:51:60
> (1) 2002-09-01_00:19:60
> (2) 2002-09-01_00:36:60
>
> -----
>
> Jared
>
> --
> ===============================
> Jared A. Lee, Ph.D.
> Project Scientist I
> Research Applications Laboratory
> National Center for Atmospheric Research
> Boulder, Colorado, USA
>
> Member, AMS Planning Commission
>
> Email: jaredlee at ucar.edu (w)
> Phone: 303.497.8485 <(303)%20497-8485> (w)
> Web: https://staff.ucar.edu/users/jaredlee
> ===============================
>



-- 
===============================
Jared A. Lee, Ph.D.
Project Scientist I
Research Applications Laboratory
National Center for Atmospheric Research
Boulder, Colorado, USA

Member, AMS Planning Commission

Email: jaredlee at ucar.edu (w)
Phone: 303.497.8485 (w)
Web: https://staff.ucar.edu/users/jaredlee
===============================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171122/77400c81/attachment.html>


More information about the ncl-talk mailing list