[ncl-talk] Error initializing udunits-2 unit system

Jared Lee jaredlee at ucar.edu
Tue Aug 14 17:07:43 MDT 2018


Hi Mary,

Thanks for identifying that work-around. Setting that environment variable
cleared up the problem for me. That's a more elegant solution than simply
calling ut_string before calling ut_string_fix! Do you plan to add a note
about this to the online documentation for ut_string_fix?

For what it's worth, I was able to install NCL v6.5.0 on my own Mac laptop,
and I had the same problem there. Setting this environment variable also
fixed the problem on my laptop.

Jared

On Tue, Aug 14, 2018 at 4:42 PM Mary Haley <haley at ucar.edu> wrote:

> Hi Jared,
>
> I was able to reproduce your problem with 6.4.0 and 6.5.0 on cheyenne
> unfortunately. Thanks for providing a nice test program.
>
> The work-around for now seems to be setting this environment variable:
>
> setenv UDUNITS2_XML_PATH $NCARG_ROOT/lib/ncarg/udunits/udunits2.xml
>
> or
>
> export UDUNITS2_XML_PATH=$NCARG_ROOT/lib/ncarg/udunits/udunits2.xml
>
> Can you try this and let me know if it works in your own environment on
> cheyenne, and I'll file an official ticket on this.
>
> Thanks,
>
> --Mary
>
>
>
> On Mon, Aug 13, 2018 at 3:31 PM, Jared Lee <jaredlee at ucar.edu> wrote:
>
>> Hi, I have a follow-up on my original ticket from 10 Aug. I just
>> discovered that I get the udunits-2 error mentioned in the previous email
>> if I call ut_string_fix on its own. However, if I call ut_string and THEN
>> call ut_string_fix, then I get no error and my script runs normally. So it
>> appears that there's a bug in ut_string_fix in how it's calling the
>> udunits-2 library. Sorry to keep finding bugs in this script.
>>
>> Again, this is a problem with NCL v6.4.0, loading a special pre-release
>> version of ut_string_fix for v6.5.0 (after I found an earlier bug with the
>> v6.4.0 ut_string_fix function). I do not know if this was fixed for NCL
>> v6.5.0 because I'm waiting for gnu compilers to be installed on my own
>> workstation first, and NCL v6.5.0 is not yet installed on cheyenne, either.
>>
>> Jared
>>
>> On Fri, Aug 10, 2018 at 5:15 PM Jared Lee <jaredlee at ucar.edu> wrote:
>>
>>> Hi ncl-talk,
>>>
>>> I'm encountering an error I've never seen before, and which doesn't show
>>> up at all in ncl-talk archives. I'm running NCL v6.4.0 on Cheyenne, and I'm
>>> calling a special bug-fix to the ut_string_fix function (it's what is now
>>> default in v6.5.0, I believe). When I call the ut_string_fix function with
>>> at least some specific values (I haven't done exhaustive testing, but I've
>>> done a few tests that yield the same issue), I get the error:
>>>
>>> "Error initializing udunits-2 unit system"
>>>
>>> Here's a simple script that demonstrates the issue:
>>> ==========
>>> load
>>> "/glade/u/home/jaredlee/tools/nclscripts/functions/ut_string_fix.ncl"
>>> begin
>>>
>>> obs_time = (/113976.d, 114720.d, 115392.d/)
>>> obs_time at units = "hours since 2000-01-01 00:00:00"
>>>
>>> mo_nums1 = ut_string_fix(obs_time, "%N")
>>> print(mo_nums1)
>>> mo_nums2 = stringtoint(ut_string_fix(obs_time, "%N"))
>>> print(mo_nums2)
>>>
>>> end
>>> ==========
>>>
>>> And here is the output I get when executing this script:
>>>
>>> ==========
>>> jaredlee at cheyenne6:~/tools/nclscripts> ncl bug_udunits2.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
>>> Error initializing udunits-2 unit system
>>> jaredlee at cheyenne6:~/tools/nclscripts>
>>> ==========
>>>
>>> Does anyone have any ideas how to fix this? Is this something that
>>> cislhelp needs to be involved in to fix on cheyenne?
>>>
>>> Jared
>>>
>>> --
>>> ===============================
>>> Jared A. Lee, Ph.D.
>>> Project Scientist II
>>> 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
>>> ===============================
>>>
>>
>>
>> --
>> ===============================
>> Jared A. Lee, Ph.D.
>> Project Scientist II
>> 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
>> ===============================
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>

-- 
===============================
Jared A. Lee, Ph.D.
Project Scientist II
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/20180814/40d05ebd/attachment.html>


More information about the ncl-talk mailing list