Welcome, Guest
Username: Password: Remember me

TOPIC: TelemacFile - get_data_on_vertical_plane function

TelemacFile - get_data_on_vertical_plane function 3 years 11 months ago #37219

  • Jose_filho
  • Jose_filho's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 42
  • Thank you received: 2
Hi Everyone,

I am trying to use Postel scripts (python3) for creating a longitudinal salinity figure, specifically the TelemacFile/get_data_on_vertical_plane function which is exemplified inside of the notebooks.

The script runs nicely when I use only one line segment, as you can see on the next figure:





However, if I define a polyline with more than two points, it returns some error related to linspace function:

IndexError Traceback (most recent call last)
<ipython-input-29-0499fe6c294b> in <module>
1 # slice at initial time step (0) of the elevation variable
2 xx, abs_curv, values_poly_Z=\
----> 3 slf3d.get_data_on_vertical_plane('ELEVATION Z', 721, ppol, poly_number)

C:\\opentelemac-mascaret\\v8p1\\scripts\\python3\data_manip\extraction\telemac_file.py in get_data_on_vertical_plane(self, varname, record, polyline_points, discretized_number)
737 nplan = self.nplan
738 polygone_discretized_points = linspace_poly(\
--> 739 polyline_points, discretized_number)
740 npoly = len(polygone_discretized_points)
741 values_polylines = np.zeros((npoly, nplan), dtype=np.float64)

C:\\opentelemac-mascaret\\v8p1\\scripts\\python3\data_manip\extraction\linspace.py in linspace_poly(poly_points, poly_number)
36 list_seg = []
37 for i in range(len(poly_points)):
---> 38 lin = linspace_seg(poly_points, poly_points[i+1], poly_number,\
39 end=False)
40 list_seg.append(lin)

IndexError: list index out of range


Has someone already used it as polyline?

Thanks in advance,
The administrator has disabled public write access.

TelemacFile - get_data_on_vertical_plane function 3 years 11 months ago #37224

  • c.coulet
  • c.coulet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3722
  • Thank you received: 1031
Hi
there was a correction on this script.
In linspace.py
the right line is:
for i in range(len(poly_points)-1):

regards
Christophe
The administrator has disabled public write access.
The following user(s) said Thank You: Jose_filho

TelemacFile - get_data_on_vertical_plane function 3 years 11 months ago #37240

  • Jose_filho
  • Jose_filho's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 42
  • Thank you received: 2
Thank you Christophe.
I've fixed it and it runs well now.

Best regards
The administrator has disabled public write access.
Moderators: borisb

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