[ncl-talk] Fw: lintint2_points

Ehsan Taghizadeh ehsantaghizadeh at yahoo.com
Wed Feb 14 14:41:15 MST 2018


 Dears,I've just tried to run the attached script (which is written by Dennis). After about 1 hour I've got following error:

(0)     =====> CPU Elapsed Time: curvilinear_to_SCRIP: 1.12063 seconds <=====(0)     =====> CPU Elapsed Time: latlon_to_SCRIP: 13.2744 seconds <=====(0)     ESMF_regrid_gen_weights: 'ESMF_RegridWeightGen' was not successful.
Also I've attached PET0.RegridWeightGen.Log, which is produced after run this script.I'll be thankful for any recommendation.
Sincerely
Ehsan    On Wednesday, February 14, 2018, 11:21:21 PM GMT+3:30, Mary Haley <haley at ucar.edu> wrote:  
 
 Dear Ehsan,
I was able to run Dennis' attached script under NCL 6.4.0 on one system, but not on another.  It is ESMF_RegridWeightGen that's the issue, and not NCL.
Before I provide you with a new binary, can you please try Dennis' script with your current version of NCL. If it doesn't work, send email back to ncl-talk and include any error messages and the 
PET0.RegridWeightGen.Log file.
Before you run the script, you will need to add this line to the top of it, or it won't run:
load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"
Also, I think there are some hard-coded paths to Dennis' directories that you will need to fix in order to have it point to your own files.
--Mary

On Wed, Feb 7, 2018 at 4:14 AM, Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com> wrote:

 
I appreciate your helpful replies.
Outputs are:
%> uname -aLinux localhost.localdomain 3.10.0-693.11.6.el7.x86_64 #1 SMP Thu Jan 4 01:06:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

%> gcc --versiongcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)Copyright (C) 2015 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
SincerelyEhsan    On Wednesday, February 7, 2018, 7:42:22 AM GMT+3:30, Dennis Shea <shea at ucar.edu> wrote:  
 
 Inadvertently, I used the 6.5 0 version of NCL to perform the ESMF interpolation. 
As you indicated offline, the 6.4.0 ESMF interpolation was not successful. 
-----
(0)     ESMF_regrid_gen_weights: 'ESMF_RegridWeightGen' was not successful.
-----

Likely there were some changes to the underlying ESMF software.

-----
Perhaps, the NCL developers can make a beta version of NCL 6.5.0 available.

Please send ncl-talk at ucar.edu the output from:

%> uname -a
%> gcc --version

----



On Mon, Feb 5, 2018 at 8:49 PM, Dennis Shea <shea at ucar.edu> wrote:

The script you sent had numerous issues. It looks like you copy-and-pasted parts of scripts. Please be more careful.

Please 

[1] Carefully read the documentation of any function. 
[2] Always use printVarSummary(...) and look at the varuable overview. It is your responsibility to examine the output. 
[3] Carefully examine any error messages. Think about what is be communicated. For example, your previous email had:

fatal:(lat2d) is not a named dimension in variable (var).fatal:["Execute.c":8640]:Execu te: Error occurred at or near line .......
Well, did you see any dimension named 'lat2d'? There was a variable named that but not a named dimension.


For your benefit, I suggest that you spend some time examining the NCL User Guide (NUG). 
The NUG was created by Karin Meier-Fleischer and MichaelBöttinger of DKRZ (DeutschesKlimarechenzentrum). 

https://www.ncl.ucar.edu/ Document/Manuals/NCL_User_ Guide/

===
Attached is a modification of the script you sent. It has many print statements. See [2] above.
It contains the interpolated values where possible. As noted in the 'linint2_points documentation:

"if missing values are present, then linint2_pointswill perform the piecewise linear interpolation at all pointspossible, but will return missing values at coordinates which couldnot be used. If one or more of the four closest grid pointsto a particular (xo,yo) coordinate pair are missing,then the return value for this coordinate pair will be missing."

It looks like there are ?bogus? or island values of soil moisture in ocean areas.
Interpolation is not performed across adjacent swaths. 

A sample of the interpolated points:

