SGrid Reader error understanding

Hi,

I just downloaded [so I haven’t looked at the code yet] - do you think with some work this would end up being readable -:-1:

J:\ogs-6.4.1-79-g69a2996020-Windows-10.0.19043-python-3.8.2-utils\bin>GocadSGridReader.exe -s SA_Geophysics_Reference_Model_SGrid.sg -o SA_Geophysics_Reference_Model.vtu
    [2021-11-01 18:43:01.438] [ogs] [info] Start reading Gocad SGrid.
    [2021-11-01 18:43:04.119] [ogs] [error] readBinaryArray(): Error while reading from file 
'SA_Geophysics_Reference_Model_SGrid_Gravity_Inversion_Unconstrained@@'.
    [2021-11-01 18:43:04.119] [ogs] [error] Read different number of values. Expected 7992586, got 1315930.
    [2021-11-01 18:43:04.121] [ogs] [error] Reading of element properties file 'SA_Geophysics_Reference_Model_SGrid_Gravity_Inversion_Unconstrained@@' failed.
    [2021-11-01 18:43:04.199] [ogs] [error] readBinaryArray(): Error while reading from file 'SA_Geophysics_Reference_Model_SGrid_Magnetic_Inversion_Unconstrained@@'.
    [2021-11-01 18:43:04.200] [ogs] [error] Read different number of values. Expected 7992586, got 1314778.

Or just a different format (looks like there is an associated project) - and not much to be done?

Thanks very much,

Richard

Hi Richard,

difficult to say without looking into the file. If you would upload a sgrid file as small as possible showing same error, we could look into the details.

For the error, it looks like the two arrays Gravity_Inversion_Unconstrained and Magnetic_Inversion_Unconstrained are somehow truncated. I don’t exclude an error in the reader though.

If I remember correctly, there were many special cases in that format, and so far we have implemented only the most basic parts which were needed for a project.

– d

Thanks Dmitri - I will doublecheck that it has downloaded and extracted properly, lots of Windows related malware and other scanners ruining things like that recently and then get back to you. The whole archive for that SGrid - with the model and the multiple inversion layers etc. would be probably 100MB or so though.

As part of here, but unfortunately you can’t download it separately. If the redownload matches, will upload later.

https://sarigbasis.pir.sa.gov.au/WebtopEw/ws/samref/sarig1/wcir/Record;jsessionid=ED2E0F88F40ED19BB774E13EBA5F1FFB

I figured that do the bit you need for your domain case was likely. Annoyingly, this is taxpayer funded and could have been at least ascii or something like that.

I have uploaded to drive SA_Geophysics_Reference_Model_SGrid__flags@@.zip - Google Drive

Hi Richard,

thanks, got the files and gave it a try. Also got errors, though slightly different. Then after removing “NAME Default” line 82 in the .sg file it magically worked producing a vtu file with reasonable distributions of measurements.

Give it a try too, please. Meanwhile I’ll look with the debugger into the reader.

– d

> bin/GocadSGridReader -s SA_Geophysics_Reference_Model_SGrid.sg -o x.vtu
[2021-11-03 21:01:54.761] [ogs] [info] Start reading Gocad SGrid.
[2021-11-03 21:01:57.787] [ogs] [info] End reading Gocad SGrid.
[2021-11-03 21:02:27.393] [ogs] [info] There are 11 properties in the mesh:
[2021-11-03 21:02:27.400] [ogs] [info]  Gravity_Inversion_Constrained: (7992586 values) [-99999, 3.2188799381256104]
[2021-11-03 21:02:27.407] [ogs] [info]  Gravity_Inversion_Unconstrained: (7992586 values) [-99999, 3.0738370418548584]
[2021-11-03 21:02:27.414] [ogs] [info]  Magnetic_Inversion_Constrained: (7992586 values) [-99999, 0.11462300270795822]
[2021-11-03 21:02:27.421] [ogs] [info]  Magnetic_Inversion_Unconstrained: (7992586 values) [-99999, 0.09801190346479416]
[2021-11-03 21:02:27.425] [ogs] [info]  RegionFlags: (7992586 values) [-1, 1427]
[2021-11-03 21:02:27.430] [ogs] [info]  Rock_Unit: (7992586 values) [-99999, 6]
[2021-11-03 21:02:27.434] [ogs] [info]  SA_Geophysics_AWAGS_Log_Resistivity: (7992586 values) [-99999, 3.7394332885742188]
[2021-11-03 21:02:27.439] [ogs] [info]  SA_Geophysics_AusREM_Crust_Vp: (7992586 values) [-99999, 8.297428131103516]
[2021-11-03 21:02:27.444] [ogs] [info]  SA_Geophysics_AusREM_Crust_Vsv: (7992586 values) [-99999, 4.777806758880615]
[2021-11-03 21:02:27.448] [ogs] [info]  SA_Geophysics_AusREM_Crust_rho: (7992586 values) [-99999, 3.4011118412017822]
[2021-11-03 21:02:27.453] [ogs] [info]  SA_Geophysics_Magnetotellurics_Gawler_Resistivity: (7992586 values) [-99999, 5.930550575256348]
[2021-11-03 21:02:27.453] [ogs] [info] Writing mesh to 'x.vtu'.

