Welcome to the new DiscussCESM forum!
We are still working on the website migration, so you may experience downtime during this process.

Existing users, please reset your password before logging in here: https://xenforo.cgd.ucar.edu/cesm/index.php?lost-password/

(gridmap_map_read) ERROR: frac_src out of bounds

majun

Member
Hi,
With your kind help, I have ran a single point case using clm5.0 successfully. However, when I want to create a regional case, sth went wrong in the surface data creating process:(gridmap_map_read) ERROR: frac_src out of bounds

My esmf version is 7_1_0 (I also tried esmf_8_0_0 but in vain), and the process is as follows:
(1)./mknoocnmap.pl -p 30.5,114.4 -n 40x30_wh -ny 30 -dy 3 -nx 40 -dx 4
(2)./mkmapdata.sh -r 40x30_wh -f /home/shenhf/majun/clm5.0/tools/mkmapgrids/SCRIPgrid_40x30_wh_nomask_c200502.nc
(3)./gen_domain -m /home/shenhf/majun/clm5.0/tools/mkmapdata/map_40x30_wh_noocean_to_40x30_wh_nomask_aave_da_200502.nc -o domain.ocn_noocean.nc -l domain.lnd.40x30_wh_noocean.nc
(4)./mksurfdata.pl -r usrspec -usr_gname 40x30_wh -usr_gdate 200502, error shows:
(gridmap_map_read) reading mapping matrix data...
(gridmap_map_read) * file name : ../mkmapdata/map_0.25x0.25_MODIS_to_40x30_wh_nomask_aave_da_c200503.nc
* matrix dimensions rows x cols : 1036800 x 1200
* number of non-zero elements: 2796
(gridmap_map_read) ERROR: frac_src out of bounds
max = 2.0000000000014433 min = 0.0000000000000000
Do you know how to solve this problem? Any suggestion or hint is highly appreciated.
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
You could try running this tool that is bundled with NCL on your SCRIP file:

scrip_check_input SCRIPgrid_40x30_wh_nomask_c200502.nc

If it reports errors regarding the direction that the vertices are defined, then you could try the following code modification to

tools/mkmapgrids/mkscripgrid.ncl

Replace line 130:

lonCorners(j,:,3) = lonCenters + delX/2.d0;

with this:

lonCorners(j,:,3) = lonCenters - delX/2.d0;

And then rerun ./mknoocnmap.pl to create a new SCRIP file.
 

majun

Member
You could try running this tool that is bundled with NCL on your SCRIP file:

scrip_check_input SCRIPgrid_40x30_wh_nomask_c200502.nc

If it reports errors regarding the direction that the vertices are defined, then you could try the following code modification to

tools/mkmapgrids/mkscripgrid.ncl

Replace line 130:

lonCorners(j,:,3) = lonCenters + delX/2.d0;

with this:

lonCorners(j,:,3) = lonCenters - delX/2.d0;

And then rerun ./mknoocnmap.pl to create a new SCRIP file.
You could try running this tool that is bundled with NCL on your SCRIP file:

scrip_check_input SCRIPgrid_40x30_wh_nomask_c200502.nc

If it reports errors regarding the direction that the vertices are defined, then you could try the following code modification to

tools/mkmapgrids/mkscripgrid.ncl

Replace line 130:

lonCorners(j,:,3) = lonCenters + delX/2.d0;

with this:

lonCorners(j,:,3) = lonCenters - delX/2.d0;

And then rerun ./mknoocnmap.pl to create a new SCRIP file.
Thanks for your reply. However, when I use :scrip_check_input SCRIPgrid_40x30_wh_nomask_c200502.nc , it shows fine:
(0) scrip_check_input - cell centers inside cells test
(0) completed, no errors.
When I changed line 130 in mkscripgrid.ncl, then use :scrip_check_input SCRIPgrid_40x30_wh1_nomask_c200508.nc it turns wrong:
(0) scrip_check_input - The center point for the cell with the
(0) following cell index is not within or on
(0) the cell boundary: 1199

In addition, I opened mkscripgrid.ncl in line 112/113, it shows as follows: does it matter?(my ncl version is 6.3.0)
109 delX = (lonE - lonW) / int2dble(nx);
110 delY = (latN - latS) / int2dble(ny);
111
112 lonCenters = fspan1up( (lonW + delX/2.d0), (lonE - delX/2.d0), nx)
113 latCenters = fspan1up( (latS + delY/2.d0), (latN - delY/2.d0), ny)

114 lon = new( (/ny, nx/), "double" );
115 lat = new( (/ny, nx/), "double" );
116 lonCorners = new( (/ny, nx, 4/), "double" );
117 latCorners = new( (/ny, nx, 4/), "double" );
118 do i = 0, nx-1
119 lat(:,i) = latCenters;
120 latCorners(:,i,0) = latCenters - delY/2.d0;
121 latCorners(:,i,1) = latCenters + delY/2.d0;
122 latCorners(:,i,2) = latCenters + delY/2.d0;
123 latCorners(:,i,3) = latCenters - delY/2.d0;
124 end do
125 do j = 0, ny-1
126 lon(j,:) = lonCenters;
127 lonCorners(j,:,0) = lonCenters - delX/2.d0;
128 lonCorners(j,:,1) = lonCenters - delX/2.d0;
129 lonCorners(j,:,2) = lonCenters + delX/2.d0;
130 lonCorners(j,:,3) = lonCenters + delX/2.d0
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
Is that the only output from scrip_check_input? Please attach all output from running this command.
 

majun