(0)     >>> yyyymmdd: 20170401 after ESMF Regrid <<<
(0)     ****************************** ******************
(0)      35.70   50.06  -9999.00
(1)      36.67   46.73    0.11
(2)      34.75   46.15    0.22
(3)      34.77   50.86  -9999.00   < not surrounded by 4 non-missing avlues.
(4)      35.67   51.02  -9999.00
(5)      35.20   48.69  -9999.00
(6)      37.32   49.62  -9999.00
(7)      35.25   47.01    0.22
(8)      36.02   50.54  -9999.00
(9)      36.54   50.21  -9999.00
(10)     38.42   44.97    0.19
(11)     36.65   49.19  -9999.00
(12)     34.87   48.53  -9999.00
(13)     36.66   48.52  -9999.00
(14)     37.48   49.46  -9999.00
(15)     37.97   46.03    0.16
(16)     37.50   45.85    0.18
(17)     38.22   48.33    0.16
(18)     38.93   45.60    0.15
(19)     37.66   45.06    0.19
(20)     34.35   47.15    0.29
[SNIP]






On Mon, Feb 5, 2018 at 8:57 AM, Mary Haley <haley at ucar.edu> wrote:

You are treating "lat2d" and "lon2d" like coordinate arrays with the following call:
    curvilinear_to_SCRIP(srcGridNa me,var&lat2d,var&lon2d,Opt)
​These two variables are NOT attached to var, and they couldn't be anyway, because they violate the rule that coordinate arrays be one-dimensional.
lat2d and lon2d are standalone variables that you read off a file earlier in your script, so you simply want:
​    curvilinear_to_SCRIP(srcGridNa me,lat2d,lon2d,Opt)
--Mary





On Mon, Feb 5, 2018 at 5:05 AM, Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com> wrote:

 Dear NCL users,I've modified the script and I have some problems with it, yet.New outputs and errors are:
Variable: lat2dType: floatTotal Size: 1565536 bytes            391384 valuesNumber of Dimensions: 2Dimensions and sizes:   [DIM_000 | 406] x [DIM_001 | 964]Coordinates:Number Of Attributes: 2  long_name :   Latitude of the center of the Earth based grid cell.  units :       degrees_north
Variable: lon2dType: floatTotal Size: 1565536 bytes            391384 valuesNumber of Dimensions: 2Dimensions and sizes:   [DIM_000 | 406] x [DIM_001 | 964]Coordinates:Number Of Attributes: 2  long_name :   Longitude of the center of the Earth based grid cell.  units :       degrees_east
Variable: varType: floatTotal Size: 1565536 bytes            391384 valuesNumber of Dimensions: 2Dimensions and sizes:   [DIM_000 | 406] x [DIM_001 | 964]Coordinates:Number Of Attributes: 6  _FillValue :  -9999  coordinates : /Soil_Moisture_Retrieval_Data_ AM/latitude /Soil_Moisture_Retrieval_Data_ AM/longitude  long_name :   Representative soil moisture measurement for the Earth based grid cell.  units :       cm**3/cm**3  valid_max :   0.5  valid_min :   0.02fatal:(lat2d) is not a named dimension in variable (var).fatal:["Execute.c":8640]:Execu te: Error occurred at or near line 101 in file 2_SPL3SMP_E_Interpolating1.ncl
I'll be thankful if I could have your help.
SincerelyEhsan Taghizadeh    On Sunday, February 4, 2018, 3:32:14 PM GMT+3:30, Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com> wrote:  
 
  Dear DennisThank you so much for you help.I've changed my script to attached one by adding lines 79-91, however it seems to have some basic problems! Could I ask help me about them, please? I faced following errors:
fatal:syntax error: line 87 in file 2_SPL3SMP_E_Interpolating1.ncl before or near \n    curvilinear_to_SCRIP(src_file, var&LAT,var&LON,Opt)------------------------------ -------------------------^
fatal:syntax error: possibly an undefined procedurefatal:syntax error: line 88 in file 2_SPL3SMP_E_Interpolating1.ncl before or near \n        latlon_to_SCRIP(dstGridName,"5 x5",Opt)------------------------------ ----------^
fatal:syntax error: possibly an undefined procedurefatal:syntax error: line 89 in file 2_SPL3SMP_E_Interpolating1.ncl before or near \n        ESMF_regrid_gen_weights(src_fi le,dstGridName,wgtFileName,Opt )------------------------------ ------------------------------ ---^
fatal:syntax error: possibly an undefined procedurefatal:Syntax Error in block, block not executedfatal:error at line 126 in file 2_SPL3SMP_E_Interpolating1.ncl

