Error in running the executable: srgcreate

srg_grid_log.txt (229.2 KB)

Hi, I am trying to generate surrogates for a new domain. When I run the Surrogate tool using Java, I get the following error. For more details, I have also attached the log file as well.

How can I fix this error/warning? Any lead is appreciated.

Thanks
Sham

Run srgcreate.exe to generate surrogate ratios for CA_100: Population
SRGCREATE_ERROR>WARNING: Environment variable: MAX_LINE_SEG, not set
SRGCREATE_ERROR>WARNING: Environment variable: MAX_LINE_SEG, not set
SRGCREATE_ERROR>WARNING: Using from definition: argc=6
SRGCREATE_ERROR>WARNING: +proj=utm
SRGCREATE_ERROR>WARNING: +a=6370997.0
SRGCREATE_ERROR>WARNING: +b=6370997.0
SRGCREATE_ERROR>WARNING: +zone=18.000000
SRGCREATE_ERROR>WARNING: +x_0=0.000000
SRGCREATE_ERROR>WARNING: +y_0=0.000000
SRGCREATE_ERROR>WARNING: projection initialization failure: elliptical usage required
SRGCREATE_ERROR>WARNING: ERROR: in setting projection pj_init
SRGCREATE_ERROR>ERROR in …/bin/64bits/srgcreate.exe: Error setting PROJ.4 output projection. Exiting…
SRGCREATE_OUTPUT>Surrogate Creator Version 4.3, 01/20/2017
SRGCREATE_OUTPUT>
SRGCREATE_OUTPUT>EV: OUTPUT_FILE_TYPE=RegularGrid
SRGCREATE_OUTPUT>Setting output grid
SRGCREATE_OUTPUT>
SRGCREATE_OUTPUT>EV: OUTPUT_FILE_TYPE=RegularGrid
SRGCREATE_OUTPUT>Reading Regular Grid
SRGCREATE_OUTPUT>
SRGCREATE_OUTPUT>EV: OUTPUT_GRID_NAME=QC12_48X44
SRGCREATE_OUTPUT>MAX_LINE_SEG not set, discretization intervals disabled
SRGCREATE_OUTPUT>griddesc file name = ./GRIDDESC_Sham.txt
SRGCREATE_OUTPUT>
SRGCREATE_OUTPUT>Ellipsoid var = OUTPUT_FILE_ELLIPSOID
SRGCREATE_OUTPUT>EV: OUTPUT_FILE_ELLIPSOID=+a=6370997.0,+b=6370997.0
SRGCREATE_OUTPUT>Ellipsoid=+a=6370997.0,+b=6370997.0
SRGCREATE_OUTPUT>EV: OUTPUT_GRID_NAME=QC12_48X44
SRGCREATE_OUTPUT>Not using BB optimization
SRGCREATE_OUTPUT>
SRGCREATE_OUTPUT>EV: OUTPUT_FILE_NAME=…/output/QC_12km/grid_CA_100
SRGCREATE_OUTPUT>EV: WEIGHT_ATTR_LIST=POP
SRGCREATE_OUTPUT>EV: FILTER_FILE=NONE
SRGCREATE_OUTPUT>Filter File= NONE
SRGCREATE_OUTPUT>Reading data polygons
SRGCREATE_OUTPUT>
SRGCREATE_OUTPUT>EV: DATA_FILE_ELLIPSOID=+a=6370997.0,+b=6370997.0
SRGCREATE_OUTPUT>Ellipsoid=+a=6370997.0,+b=6370997.0
SRGCREATE_OUTPUT>EV: DATA_FILE_MAP_PRJN=+proj=lcc,+lat_1=33,+lat_2=45,+lat_0=40,+lon_0=-97
SRGCREATE_OUTPUT>EV: DATA_FILE_NAME_TYPE=ShapeFile
SRGCREATE_OUTPUT>EV: DATA_FILE_NAME=/home/smahagam/smoke/Spatial-Allocator/data/CA_shapefiles//gpr_gda_000a16a_e_sphere_3Nov2017

I believe that your error is being caused by an invalid projection string.
What I am not sure about, is how to correct it.

Run srgcreate.exe to generate surrogate ratios for CA_100: Population
SRGCREATE_ERROR>WARNING: Environment variable: MAX_LINE_SEG, not set
SRGCREATE_ERROR>WARNING: Environment variable: MAX_LINE_SEG, not set
SRGCREATE_ERROR>WARNING: Using from definition: argc=6
SRGCREATE_ERROR>WARNING: +proj=utm
SRGCREATE_ERROR>WARNING: +a=6370997.0
SRGCREATE_ERROR>WARNING: +b=6370997.0
SRGCREATE_ERROR>WARNING: +zone=18.000000
SRGCREATE_ERROR>WARNING: +x_0=0.000000
SRGCREATE_ERROR>WARNING: +y_0=0.000000
SRGCREATE_ERROR>WARNING: projection initialization failure: **elliptical usage required**
SRGCREATE_ERROR>WARNING: ERROR: in setting projection pj_init
SRGCREATE_ERROR>ERROR in ../bin/64bits/srgcreate.exe: Error setting PROJ.4 output projection. Exiting...

The error message seems to be related to this restriction that Proj4.6.0 only supports ellipsoids, not spheres.

DATA_FILE_MAP_PRJN=+proj=lcc,+lat_1=33,+lat_2=45,+lat_0=40,+lon_0=-97
SRGCREATE_OUTPUT>EV: DATA_FILE_NAME_TYPE=ShapeFile
SRGCREATE_OUTPUT>EV: DATA_FILE_NAME=/home/smahagam/smoke/Spatial-Allocator/data/CA_shapefiles//gpr_gda_000a16a_e_sphere_3Nov2017

Here is a relevant section of the Surrogate Tool user manual.

The Proj4.6.0 library is stored under the SA source code directory ($SA_HOME/src/libs). The PROJ4.6.0 library is used by the Srgcreate and Allocator programs to specify map projections and ellipsoids. NOTE: this new library supports datum transformation, but the old map projection called LATLON is no longer accepted, nor is the ellipsoid called SPHERE.

Spatial-Allocator/SA_ch03_vector.md at master · CMASCenter/Spatial-Allocator · GitHub

For VERDI, when reading CMAQ data, we assume the ellipsoid is NOT WGS84, it is unknown, and the radius assumed is 6370000.0,0.0, not 6370997.0. Shapefile Export of GRIDCRO2D_mercator · Issue #242 · CEMPD/VERDI · GitHub

Are you sure this setting is correct:
DATA_FILE_ELLIPSOID=+a=6370997.0,+b=6370997.0

I am not sure how much of an issue this may cause when surrogates are created on a different datum or ellipsoid than what WRF and MCIP use, and how your specification is failing for the proj4.6 version that is used by srgcreate.

Here is a link that may provide some insight.
https://proj.org/development/migration.html#background