<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="BodyFragment"><font size="2"><span style="font-size:10pt;">
<div class="PlainText">Hi,<br>
<br>
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.
<br>
<br>
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:<br>
<br>
fatal:Variable (FTitle) is undefined<br>
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 99 in file ./curv_to_scrip.ncl<br>
<br>
So all of a sudden it’s no longer cts_opt that is missing, but another variable.<br>
<br>
I suppose there is not really an easy solution to this problem. As said, I think it is memory-related.<br>
<br>
Best, <br>
Peter<br>
</div>
</span></font></div>
<div class="BodyFragment"><font size="2"><span style="font-size:10pt;">
<div class="PlainText"><br>
<br>
<br>
==================<br>
<br>
Copyright (C) 1995-2017 - All Rights Reserved<br>
 University Corporation for Atmospheric Research<br>
 NCAR Command Language Version 6.4.0<br>
 The use of this software is governed by a License Agreement.<br>
 See <a href="http://www.ncl.ucar.edu/">http://www.ncl.ucar.edu/</a> for more details.<br>
(0)     test<br>
<br>
<br>
Variable: opt<br>
Type: logical<br>
Total Size: 4 bytes<br>
            1 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes:   [1]<br>
Coordinates: <br>
Number Of Attributes: 12<br>
  NetCDFType :  netcdf4<br>
  Debug :       False<br>
  PrintTimings :        False<br>
  ForceOverwrite :      True<br>
  InterpMethod :        bilinear<br>
  DstRegional : True<br>
  SrcRegional : True<br>
  DstGridLon :  <ARRAY of 1464100 elements><br>
  DstGridLat :  <ARRAY of 1464100 elements><br>
  SrcGridLon :  <ARRAY of 44448889 elements><br>
  SrcGridLat :  <ARRAY of 44448889 elements><br>
  WgtFileName : ./Bedmap_on_MODIS_grid.nc<br>
(0)     True<br>
<br>
Variable: cts_opt (parameter)<br>
Type: logical<br>
Total Size: 4 bytes<br>
            1 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes:   [1]<br>
Coordinates: <br>
Number Of Attributes: 4<br>
  Debug :       False<br>
  ForceOverwrite :      True<br>
  PrintTimings :        False<br>
  NetCDFType :  netcdf4<br>
<br>
Variable: cts_opt (parameter)<br>
Type: logical<br>
Total Size: 4 bytes<br>
            1 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes:   [1]<br>
Coordinates: <br>
Number Of Attributes: 4<br>
  Debug :       False<br>
  ForceOverwrite :      True<br>
  PrintTimings :        False<br>
  NetCDFType :  netcdf4<br>
<br>
Variable: cts_opt (parameter)<br>
Type: logical<br>
Total Size: 4 bytes<br>
            1 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes:   [1]<br>
Coordinates: <br>
Number Of Attributes: 4<br>
  Debug :       False<br>
  ForceOverwrite :      True<br>
  PrintTimings :        False<br>
  NetCDFType :  netcdf4<br>
fatal:Variable (cts_opt) is undefined<br>
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 49 in file ./curv_to_scrip.ncl<br>
<br>
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 3912 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl<br>
<br>
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 4042 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl<br>
<br>
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 73 in file make_topogrid.ncl<br>
<br>
<br>
<br>
<br>
> On Feb 14, 2018, at 0:22, Mary Haley <haley@ucar.edu> wrote:<br>
> <br>
> Hi Peter,<br>
> <br>
> Thanks for providing good details about the problem and the files.  <br>
> <br>
> 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:<br>
> <br>
> (0)   get_src_grid_info: source lat dims = (6667,6667)<br>
> (0)   get_src_grid_info: source lon dims = (6667,6667)<br>
> (0)   get_src_grid_info: source grid type is 'curvilinear'<br>
> (0)   curvilinear_to_SCRIP: calculating grid corners...<br>
> (0)   curvilinear_to_SCRIP: one or more lat values are at the<br>
> (0)          poles, so calculating grid corners using<br>
> (0)          calc_SCRIP_corners_boundaries...<br>
> (0)   calc_SCRIP_corners_boundaries<br>
> (0)        min/max original lat: -90/-48.4644<br>
> (0)        min/max original lon: -179.983/180<br>
> <br>
> When you run the script, do you see the error message before this output or after?<br>
> <br>
> <br>
> 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.
<br>
> <br>
> 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.<br>
> <br>
> 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:<br>
> <br>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"<br>
> load "./curv_to_scrip.ncl"<br>
> <br>
> 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.<br>
> <br>
> [As I've been typing this email and trying things out, your script is still running without any errors.]<br>
> <br>
> Let ncl-talk know if you still see the problem with the new script.<br>
> <br>
> Thanks,<br>
> <br>
> --Mary<br>
> <br>
> <br>
> <br>
> On Tue, Feb 13, 2018 at 8:20 AM, Kuipers Munneke, P. (Peter) <P.KuipersMunneke@uu.nl> wrote:<br>
> Dear all,<br>
> <br>
> 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 <a href="https://www.ncl.ucar.edu/Applications/Scripts/ESMF_regrid_16.ncl">
https://www.ncl.ucar.edu/Applications/Scripts/ESMF_regrid_16.ncl</a>.<br>
> <br>
> 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.<br>
> <br>
> I would be very grateful for your help.<br>
> <br>
> With best regards,<br>
> Peter<br>
> <br>
> ============<br>
> <br>
> <br>
> - NCL version 6.4.0<br>
> <br>
> - Data files are available at <a href="http://www.staff.science.uu.nl/~kuipe117/ncl_debug">
http://www.staff.science.uu.nl/~kuipe117/ncl_debug</a><br>
> <br>
> - The exact error message is<br>
> <br>
> fatal:Variable (Opt) is undefined<br>
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 1613 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl<br>
> <br>
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 3912 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl<br>
> <br>
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 4042 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl<br>
> <br>
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 51 in file make_topogrid_debug.ncl<br>
> <br>
> - The system is Mac OS High Sierra 10.13.3<br>
> <br>
> uname -a gives:<br>
> <br>
> 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<br>
> <br>
> gcc —version gives:<br>
> <br>
> Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1<br>
> Apple LLVM version 9.0.0 (clang-900.0.39.2)<br>
> Target: x86_64-apple-darwin17.4.0<br>
> Thread model: posix<br>
> InstalledDir: /Library/Developer/CommandLineTools/usr/bin<br>
> <br>
> _______________________________________________<br>
> ncl-talk mailing list<br>
> ncl-talk@ucar.edu<br>
> List instructions, subscriber options, unsubscribe:<br>
> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
> <br>
> <br>
> <curv_to_scrip.ncl><br>
<br>
</div>
</span></font></div>
</body>
</html>