Bug saving database with SAC files, XML error

This forum is dedicated to discuss all problems and suggestions related to the use of geopsy database and its plugins (array processing, H/V,...).
Post Reply
joel.jansen
Posts: 2
Joined: Thu Jan 30, 2025 5:22 pm

Bug saving database with SAC files, XML error

Post by joel.jansen »

Hello --

I have HVSR data saved in SAC format using SmartSolo's Sololite software. I can load, view, and process the dataset in Geopsy as expected, but when I try to re-open the GPY database file I get the following error:

"Errors occured while opening database, for more details read log."

The log then reads:

"Truncated context at the end of XML (D:/<directory path>/test.gpy at line 14).
Truncated context at the end of XML (D:/<directory path>/_Geopsy/test.gpy)."

Line 14 is the "Name" line, so it appears that the XML importer is unable to parse it correctly.

My workaround is to delete the three instances of the Name line (one per component) from the GPY XML file (I use the "Kate" editor) and save the file, after which I can open the GPY file normally.

Please let me know if you require more information or uploaded files (each component is 50MB).

Thank you,
Joel
admin
Site Admin
Posts: 841
Joined: Mon Aug 13, 2007 11:48 am
Location: ISTerre
Contact:

Re: Bug saving database with SAC files, XML error

Post by admin »

Hi Joel,

Can you upload the .gpy file. Not the SAC files?
joel.jansen
Posts: 2
Joined: Thu Jan 30, 2025 5:22 pm

Re: Bug saving database with SAC files, XML error

Post by joel.jansen »

Hi -- GPY file as requested.

My workaround is to delete lines 14, 39, and 64.

LMK if you need anything else.

J
Attachments
temp.gpy
(873 Bytes) Downloaded 1503 times
admin
Site Admin
Posts: 841
Joined: Mon Aug 13, 2007 11:48 am
Location: ISTerre
Contact:

Re: Bug saving database with SAC files, XML error

Post by admin »

This is an issue I recently discovered with text fields of SAC headers. Fields have a fixed number of characters (KSTNM 8 for the station name). Until recently, the extra characters were blank spaces if the actual station name is shorter than 8 characters. You are providing a second example where the extra characters are 0 which is the end of string character in C.

If you upgrade to 3.6.0-preview accessible through git only (see download page), upon the import of SAC files the station name will be properly extracted even if there are null characters. When saving the database you won't encounter any error.

To fix existing databases, edit the <name> fields and remove the last strange characters.

Code: Select all

   <Signal>
      <ID>4</ID>
      <Name>3026290^@</Name>
sunxu
Posts: 2
Joined: Sun Jan 12, 2025 1:51 am

Re: Bug saving database with SAC files, XML error

Post by sunxu »

I am using version 3.5.2 of geopsy and encountered the same issue. I modified the .gpy file according to your solution, but it still reports an error as follows:

Truncated tag at the end of XML (D:/kt/test - 副本.gpy at line 1).
Truncated tag at the end of XML (D:/kt/test - 副本.gpy).

I have attached the original test.gpy and the modified test_modified.gpy.

Hope to get your help. :D :D

Thank you!

Sunxu
Attachments
test_modified.gpy
(745 Bytes) Downloaded 1541 times
test.gpy
(823 Bytes) Downloaded 1449 times
admin
Site Admin
Posts: 841
Joined: Mon Aug 13, 2007 11:48 am
Location: ISTerre
Contact:

Re: Bug saving database with SAC files, XML error

Post by admin »

Hi Sunxu,

Effectively, you have the same issue with test.gpy.
At first, I was not able to open test_modified.gpy with the ad hoc method:

Code: Select all

tar xvfz test_modified.gpy
I tried with unzip and gunzip. After renaming the .gpy file,

Code: Select all

mv test_modified.gpy test_modified.gz
gunzip test_modified.gz
The obtained file is a text file with the xml code. Hence, I guess that you compressed contents.xml with gzip. The format read by geopsy is slightly different. It is a tar file compressed with gzip.
Hence the only way to compress the xml file is

Code: Select all

tar cvfz test_modified.gpy contents.xml
Note that you can also rename contents.xml to test_modify.gpy without compressing. It should work also.
Hope it helps,
Marc
sunxu
Posts: 2
Joined: Sun Jan 12, 2025 1:51 am

Re: Bug saving database with SAC files, XML error

Post by sunxu »

Hi! Thank you for your reply!

In fact, I directly used Kate to edit the original file test.gpy and obtained test_modified.gpy.

According to your instructions, I followed these steps:

1. Use tar xvfz test.gpy to get the context.xml file.

2. Modify all the field Name in the context.xml file, removing the space after the station name.

like Line 14: <Name>3015469 </Name>

3. Rename context.xml to test.gpy.

Then I successfully read the test.gpy file!

Thank you for your help!

Sunxu
Post Reply