Re: loading contributed.ncl in a where document fails with ncl 6.2.0

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 03 2014 - 10:57:32 MDT

Keith,

We are going to look into this right away. A work-around is to put the "load" command *before* the "begin" command. This is generally recommended anyway.

I think this has to do with the fact that with V6.2.0, the gsn_code.ncl, gsn_csm.ncl, and contributed.ncl scripts are all loaded automatically. That is, you don't have to do:

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"

anymore. We purposely didn't advertise this, because it still works fine if you load all those scripts, and we weren't 100% sure how well it was going to work if people stop loading them.

So, you have two work-arounds:

1) Move the "load" command before the "begin" command.

2) Use "loadscript" and only load the script if you are running NCL V6.1.2:

ncl << EOF

begin
  if(get_ncl_version().eq."6.1.2") then
    loadscript("$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl")
    print("Loading contributed.ncl...")
  else
    print("NOT loading contributed.ncl...")
  end if
end
EOF

--Mary

On Apr 3, 2014, at 10:33 AM, Keith Lindsay <klindsay@ucar.edu> wrote:

> Hi,
>
> When I run
>
> ncl << EOF
> begin
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> end
> EOF
>
> with ncl 6.1.2, it runs fine. The output is usual ncl header info:
>
> Copyright (C) 1995-2013 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 6.1.2
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
>
> When I run it with ncl 6.2.0, I get hundred of fatal errors. I've
> cut-n-pasted the first few below.
> I am able to load contributed.ncl when I run ncl interactively.
> I am also able to load my own ncl scripts from within a where document.
> The problem seems to be unique to loading contributed.ncl within a where
> document.
> Could this be looked into please?
>
> Thanks, Keith
>
> fatal:syntax error: line 92 in file
> /glade/apps/opt/ncl/6.2.0/gnu/4.7.2/lib/ncarg/nclscripts/csm/contributed.ncl
> before or near size_array
> function size_array
> ------------------^
>
> ^Mfatal:Function identifier is defined
> ^Mfatal:syntax error: line 100 in file
> /glade/apps/opt/ncl/6.2.0/gnu/4.7.2/lib/ncarg/nclscripts/csm/contributed.ncl
> before or near isatt_LongName
> function isatt_LongName
> ----------------------^
>
> ^Mfatal:Function identifier is defined
> ^Mfatal:syntax error: line 101 in file
> /glade/apps/opt/ncl/6.2.0/gnu/4.7.2/lib/ncarg/nclscripts/csm/contributed.ncl
> before or near local
> local
> ----^
>
> ^Mfatal:error in statement
> ^Mfatal:syntax error: line 121 in file
> /glade/apps/opt/ncl/6.2.0/gnu/4.7.2/lib/ncarg/nclscripts/csm/contributed.ncl
> before or near getLongName
> function getLongName
> -------------------^
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Apr 3 10:57:47 2014

This archive was generated by hypermail 2.1.8 : Thu Apr 03 2014 - 13:36:27 MDT