Welcome, Guest
Username: Password: Remember me

TOPIC: Extraction of time series at points with pytel

Extraction of time series at points with pytel 10 years 2 months ago #14149

  • taoan
  • taoan's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 52
  • Thank you received: 9
Hi all!

I'm trying to use pytel scripts to extract time series at points from a selafin 3d file.

I loaded selafin file with parserSELAFIN, but I do not understand what is the format of input data to use function getValueHistorySLF

getValueHistorySLF(f,tags,time,support,NVAR,NPOIN3,NPLAN,(varsIndexes,varsName) ):
""""
Extraction of time series at points.
A point could be:
(a) A point could be a node 2D associated with one or more plan number
(b) A pair (x,y) associated with one or more plan number
/!\ Vertical ingetValueHistorySLFterpolation has not been implemented yet.
Arguments:
- time: the discrete list of time frame to extract from the time history
- support: the list of points
- varsIndexes: the index in the NVAR-list to the variable to extract
"""
I think the variable "f" is the problem.

when I try...

from parsers.parserSELAFIN import SELAFIN,subsetVariablesSLF,getValueHistorySLF

slf=SELAFIN(results3d.sfl)
names=slf.VARNAMES
varsIndexes=[-1]
varsName=[names[-1]]#salinity
support=(504655.28,8604625.51),range(slf.NPLAN)
times=slf.tags["times"]
serie=getValueHistorySLF(slf,slf.tags,times,support,slf.NVAR,slf.NPOIN3,slf.NPLAN,(varsIndexes,varsName))

It occurs this error...

f.seek(tags[time[it]]) # time[it] is the frame to be extracted
AttributeError: SELAFIN instance has no attribute 'seek'

I would be very gratefull for any help.

Regards
The administrator has disabled public write access.

Extraction of time series at points with pytel 10 years 1 month ago #14598

  • konsonaut
  • konsonaut's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 413
  • Thank you received: 144
Hello,

a little bit late but there is also another function named getSERIES which I have been using for extracting time series from nodes.
Example:
# Remove spaces at the end of the variable names in VARNAMES
var_names=[item.rstrip() for item in slf.VARNAMES]
print var_names
times = slf.tags["times"]; #print times
# From which nodes to extract time series:
nodes = [1351,1989] # List of node numbers
# Use getSERIES function from parserSELAFIN.py
z = slf.getSERIES(nodes, varsIndexes=[var_names.index('VITESSE U')])
# So I can fill the "real" variable name (and without spaces) into the function because I remember better the name than the index, or use varsIndexes=[] to get all the variables

Now you can do nice matplotlib plots!

Hope this helps,
Clemens
The administrator has disabled public write access.
The following user(s) said Thank You: jeremie, taoan

Extraction of time series at points with pytel 10 years 1 month ago #14603

  • taoan
  • taoan's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 52
  • Thank you received: 9
Thank you konsonaut!

Your solution works fine to me.

Regards
The administrator has disabled public write access.
Moderators: borisb

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