Nicely done dmitri, thank you very much! Just deleted the old one, so will give it a go now.

I still get errors - am I using a different version to you?
OpenGeoSys-6 software, version 6.4.1-79-g69a2996020.

Copyright (c) 2012-2021, OpenGeoSys Community
(http://www.opengeosys.org)

indent preformatted text by 4 spaces

(base) J:\ogs-6.4.1-79-g69a2996020-Windows-10.0.19043-python-3.8.2-utils\bin>GocadSGridReader -s SA_Geophysics_Reference_Model_SGrid.sg -o x.vtu
[2021-11-04 08:45:41.921] [ogs] [info] Start reading Gocad SGrid.
[2021-11-04 08:45:44.433] [ogs] [error] readBinaryArray(): Error while reading from file ‘SA_Geophysics_Reference_Model_SGrid_Gravity_Inversion_Unconstrained@@’.
[2021-11-04 08:45:44.434] [ogs] [error] Read different number of values. Expected 7992586, got 1315930.
[2021-11-04 08:45:44.435] [ogs] [error] Reading of element properties file ‘SA_Geophysics_Reference_Model_SGrid_Gravity_Inversion_Unconstrained@@’ failed.
[2021-11-04 08:45:44.521] [ogs] [error] readBinaryArray(): Error while reading from file ‘SA_Geophysics_Reference_Model_SGrid_Magnetic_Inversion_Unconstrained@@’.
[2021-11-04 08:45:44.522] [ogs] [error] Read different number of values. Expected 7992586, got 1314778.
[2021-11-04 08:45:44.523] [ogs] [error] Reading of element properties file ‘SA_Geophysics_Reference_Model_SGrid_Magnetic_Inversion_Unconstrained@@’ failed.
[2021-11-04 08:45:44.603] [ogs] [error] readBinaryArray(): Error while reading from file ‘SA_Geophysics_Reference_Model_SGrid_Magnetic_Inversion_Constrained@@’.
[2021-11-04 08:45:44.604] [ogs] [error] Read different number of values. Expected 7992586, got 1314814.
[2021-11-04 08:45:44.606] [ogs] [error] Reading of element properties file ‘SA_Geophysics_Reference_Model_SGrid_Magnetic_Inversion_Constrained@@’ failed.
[2021-11-04 08:45:44.686] [ogs] [error] readBinaryArray(): Error while reading from file ‘SA_Geophysics_Reference_Model_SGrid_Gravity_Inversion_Constrained@@’.
[2021-11-04 08:45:44.687] [ogs] [error] Read different number of values. Expected 7992586, got 1315201.
[2021-11-04 08:45:44.693] [ogs] [error] Reading of element properties file ‘SA_Geophysics_Reference_Model_SGrid_Gravity_Inversion_Constrained@@’ failed.
[2021-11-04 08:45:44.785] [ogs] [error] readBinaryArray(): Error while reading from file ‘SA_Geophysics_Reference_Model_SGrid_SA_Geophysics_Magnetotellurics_Gawler_Resistivity@@’.
[2021-11-04 08:45:44.786] [ogs] [error] Read different number of values. Expected 7992586, got 1347556.
[2021-11-04 08:45:44.787] [ogs] [error] Reading of element properties file ‘SA_Geophysics_Reference_Model_SGrid_SA_Geophysics_Magnetotellurics_Gawler_Resistivity@@’ failed.
[2021-11-04 08:45:44.901] [ogs] [error] readBinaryArray(): Error while reading from file ‘SA_Geophysics_Reference_Model_SGrid_SA_Geophysics_AusREM_Crust_Vp@@’.
[2021-11-04 08:45:44.902] [ogs] [error] Read different number of values. Expected 7992586, got 1468345.
[2021-11-04 08:45:44.903] [ogs] [error] Reading of element properties file ‘SA_Geophysics_Reference_Model_SGrid_SA_Geophysics_AusREM_Crust_Vp@@’ failed.
[2021-11-04 08:45:45.014] [ogs] [error] readBinaryArray(): Error while reading from file ‘SA_Geophysics_Reference_Model_SGrid_SA_Geophysics_AusREM_Crust_Vsv@@’.
[2021-11-04 08:45:45.015] [ogs] [error] Read different number of values. Expected 7992586, got 1469885.
[2021-11-04 08:45:45.017] [ogs] [error] Reading of element properties file ‘SA_Geophysics_Reference_Model_SGrid_SA_Geophysics_AusREM_Crust_Vsv@@’ failed.
[2021-11-04 08:45:45.126] [ogs] [error] readBinaryArray(): Error while reading from file ‘SA_Geophysics_Reference_Model_SGrid_SA_Geophysics_AusREM_Crust_rho@@’.
[2021-11-04 08:45:45.127] [ogs] [error] Read different number of values. Expected 7992586, got 1468759.
[2021-11-04 08:45:45.128] [ogs] [error] Reading of element properties file ‘SA_Geophysics_Reference_Model_SGrid_SA_Geophysics_AusREM_Crust_rho@@’ failed.
[2021-11-04 08:45:45.232] [ogs] [error] readBinaryArray(): Error while reading from file ‘SA_Geophysics_Reference_Model_SGrid_SA_Geophysics_AWAGS_Log_Resistivity@@’.
[2021-11-04 08:45:45.233] [ogs] [error] Read different number of values. Expected 7992586, got 1305248.
[2021-11-04 08:45:45.234] [ogs] [error] Reading of element properties file ‘SA_Geophysics_Reference_Model_SGrid_SA_Geophysics_AWAGS_Log_Resistivity@@’ failed.
[2021-11-04 08:45:48.751] [ogs] [info] End reading Gocad SGrid.
[2021-11-04 08:46:36.795] [ogs] [info] There are 11 properties in the mesh:
[2021-11-04 08:46:36.796] [ogs] [info] Mesh property vector ‘Gravity_Inversion_Constrained’ is empty.
[2021-11-04 08:46:36.797] [ogs] [info] Gravity_Inversion_Constrained: Could not get value bounds for property vector.
[2021-11-04 08:46:36.798] [ogs] [info] Mesh property vector ‘Gravity_Inversion_Unconstrained’ is empty.
[2021-11-04 08:46:36.799] [ogs] [info] Gravity_Inversion_Unconstrained: Could not get value bounds for property vector.
[2021-11-04 08:46:36.800] [ogs] [info] Mesh property vector ‘Magnetic_Inversion_Constrained’ is empty.
[2021-11-04 08:46:36.801] [ogs] [info] Magnetic_Inversion_Constrained: Could not get value bounds for property vector.
[2021-11-04 08:46:36.801] [ogs] [info] Mesh property vector ‘Magnetic_Inversion_Unconstrained’ is empty.
[2021-11-04 08:46:36.802] [ogs] [info] Magnetic_Inversion_Unconstrained: Could not get value bounds for property vector.
[2021-11-04 08:46:36.816] [ogs] [info] RegionFlags: (7992586 values) [-1, 1427]
[2021-11-04 08:46:36.831] [ogs] [info] Rock_Unit: (7992586 values) [-99999, 6]
[2021-11-04 08:46:36.831] [ogs] [info] Mesh property vector ‘SA_Geophysics_AWAGS_Log_Resistivity’ is empty.
[2021-11-04 08:46:36.832] [ogs] [info] SA_Geophysics_AWAGS_Log_Resistivity: Could not get value bounds for property vector.
[2021-11-04 08:46:36.833] [ogs] [info] Mesh property vector ‘SA_Geophysics_AusREM_Crust_Vp’ is empty.
[2021-11-04 08:46:36.834] [ogs] [info] SA_Geophysics_AusREM_Crust_Vp: Could not get value bounds for property vector.
[2021-11-04 08:46:36.835] [ogs] [info] Mesh property vector ‘SA_Geophysics_AusREM_Crust_Vsv’ is empty.
[2021-11-04 08:46:36.837] [ogs] [info] SA_Geophysics_AusREM_Crust_Vsv: Could not get value bounds for property vector.
[2021-11-04 08:46:36.839] [ogs] [info] Mesh property vector ‘SA_Geophysics_AusREM_Crust_rho’ is empty.
[2021-11-04 08:46:36.840] [ogs] [info] SA_Geophysics_AusREM_Crust_rho: Could not get value bounds for property vector.
[2021-11-04 08:46:36.840] [ogs] [info] Mesh property vector ‘SA_Geophysics_Magnetotellurics_Gawler_Resistivity’ is empty.
[2021-11-04 08:46:36.841] [ogs] [info] SA_Geophysics_Magnetotellurics_Gawler_Resistivity: Could not get value bounds for property vector.
[2021-11-04 08:46:36.841] [ogs] [info] Writing mesh to ‘x.vtu’.

(base) J:\ogs-6.4.1-79-g69a2996020-Windows-10.0.19043-python-3.8.2-utils\bin>

@dmitri.naumov Can you send me your edited .sg file for comparison please?

I am just running it on a fancy Windows 10 laptop.

For the OGS version, I’m also using one of the most recent 6.4.1-116-g59c212952c, but there should be no difference in the SGrid reader.

modified_sgrid.zip (2.4 KB)

Regarding the different behaviour, I’m not able to analyze it not having a Windows machine at hand.

Thanks - next time I will try a unix flavour perhaps - any compilation tips for the beginner?

We have an intro for this case: devguide intro

Could you convert the SGrid file?

I had a look on the SGrid file format, but the description (B-37 page there) I found does not mention the NAME xxx tag, which we don’t handle properly.

I removed that as you suggested - seemed to be the same - so that suggests a data type format error in the OS - I will try it again later with your header file to confirm.

1 Like

Thanks! PyVista and PVGeo I am familiar with, yes.

@dmitri.naumov - same when I run yours, which I figured - so presumably operating system related as far as I can guess.

Fyi just tried another one from a different source, same problem, so a windows thing will have to investigate more.

The earlier example ran ok on ubuntu compiled version after fixed a bug - can open an issue about that later?

Fairly simple I think - end of line character in coordinate parser.

So next trick is a windows compiler and find out what is going on there.