Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Projection issues for rc.4 and rc.5 releases #70

Open
openSourcerer9000 opened this issue Jun 2, 2022 · 9 comments
Open

Projection issues for rc.4 and rc.5 releases #70

openSourcerer9000 opened this issue Jun 2, 2022 · 9 comments

Comments

@openSourcerer9000
Copy link

openSourcerer9000 commented Jun 2, 2022

So I'm getting a weird issue with v rc.4 where it's writing the horizontal units for Albers SHG as 'metre', as opposed to 'Meters', as previous versions have done.
image

The problem is, when using this precipitation DSS into HEC-RAS, it hits a runtime error from PROJ complaining about an invalid linear unit, as shown at the bottom of this issue. I'm not sure how PROJ has an issue with 'metre', but it causes this issue.

So I upgraded to the new v rc.5 to try again, and now the Importer example Jython script stopped working:
type object 'mil.army.usace.hec.vortex.geo.WktFactory' has no attribute 'shg'

This is the PROJ error when using the rc.4 'metre' DSS:

Writing Event Conditions ...
 
ERROR 1: PROJ: proj_as_wkt: cannot convert value to target linear unit
ERROR 1: PROJ: proj_create: Error -7: unknown unit conversion id
ERROR 6: Cannot find coordinate operations from `PROJCRS["USA_Contiguous_Albers_Equal_Area_Conic_USGS_version",BASEGEOGCRS["NAD83",DATUM["North American Datum 1983",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]],ID["EPSG",6269]],PRIMEM["Greenwich",0,ANGLEUNIT["Degree",0.0174532925199433]]],CONVERSION["unnamed",METHOD["Albers Equal Area",ID["EPSG",9822]],PARAMETER["Latitude of false origin",23,ANGLEUNIT["Degree",0.0174532925199433],ID["EPSG",8821]],PARAMETER["Longitude of false origin",-96,ANGLEUNIT["Degree",0.0174532925199433],ID["EPSG",8822]],PARAMETER["Latitude of 1st standard parallel",29.5,ANGLEUNIT["Degree",0.0174532925199433],ID["EPSG",8823]],PARAMETER["Latitude of 2nd standard parallel",45.5,ANGLEUNIT["Degree",0.0174532925199433],ID["EPSG",8824]],PARAMETER["Easting at false origin",0,LENGTHUNIT["metre",0],ID["EPSG",8826]],PARAMETER["Northing at false origin",0,LENGTHUNIT["metre",0],ID["EPSG",8827]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",0]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",0]]]' to `PROJCRS["NAD83(2011) / Louisiana South (ftUS)",BASEGEOGCRS["NAD83(2011)",DATUM["NAD83 (National Spatial Reference System 2011)",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]],ID["EPSG",1116]],PRIMEM["Greenwich",0,ANGLEUNIT["Degree",0.0174532925199433]]],CONVERSION["unnamed",METHOD["Lambert Conic Conformal (2SP)",ID["EPSG",9802]],PARAMETER["Latitude of false origin",28.5,ANGLEUNIT["Degree",0.0174532925199433],ID["EPSG",8821]],PARAMETER["Longitude of false origin",-91.3333333333333,ANGLEUNIT["Degree",0.0174532925199433],ID["EPSG",8822]],PARAMETER["Latitude of 1st standard parallel",30.7,ANGLEUNIT["Degree",0.0174532925199433],ID["EPSG",8823]],PARAMETER["Latitude of 2nd standard parallel",29.3,ANGLEUNIT["Degree",0.0174532925199433],ID["EPSG",8824]],PARAMETER["Easting at false origin",3280833.3333,LENGTHUNIT["US survey foot",0.304800609601219],ID["EPSG",8826]],PARAMETER["Northing at false origin",0,LENGTHUNIT["US survey foot",0.304800609601219],ID["EPSG",8827]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["US survey foot",0.304800609601219]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["US survey foot",0.304800609601219]]]'
Processing Precipitation data...
   (assumes geometry data is geo-referenced)
