Welcome, Guest
Username: Password: Remember me

TOPIC: conver_to_bnd.py script occurred struct error

conver_to_bnd.py script occurred struct error 4 years 9 months ago #35315

  • Cyangou
  • Cyangou's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 73
  • Thank you received: 2
Hi!
First I would like to thank the researchers who shared these scripts.

then i got 3d data provided by convert_hycom.py script and i try to use conver_to_bnd.py script to build a "binary boundary data file" which is prescribed the 3d_hycom data to the boundary points of my Mesh.

However, this script keeps occurring this error:

Traceback (most recent call last): ] 0% | ---s
File "convert_to_bnd.py", line 232, in <module>
generate_bnd(cli_file, geo_file, slf_file, bnd_file)
File "convert_to_bnd.py", line 209, in generate_bnd
data = get_value_history_slf(slf.file, slf.tags, [itime], support3d,
File "C:\Users\chenyangspain\AppData\Local\Programs\Python\Python38\lib\site-packages\formats\parser_selafin.py", line 148, in get_value_history_slf
varsor = unpack(endian+str(npoin3)+ftype, f.read(fsize*npoin3))
struct.error: unpack requires a buffer of 54912 bytes

My open boundary prescribed with 566 and Tracer as 4
i did the following work try to solver the error.
- I checked the consistency of Geo.slf and Boundary.cli mesh and the range of both is in the hycom data mesh.
- I changed the mesh from UTM to longitude and latitude coordinates, consistent with hycom data mesh.
- Attempted to set up the open boundary away from the coastline, in order to allow hycom data to be written (buz i found that the mesh accuracy of hycom is too large with my mesh)

After doing those above works, convert_to_bnd.py script still got the above error "struct.error: unpack requires a buffer of 54912 bytes"

Does anyone know how should i do any works to solver the problem?
thanks in advance!

Regards
Yang
The administrator has disabled public write access.

conver_to_bnd.py script occurred struct error 4 years 9 months ago #35349

  • Cyangou
  • Cyangou's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 73
  • Thank you received: 2
Hi,

sorry, i still got this error and dont know how to fix it

Traceback (most recent call last): ] 0% | ---s
File "convert_to_bnd.py", line 232, in <module>
generate_bnd(cli_file, geo_file, slf_file, bnd_file)
File "convert_to_bnd.py", line 209, in generate_bnd
data = get_value_history_slf(slf.file, slf.tags, [itime], support3d,
File "C:\Users\chenyangspain\AppData\Local\Programs\Python\Python38\lib\site-packages\formats\parser_selafin.py", line 148, in get_value_history_slf
varsor = unpack(endian+str(npoin3)+ftype, f.read(fsize*npoin3))
struct.error: unpack requires a buffer of 54912 bytes

could u please share some experience with me? i truly thanks in advance

Regards
Yang
The administrator has disabled public write access.

conver_to_bnd.py script occurred struct error 4 years 9 months ago #35350

  • c.coulet
  • c.coulet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3722
  • Thank you received: 1031
Hi

Looks like a mismatch in the dimension of the read and the values available in the file...

We need more info to investigate

regards
Christophe
The administrator has disabled public write access.

conver_to_bnd.py script occurred struct error 4 years 9 months ago #35351

  • Cyangou
  • Cyangou's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 73
  • Thank you received: 2
Hi,
thanks for the reply
Ok i will attach the materials
Geo/ CLI/ Hycom.slf/ the script from python3 and my script command
All three are in latitude and longitude coordinates, but the mesh density of hycom3d.slf is obviously different from Geo. i thought it made the mismatch.

thanks to advance about investigate

Regards
Yang
Attachments:
The administrator has disabled public write access.

conver_to_bnd.py script occurred struct error 4 years 9 months ago #35353

  • c.coulet
  • c.coulet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3722
  • Thank you received: 1031
Hi
I think the problem is upstream
I'm not able to open t3d_hycom_bahia_3d.slf in BK

Check all the steps of the process to verify all files are ok

Regards
Christophe
The administrator has disabled public write access.

conver_to_bnd.py script occurred struct error 4 years 9 months ago #35356

  • Cyangou
  • Cyangou's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 73
  • Thank you received: 2
Hi
thanks for the reply,
You mean I didn't extract valid 3d_hycom_file data from the convert_Hycom.py script?

Actually my 2d_hycom_file can be opened in BK very well. I will attach it and i thought that 3d_hycom_file was already a binary selafin file, so I couldn't open it, now it seems to be my misunderstanding. OK, I will check the output of the previous script.

At present I don't know where I went wrong in upstream. Does output 3d_hycom_file require additional commands, such as the number of layers.

my command of conver_hycom.py:
python convert_hycom.py --from 2018-11-01 --stop 2018-12-01 --bl 40,0 --tr 41,1 -r hycom_bahia.slf

its without --2d, and it will output the 2d,3d hycom file.Is this correct?

Thanks alot for spending the time to open my file, buz it is a bit large that cannot be used as an attachment. Thanks in advance

Regards
Yang
Attachments:
The administrator has disabled public write access.

conver_to_bnd.py script occurred struct error 4 years 9 months ago #35358

  • c.coulet
  • c.coulet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3722
  • Thank you received: 1031
Hi
I don't know exactly where the problem is as I didn't use hycom data.
I agree the 2D_hycom file could be open in BK.
But it's a 2D file so I con't know if you could create a 3D file from it...

In my mind, you should have a 3D hycom file to generate a 3D boundary file...

Regards
Christophe
The administrator has disabled public write access.

conver_to_bnd.py script occurred struct error 4 years 9 months ago #35359

  • Cyangou
  • Cyangou's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 73
  • Thank you received: 2
Hi,

Yes, it should be like this, thank you for your reply, even if you are not using hycom data.

I will continue to check what went wrong in steps and share those experiences with some users who plan to use hycom data.

i need to solver the error.

Regards
Yang
The administrator has disabled public write access.

conver_to_bnd.py script occurred struct error 4 years 9 months ago #35366

  • Cyangou
  • Cyangou's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 73
  • Thank you received: 2
Hi, sorry to bother you

I just saw a previous post where they discussed the problem with this script. The work of the questioner is very similar to mine. May I explain the same thing in the previous post?

I am paying attention to the rules of the Forum now, i dont want to break it.
i thought i should get some permission.

Regards
Yang
The administrator has disabled public write access.

conver_to_bnd.py script occurred struct error 4 years 9 months ago #35367

  • c.coulet
  • c.coulet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3722
  • Thank you received: 1031
Hi
You could reactivate the previous post if the problem is really similar but you should first be sure that the solution described doesn't work for you ..

Regards
Christophe
The administrator has disabled public write access.
The following user(s) said Thank You: Cyangou
Moderators: borisb

The open TELEMAC-MASCARET template for Joomla!2.5, the HTML 4 version.