Member
Is that the only output from scrip_check_input? Please attach all output from running this command.
Copyright (C) 1995-2015 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 6.3.0
The use of this software is governed by a License Agreement.
See NCAR Command Language (NCL) for more details.
(0) scrip_check_input - The corner points for cells with the
(0) following indices are not listed in
(0) counterclockwise order:
(0) 0
(1) 1
(2) 2
(3) 3
(4) 4
.....
(1193) 1193
(1194) 1194
(1195) 1195
(1196) 1196
(1197) 1197
(1198) 1198
(1199) 1199
(0) scrip_check_input - cell centers inside cells test
(0) completed, no errors
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
The output indicates that the corner points aren't listed in counterclockwise order, and esmf requires them to be.
The information I was provided to fix this was incomplete.
You could replace these lines in mkscripgrid.ncl:

lonCorners(j,:,0) = lonCenters - delX/2.d0;
lonCorners(j,:,1) = lonCenters - delX/2.d0;
lonCorners(j,:,2) = lonCenters + delX/2.d0;
lonCorners(j,:,3) = lonCenters + delX/2.d0;

with these lines:

lonCorners(j,:,0) = lonCenters + delX/2.d0;
lonCorners(j,:,1) = lonCenters + delX/2.d0;
lonCorners(j,:,2) = lonCenters - delX/2.d0;
lonCorners(j,:,3) = lonCenters - delX/2.d0;

and then rerun ./mknoocnmap.pl and re-create the mapping files.

However, I've now run through this whole process myself on our machine and am getting the same error with frac_srf you get when running ./mksurfdata.pl, even after fixing the SCRIP file.
AT the moment I'm out of ideas on this.
Maybe someone else can help.
 

majun

Member
The output indicates that the corner points aren't listed in counterclockwise order, and esmf requires them to be.
The information I was provided to fix this was incomplete.
You could replace these lines in mkscripgrid.ncl:

lonCorners(j,:,0) = lonCenters - delX/2.d0;
lonCorners(j,:,1) = lonCenters - delX/2.d0;
lonCorners(j,:,2) = lonCenters + delX/2.d0;
lonCorners(j,:,3) = lonCenters + delX/2.d0;

with these lines:

lonCorners(j,:,0) = lonCenters + delX/2.d0;
lonCorners(j,:,1) = lonCenters + delX/2.d0;
lonCorners(j,:,2) = lonCenters - delX/2.d0;
lonCorners(j,:,3) = lonCenters - delX/2.d0;

and then rerun ./mknoocnmap.pl and re-create the mapping files.

However, I've now run through this whole process myself on our machine and am getting the same error with frac_srf you get when running ./mksurfdata.pl, even after fixing the SCRIP file.
AT the moment I'm out of ideas on this.
Maybe someone else can help.
I followed your tips, it successfully create surface datasets. I can't express my gratitude,thank you so so much!
 

majun

Member
I followed your tips, it successfully create surface datasets. I can't express my gratitude,thank you so so much!
Hi, Pro.oleson,
There is one question . With your help, it worked and successfully created regional outputs of clm5.0. However, when I opened the output file , I found it listed in 40x30, i.e.40 rows and 30 columns (with command:./mknoocnmap.pl -p 30.5,114.4 -n 40x30_wh -nx 40 -ny 30 -dx 4 -dy 3).
In fact, the study region is 30 rows, 40columns. Should I use the command:-nx 30 -ny 40 -dx 4 -dy 3 or just transpose the matrix? To be honest, I don't quite understand the meaning of nx/dx and the realationship between nx and dx.
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
./mknoocnmap.pl --help

SYNOPSIS
mknoocnmap.pl [options] Gets map and grid files for a single land-only point.
REQUIRED OPTIONS
-centerpoint [or -p] <lat,lon> Center latitude,longitude of the grid to create.
-name [-or -n] <name> Name to use to describe point

OPTIONS
-dx <number> Size of total grid in degrees in longitude direction
(default is 0.1)
-dy <number> Size of total grid in degrees in latitude direction
(default is 0.1)
-silent [or -s] Make output silent
-help [or -h] Print usage to STDOUT.
-verbose [or -v] Make output more verbose.
-nx <number> Number of longitudes (default is 1)
-ny <number> Number of latitudes (default is 1)

So I would think your process would have created a surface dataset with 40 columns and 30 rows. The total size of the grid should be 4 degrees in longitude and 3 degrees in latitude. Each grid cell should then be 0.1 X 0.1 degrees.
 

majun

Member
./mknoocnmap.pl --help

SYNOPSIS
mknoocnmap.pl [options] Gets map and grid files for a single land-only point.
REQUIRED OPTIONS
-centerpoint [or -p] <lat,lon> Center latitude,longitude of the grid to create.
-name [-or -n] <name> Name to use to describe point

OPTIONS
-dx <number> Size of total grid in degrees in longitude direction
(default is 0.1)
-dy <number> Size of total grid in degrees in latitude direction
(default is 0.1)
-silent [or -s] Make output silent
-help [or -h] Print usage to STDOUT.
-verbose [or -v] Make output more verbose.
-nx <number> Number of longitudes (default is 1)
-ny <number> Number of latitudes (default is 1)

So I would think your process would have created a surface dataset with 40 columns and 30 rows. The total size of the grid should be 4 degrees in longitude and 3 degrees in latitude. Each grid cell should then be 0.1 X 0.1 degrees.
yeah, I have read the help. I want it to be 40 columns and 30 rows, however I opened the output netcdf file, it is listed as 40 rows and 30 columns, so is the problme tha I modified mkscripgrid.ncl aforementioned?
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
I don't think modifying mkscripgrid.ncl would cause that. But I can't replicate your process here so I can't confirm that.
 
Top