Welcome, Guest
Username: Password: Remember me

TOPIC: Converting Selafin files to NetCDF format

Converting Selafin files to NetCDF format 3 years 5 months ago #38573

  • smk.svks
  • smk.svks's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 93
  • Thank you received: 1
Hi Jose,
Thanks for your response. My aim is to convert my result file (Telemac2D) to NetCDF format to use it on the GNOME oil spill trajectory (NOAA) model. GNOME has the model input file format descriptions in NetCDF format for our Telemac results. So tried the code from the forum to convert to .nc format and it works fine I thought of modifying it for the GNOME instructed format.

I encountered the following error while trying the script.

Script called : slf2nc.py
Opening .slf file
Opening .r2s file
Writing velocity_u | | ---s 0.00 B/s
Traceback (most recent call last):
File "slf2nc.py", line 258, in <module>
NetCdf.writenc(cdffile,times,xm,ym,ikle,X,Y,names,vnames,units)
File "slf2nc.py", line 214, in writenc
zi = Telemac.trinterp(xm,ym,trgl,X,Y,z)
File "slf2nc.py", line 119, in trinterp
zi = I(xi, yi)
File "C:\Users\Sathish_Kumar\AppData\Roaming\Python\Python38\site-packages\matplotlib\tri\triinterpolate.py", line 421, in __call__
return self._interpolate_multikeys(x, y, tri_index=None,
File "C:\Users\Sathish_Kumar\AppData\Roaming\Python\Python38\site-packages\matplotlib\tri\triinterpolate.py", line 171, in _interpolate_multikeys
tri_index = self._trifinder(x, y)
File "C:\Users\Sathish_Kumar\AppData\Roaming\Python\Python38\site-packages\matplotlib\tri\trifinder.py", line 61, in __call__
indices = (self._cpp_trifinder.find_many(x.ravel(), y.ravel())
ValueError: x and y must be array-like with same shape


regards
Sathish
The administrator has disabled public write access.

Converting Selafin files to NetCDF format 3 years 5 months ago #38574

  • Jose_filho
  • Jose_filho's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 42
  • Thank you received: 2
You have to take care of which method you are using and what python script version is it? Some time ago I saw a topic here about it, but it has been written on python2 environment.
Please, refer to Telemac_File.py script on python3 TELEMAC folder. this script presents almost all methods and functions you would need to create NetCDF file and manipulate your data.

Meanwhile, you can have a look at this topic to get the idea to write your netcdf:https://github.com/OpenDrift/opendrift/issues/213#issuecomment-805963006

Regards
The administrator has disabled public write access.

Converting Selafin files to NetCDF format 2 years 7 months ago #40274

  • HosseinB
  • HosseinB's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
Hi Sathish,

Did you figure it out to guide me? I am in need of this as well.

Thanks,
Hossein
The administrator has disabled public write access.

Converting Selafin files to NetCDF format 2 years 6 months ago #40299

  • smk.svks
  • smk.svks's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 93
  • Thank you received: 1
Dear Hossein,

Sorry, I am not able to finish it.

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

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