[ncl-talk] ESMF regridding error? "Variable (opt) is undefined in line 1613 of ESMF-regridding.ncl

Kuipers Munneke, P. (Peter) P.KuipersMunneke at uu.nl
Thu Feb 15 02:21:53 MST 2018


Hi,

Today I have tried the solution below. Unfortunately, the customized script didn’t provide a solution. The behavior in the customized script is totally erratic and variables get undefined within the script. It’s not just the cts_opt variable, but when I comment some lines that try to read the cts_opt variable, it starts to complain that other variables are unknown, e.g. lat2d, or FTitle. I have tried to generate local variables and write the variables into these but they suffer from the same problem. I suspect that it is some sort of memory issue where bits and bytes are altered or overwritten as soon as a variable is read.

For example, I inserted a printVarSummary statement at many places in the file attached. All the way down this message is the result. The procedure crashes between lines 42 and 49 in the attached file. Which seems completely random. If I comment lines 44-47, the procedure crashes at line 60. If I comment lines 51-58, I get:

fatal:Variable (FTitle) is undefined
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 99 in file ./curv_to_scrip.ncl

So all of a sudden it’s no longer cts_opt that is missing, but another variable.

I suppose there is not really an easy solution to this problem. As said, I think it is memory-related.

Best,
Peter



==================

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.
(0)     test


Variable: opt
Type: logical
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:   [1]
Coordinates:
Number Of Attributes: 12
  NetCDFType :  netcdf4
  Debug :       False
  PrintTimings :        False
  ForceOverwrite :      True
  InterpMethod :        bilinear
  DstRegional : True
  SrcRegional : True
  DstGridLon :  <ARRAY of 1464100 elements>
  DstGridLat :  <ARRAY of 1464100 elements>
  SrcGridLon :  <ARRAY of 44448889 elements>
  SrcGridLat :  <ARRAY of 44448889 elements>
  WgtFileName : ./Bedmap_on_MODIS_grid.nc
(0)     True

Variable: cts_opt (parameter)
Type: logical
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:   [1]
Coordinates:
Number Of Attributes: 4
  Debug :       False
  ForceOverwrite :      True
  PrintTimings :        False
  NetCDFType :  netcdf4

Variable: cts_opt (parameter)
Type: logical
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:   [1]
Coordinates:
Number Of Attributes: 4
  Debug :       False
  ForceOverwrite :      True
  PrintTimings :        False
  NetCDFType :  netcdf4

Variable: cts_opt (parameter)
Type: logical
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:   [1]
Coordinates:
Number Of Attributes: 4
  Debug :       False
  ForceOverwrite :      True
  PrintTimings :        False
  NetCDFType :  netcdf4
fatal:Variable (cts_opt) is undefined
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 49 in file ./curv_to_scrip.ncl

fatal:["Execute.c":8640]:Execute: Error occurred at or near line 3912 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl

fatal:["Execute.c":8640]:Execute: Error occurred at or near line 4042 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl

fatal:["Execute.c":8640]:Execute: Error occurred at or near line 73 in file make_topogrid.ncl




> On Feb 14, 2018, at 0:22, Mary Haley <haley at ucar.edu> wrote:
>
> Hi Peter,
>
> Thanks for providing good details about the problem and the files.
>
> I'm running your script right now with 6.4.0, but haven't seen the problem yet. The script is taking awhile to run, so I'll post back here when it's done. So far, it has printed this output:
>
> (0)   get_src_grid_info: source lat dims = (6667,6667)
> (0)   get_src_grid_info: source lon dims = (6667,6667)
> (0)   get_src_grid_info: source grid type is 'curvilinear'
> (0)   curvilinear_to_SCRIP: calculating grid corners...
> (0)   curvilinear_to_SCRIP: one or more lat values are at the
> (0)          poles, so calculating grid corners using
> (0)          calc_SCRIP_corners_boundaries...
> (0)   calc_SCRIP_corners_boundaries
> (0)        min/max original lat: -90/-48.4644
> (0)        min/max original lon: -179.983/180
>
> When you run the script, do you see the error message before this output or after?
>
>
> We've seen this problem before with other users and are completely mystified about where it's happening.  You are correct that it appears to be coming from ESMF_regridding.ncl, although we've looked at the code multiple times and don't see the source of the issue.  This has actually happened with earlier versions of NCL (up to 2 years ago), but it doesn't happen consistently.
>
> What I did for another user that had this problem was to take the "curvilinear_to_SCRIP" procedure that's in ESMF_regridding.ncl, put it in it's own xxxx.ncl script, and then changed all the "Opt" references to something else, like "cts_opt", just to see if the problem persists.
>
> Since I can't reproduce your problem yet, maybe you can try this yourself. Save the attached curv_to_scrip.ncl file, and then load it from the make_topogrid_debug.ncl script as follows:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"
> load "./curv_to_scrip.ncl"
>
> What will happen is that the "curvilinear_to_SCRIP" in the second NCL script will override the one in ESMF_regridding.ncl, because I made sure there was an "undef" command before it.
>
> [As I've been typing this email and trying things out, your script is still running without any errors.]
>
> Let ncl-talk know if you still see the problem with the new script.
>
> Thanks,
>
> --Mary
>
>
>
> On Tue, Feb 13, 2018 at 8:20 AM, Kuipers Munneke, P. (Peter) <P.KuipersMunneke at uu.nl> wrote:
> Dear all,
>
> As a regular NCL user, I stumbled upon an issue with the ESMF regridding software, which I have just started to use. I suspect that the Attached you find the cleanest version of the code that reproduces the error, in make_topogrid_debug.ncl. The structure of the code is an exact replica of https://www.ncl.ucar.edu/Applications/Scripts/ESMF_regrid_16.ncl.
>
> The undefined variable “opt” is not the “opt” in the make_topogrid_debug.ncl file. If I rename it to something else, the error message continues to mention the “Opt” variable instead of the renamed one. This makes me suspect that the error is generated in ESMF_regridding.ncl itself.
>
> I would be very grateful for your help.
>
> With best regards,
> Peter
>
> ============
>
>
> - NCL version 6.4.0
>
> - Data files are available at http://www.staff.science.uu.nl/~kuipe117/ncl_debug
>
> - The exact error message is
>
> fatal:Variable (Opt) is undefined
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 1613 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl
>
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 3912 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl
>
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 4042 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl
>
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 51 in file make_topogrid_debug.ncl
>
> - The system is Mac OS High Sierra 10.13.3
>
> uname -a gives:
>
> Darwin mbpkuipsmunneke.soliscom.uu.nl 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64
>
> gcc —version gives:
>
> Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
> Apple LLVM version 9.0.0 (clang-900.0.39.2)
> Target: x86_64-apple-darwin17.4.0
> Thread model: posix
> InstalledDir: /Library/Developer/CommandLineTools/usr/bin
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> <curv_to_scrip.ncl>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180215/f58b83de/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: curv_to_scrip.ncl
Type: application/octet-stream
Size: 9677 bytes
Desc: curv_to_scrip.ncl
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180215/f58b83de/attachment.obj>


More information about the ncl-talk mailing list