SincerelyEhsan
    On Tuesday, January 30, 2018, 7:34:40 AM GMT+3:30, Dennis Shea <shea at ucar.edu> wrote:  
 
 [1] As noted in the documentation, linint2_points Interpolates from a *rectilinear grid* to a user specified set of points usingbilinear interpolation.

     http://www.ncl.ucar.edu/Docume nt/Functions/Built-in/linint2_ points.shtml

[2] The SMAP data are on a *curvilinear* grid: [DIM_000 | 406] x [DIM_001 | 964] . Hence, 'linint2_points'  will not work.

[3] I suggest that you 
     (a) use ESMF regridding to interpolate from the curvilinear grid to a rectilinear grid of approximately the same resolution.
     (b) then use linint2_points on (3a)

===
See the NARR Example 5. NARR uses a curvilinear grid. Create an SMAP ESMF weight file [eg: ESMF eamaple 30) ; Use the weight file to generate a rectilinear grid; use linint2_points.

 http://www.ncl.ucar.edu/Appli cations/narr.shtml

Good luck
       


On Mon, Jan 29, 2018 at 9:23 AM, Ehsan Taghizadeh via ncl-talk <ncl-talk at ucar.edu> wrote:

 Hi,
I want to interpolate soil moisture data from SMAP (Soil Moisture Ative/Passive) to some specified locations (in stations_NW.csv attached file). Some information of data are as belows.
printVarSummary(lat2d)
Variable: lat2dType: floatTotal Size: 1565536 bytes            391384 valuesNumber of Dimensions: 2Dimensions and sizes:   [DIM_000 | 406] x [DIM_001 | 964]Coordinates:Number Of Attributes: 2  long_name :   Latitude of the center of the Earth based grid cell.  units :       degrees_north
printVarSummary(lon2d)
Variable: lon2dType: floatTotal Size: 1565536 bytes            391384 valuesNumber of Dimensions: 2Dimensions and sizes:   [DIM_000 | 406] x [DIM_001 | 964]Coordinates:Number Of Attributes: 2  long_name :   Longitude of the center of the Earth based grid cell.  units :       degrees_east
printVarSummary(var):
Variable: varType: floatTotal Size: 1565536 bytes            391384 valuesNumber of Dimensions: 2Dimensions and sizes:   [DIM_000 | 406] x [DIM_001 | 964]Coordinates:Number Of Attributes: 6  _FillValue :  -9999  coordinates : /Soil_Moisture_Retrieval_Data_ AM/latitude /Soil_Moisture_Retrieval_Data_ AM/longitude  long_name :   Representative soil moisture measurement for the Earth based grid cell.  units :       cm**3/cm**3  valid_max :   0.5  valid_min :   0.02
However I've faced below error:
fatal:(lon) is not a dimension name in variable (var), could not determine dimension number

I searched in google and I found may be "There is no 'lon' dimension name. In fact, there are no latitude/longitude coordinates on the file at all."
So I used following line:    SMAP_fo = linint2_points(lon2d,lat2d, var(DIM_000 | :, DIM_001 | :), False , lon_NW, lat_NW, 0)
instead of:    SMAP_fo = linint2_points(lon2d,lat2d, var(lat | :, lon | :), False , lon_NW, lat_NW, 0)
and after that I faced following error:fatal:linint2_points: If xi is not one-dimensional, then it must have one less dimension than fi

After that I added following lines to the script:    lat1d = ndtooned(lat2d)    lon1d = ndtooned(lon2d)
Again I had following error:fatal:linint2_points: The rightmost dimensions of fi must be nyi x nxi, where nyi and nxi are the lengths of yi and xi respectively

And here I'm not sure about what I've done.I've attached the script, stations_NW.csv (input for unstructured points) and links.txt (which contains links for downloading SMAP data. Sorry about that but I couldn't attach SMAP files, because of their sizes. However to download them it is necessary to have earthdata user name!).
I'll be thankful if I could have your help, again.
SincerelyEhsan
    
______________________________ _________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/ mailman/listinfo/ncl-talk



    
______________________________ _________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailma n/listinfo/ncl-talk




______________________________ _________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailma n/listinfo/ncl-talk





  
______________________________ _________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/ mailman/listinfo/ncl-talk



  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180214/221ad246/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PET0.RegridWeightGen.Log
Type: application/octet-stream
Size: 154 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180214/221ad246/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2_SPL3SMP_E_Interpolating3.ncl
Type: application/octet-stream
Size: 8529 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180214/221ad246/attachment-0001.obj>


More information about the ncl-talk mailing list