ERROR 1: PROJ: proj_as_wkt: cannot convert value to target linear unit
ERROR 1: PROJ: proj_create: Error -7: unknown unit conversion id
ERROR 6: Cannot find coordinate operations from `PROJCRS["USA_Contiguous_Albers_Equal_Area_Conic_USGS_version",BASEGEOGCRS["NAD83",DATUM["North American Datum 1983",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]],ID["EPSG",6269]],PRIMEM["Greenwich",0,ANGLEUNIT["Degree",0.0174532925199433]]],CONVERSION["unnamed",METHOD["Albers Equal Area",ID["EPSG",9822]],PARAMETER["Latitude of false origin",23,ANGLEUNIT["Degree",0.0174532925199433],ID["EPSG",8821]],PARAMETER["Longitude of false origin",-96,ANGLEUNIT["Degree",0.0174532925199433],ID["EPSG",8822]],PARAMETER["Latitude of 1st standard parallel",29.5,ANGLEUNIT["Degree",0.01745329
```25199433],ID["EPSG",8823]],PARAMETER["Latitude of 2nd standard parallel",45.5,ANGLEUNIT["Degree",0.0174532925199433],ID["EPSG",8824]],PARAMETER["Easting at false origin",0,LENGTHUNIT["metre",0],ID["EPSG",8826]],PARAMETER["Northing at false origin",0,LENGTHUNIT["metre",0],ID["EPSG",8827]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",0]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",0]]]' to `PROJCRS["NAD83(2011) / Louisiana South (ftUS)",BASEGEOGCRS["NAD83(2011)",DATUM["NAD83 (National Spatial Reference System 2011)",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]],ID["EPSG",1116]],PRIMEM["Greenwich",0,ANGLEUNIT["Degree",0.0174532925199433]]],CONVERSION["unnamed",METHOD["Lambert Conic Conformal (2SP)",ID["EPSG",9802]],PARAMETER["Latitude of false origin",28.5,ANGLEUNIT["Degree",0.0174532925199433],ID["EPSG",8821]],PARAMETER["Longitude of false origin",-91.3333333333333,ANGLEUNIT["Degree",0.0174532925199433],ID["EPSG",8822]],PARAMETER["Latitude of 1st standard parallel",30.7,ANGLEUNIT["Degree",0.0174532925199433],ID["EPSG",8823]],PARAMETER["Latitude of 2nd standard parallel",29.3,ANGLEUNIT["Degree",0.0174532925199433],ID["EPSG",8824]],PARAMETER["Easting at false origin",3280833.3333,LENGTHUNIT["US survey foot",0.304800609601219],ID["EPSG",8826]],PARAMETER["Northing at false origin",0,LENGTHUNIT["US survey foot",0.304800609601219],ID["EPSG",8827]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["US survey foot",0.304800609601219]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["US survey foot",0.304800609601219]]]'
Error processing data: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Error processing Precipitation data, exiting...
Error processing event conditions
@openSourcerer9000 openSourcerer9000 changed the title Projection issues for cr.4 and cr.5 releases Projection issues for rc.4 and rc.5 releases Jun 2, 2022
@tombrauer
Copy link
Collaborator

On the WktFactory.shg issue, I refactored that to WktFactory.getShg in v0.10.28-rc.5. If you use WktFactory.getShg it should work. I'll add WktFactory.shg back in to maintain the API.

@openSourcerer9000
Copy link
Author

openSourcerer9000 commented Jun 2, 2022

Great, thanks. I tested on rc.3 and it had the same 'metre' quirk, rolling back to 10.27 it generated them correctly.

I believe the units in the Albers WKT are actually supposed to be 'metre', so it's bizarre that PROJ is finding issue with it.

@tombrauer
Copy link
Collaborator

I created a new version that adds WktFactory::shg back into the API. Test v0.10.28-rc.6

