Welcome, Guest
Username: Password: Remember me

TOPIC: timeseries along line segments

timeseries along line segments 7 years 5 months ago #26751

  • mourad
  • mourad's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 155
  • Thank you received: 6
Hi everyone
I have hundreds line segments (.i2s) along them I've to extract scalar velocity, scalar flowrate, free surface and water depth. The usual way is to click on the variable (V, Q, .....) and then "Tools", then "extract times series" and finally "along line". After, I have to save each extraction with specific name for subsequent us in a scilab code.
This is realy exhausting. Can I do that in a terminal with bach file or in Scilab, Matlab, Python, ...to avoid human errors and save time.
Any help is welcome and will be appreciated
Thank you in advance
Mourad
The administrator has disabled public write access.

timeseries along line segments 7 years 5 months ago #26756

  • Phelype
  • Phelype's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 140
  • Thank you received: 64
Hello Mourad,

I've done this task before. There are two ways that I can think of:

The first, and most straightforward, is to use Postel3D. In it you can extract "Vertical Cross sections". You just have to give in the coordinates of the vertices of the cross section and it will return you a selafin with the data along the line you specified. Although this is the easiest way, it has one major disadvantage: the selafin files are split along the time, that is, there is one selafin for each time step. This can become a problem if you have a long simulation.

The second way is for you to implement yourself an interpolator that does the same as Postel3D. To do that you have to perform a baricentric interpolation from the mesh nodes to the points where you want data. The advantage of this way is that you have complete control of the output format. The disadvantage is that you have to spend a little time coding the intepolator.

Hope this helps. For further assistance you can contact me.

Best regards,

Phelype
The administrator has disabled public write access.
The following user(s) said Thank You: mourad

timeseries along line segments 7 years 5 months ago #26770

  • josekdiaz
  • josekdiaz's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 161
  • Thank you received: 48
Dear Mourad,

As Phelype mentioned this definitly something you can work around using some code. I'm not familiar with Postel3D so I'd rather use custom python code instead.

A good solution is to use one of Pat's scripts to extract the variables, I believe "extract_lines_t.py" acomplishes what you need, and would be a great start to code your custom code.

The downside of using Pat's scripts is that they use it's own parser which is somewhat different (and hence incompatible) with the bundled python scripts and also the new API.

If you want to code your own solution from scratch using the bundled python API, there are some examples in the forum or you could post here what you got and your issues and we could solve it together.

Hope it helps, Regards

José Díaz.
The administrator has disabled public write access.
The following user(s) said Thank You: mourad

timeseries along line segments 7 years 5 months ago #26771

  • Phelype
  • Phelype's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 140
  • Thank you received: 64
Hello José and Mourad

Just to add to José's answer:

"extract_lines_t.py" extracts the data of all variables for one time step.
"extract_lines_v.py" extracts the data of one variable for all time steps.
And both only work for 2D selafin files.

You can merge them to work with all variables in all time steps (and if you need, for 3D files).

Best regards,

Phelype
The administrator has disabled public write access.
The following user(s) said Thank You: mourad

timeseries along line segments 7 years 5 months ago #26898

  • mourad
  • mourad's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 155
  • Thank you received: 6
Thank you Phelype and José,
Finally I've created one file in Scilab with all the linesegments I have and extractd the timeseries of velocity water depth, etc. using this file. It takes lot off time but it's done finally,
By the way I've downlded Postel3D, it's quite interesting and have look on the set Python tools that Jose indicated
Thanks you all
The administrator has disabled public write access.
Moderators: Serrer, a.barton

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