Welcome, Guest
Username: Password: Remember me

TOPIC: Python Jupyer / access variables contents

Python Jupyer / access variables contents 3 years 2 weeks ago #39317

  • guto_schettini
  • guto_schettini's Avatar
Hello,

Please, I'm not a model user, but need to assess the results from one of my students.

I'm using Python & Jupyter notebooks.

I installed and am using the 'pyteltools' package.

So far, I can access the file and obtain what the Github example offer... I would like to ask for further help about accessing the list of the variables in the file and how to access them (as an np.array?)?

Thank you!


notebook_pyteltools.png
The administrator has disabled public write access.

Python Jupyer / access variables contents 2 years 11 months ago #39363

  • Htun Pyae Sone
  • Htun Pyae Sone's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 38
  • Thank you received: 2
Hi,

I think 'pyteltools' package is developed by other organization. Therefore, it is better to discuss on their github page. However, you can also use the tools from Telemac. If you download the telemac, you can find some examples under the directory \notebooks. Hope it helps.
The administrator has disabled public write access.

Python Jupyer / access variables contents 2 years 11 months ago #39364

  • Lux
  • Lux's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 96
  • Thank you received: 39
Dear Python developer,

I am a contributor to pyteltools and can help you in using it if necessary.

For Serafin object (slf), the variable names are in `resin.header.var_names` and the corresponding variable unique identifiers (to do a query) are in `resin.header.var_IDs`.
To extract an array use one of these methods (see the documentation at cnr-engineering.github.io/PyTelTools/cla...erafin_1_1_read.html) for example :
  • resin.read_var_in_frame(0, 'W') # extracts vertical velocity at first frame in a 1D array
  • resin.read_var_in_frame_as_3d(2880, 'W') # extracts vertical velocity at last frame in a 2D array

If you want to visualize in Python a 2D result, have a look at github.com/CNR-Engineering/PyTelTools/issues/10.

As mentioned by Htun Pyae Sone, you already have some Python3 scripts integrated in the Telemac source code (scripts/python3/postel). The main difficulty is to compile Telemac with hermes+API to use them...

Hope it helps,
Luc
The administrator has disabled public write access.
Moderators: borisb

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