I also tested v0.10.28-rc.5 and only observed AlbersInfo/SHG grids being written with projection units as "Meter".
image
Please test with the latest version and share your findings.

@openSourcerer9000
Copy link
Author

I tried the latest version and actually wasn't able to get it working at all.

Importer just creates a blank DSS and then after a while prints out
DSS File inactivity time out; file released
over and over until I kill the process.

@tombrauer
Copy link
Collaborator

Which DSS file version are you writing to?

@openSourcerer9000
Copy link
Author

Whatever the default is, I'm just letting it create a new one (using Jython, it seems you need to create your own blank DSS when running the standalone GUI, while through Jython or the version bundled in HEC HMS I don't think you have that issue.)

@danhamill
Copy link
Collaborator

I saw the behavior where the importer failed to open the dss file. I was not that good at tracking down what exactly caused it, but I would see vortex is waiting for a file handle and got stuck. I was also asking vortex to create a new dss file. I got around the issue by initializing the dss file before I ran importer.

When using the jython scripting, I usually add an extra step to the batch file to create the dss files using the DSS jython api.

Batch file

echo "Creating blank DSS files..."
C:\jython2.7.2\bin\jython.exe -Djava.library.path="C:\Local_Software\HEC-DSSVue 3.2.3\lib" C:\workspace\Chinle\scripts\vortex\intialize_dss_v6.py

echo "Writing Grids to file..."
set "VORTEX_HOME=C:\Local_Software\vortex-0.10.28-rc.6"
set "PATH=%VORTEX_HOME%\bin;%VORTEX_HOME%\bin\gdal;%PATH%"
set "GDAL_DRIVER_PATH=%VORTEX_HOME%\bin\gdal\gdalplugins"
set "GDAL_DATA=%VORTEX_HOME%\bin\gdal\gdal-data"
set "PROJ_LIB=%VORTEX_HOME%\bin\gdal\projlib"
set "CLASSPATH=%VORTEX_HOME%\lib\*"
C:\jython2.7.2\bin\jython.exe -Djava.library.path=%VORTEX_HOME%\bin;%VORTEX_HOME%\bin\gdal C:\workspace\Chinle\scripts\vortex\import_metsim.py
cmd /k

intialize_dss_v6.py

import sys
sys.path.append(r"C:\Local_Software\HEC-DSSVue 3.2.3\jar\sys\jythonUtils.jar")
sys.path.append(r"C:\Local_Software\HEC-DSSVue 3.2.3\jar\hec.jar")
sys.path.append(r"C:\Local_Software\HEC-DSSVue 3.2.3\jar\jython-standalone-2.7.0.jar")
sys.path.append(r"C:\Local_Software\HEC-DSSVue 3.2.3\jar\hec-dssvue-3.2.3.jar")
sys.path.append(r"C:\Local_Software\HEC-DSSVue 3.2.3\jar\rma.jar")

try:
    from hec.heclib.dss import HecDss
    from hec.io import TimeSeriesContainer
    print 'Sucessfully found DSS API'
except:
    print 'import from DSS failed'

import os
from glob import glob


files = ['Chinle_MetSim_GridMET_30Mins.dss']

for file in files:

    root = r'C:\workspace\Chinle\output'

    dss_file = root + os.sep + file
    fid = HecDss.open(dss_file,6)
    fid.close()
    del fid

@tombrauer
Copy link
Collaborator

There is a bug in the javaHeclib v7-HK dependency. When writing to DSS v7, the library enters multi-user access mode and gets bogged down to the point records are never written. I'm updating the dependency now. I'll comment here when a new build is ready.

@tombrauer
Copy link
Collaborator

The library update is in v0.10.28-rc.7. With the library update to javaHeclib 7-IG you should be able to preform sequential write to DSS v7 as well as DSS v6 files. If no file exists, a DSS v7 file will be created by default. Please test in the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants