Replies: 9 comments 18 replies
-
Hi, There is a reader for Telemac/Selafin, which I believe was originally made by @Boorhin There is a example script in the gallery, but the output is not shown, as it needs a Selafin package which is not included in OpenDrift distribution: I dont know if this reader will work with 2D data, but it can proably be adapted to work. |
Beta Was this translation helpful? Give feedback.
-
Hi,
The reader use the script from telemac (that is easy to replicate to be
honest). The number of layers is of course read so that is not an issue. If
I have an example of a 2D file I could check for compatibility but I don't
think it would be an issue. Did you try it?
Cheers
…On Mon, 29 Apr 2024, 16:11 eroome, ***@***.***> wrote:
Hi,
Thanks for the quick reply, I have been working on adapting the reader
today but I am new to the structure of opendirft and python in general. Do
you have any pointers as to what would need changing, I assume its a case
of removing the depth related varaibles?
cheers,
Ed
—
Reply to this email directly, view it on GitHub
<#1293 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACJCEFWQZZ3NJ7CAQS2UX5TY7ZPJBAVCNFSM6AAAAABG2LKFY6VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TENRUGE4DE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I cannot see an error message so it is difficult to judge. You can probe
the variables in your file with the reader.
Did you use the telemac script to see what's in your file first?
Cheers
…On Tue, 30 Apr 2024, 09:52 eroome, ***@***.***> wrote:
Hi @Boorhin <https://github.com/Boorhin> ,
I did check for compatibility by adapting your example script (shown
below). However, OceanDrift runs but it fails to read any values for
x_seawater_velocity and y_seawater_velocity. Is your script designed to be
compatible with 2D files?
from datetime import timedelta, datetime
from os import sep
from pyproj import Proj
from opendrift.readers import reader_telemac_selafin
from opendrift.models.oceandrift import OceanDrift
o = OceanDrift(loglevel=0)
log level: Use a value of 20 to get only a minimum of information, or a
value of 50 for no output at all.
filename='C:\Users\edroo\Desktop\PhillipinesAtmosTest_xy.slf'
#Lambert North
proj = "+proj=latlon +ellps=WGS84 +lat_1=0 +lat_0=0 +lon_0=0 +a=6378137.0
rf=298.257223563"
proj="+proj=utm +zone=51 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"
start_time= datetime(2021,11,25,00,00)
selafin = reader_telemac_selafin.Reader(filename=filename,proj4 = proj,
start_time=start_time)
o.add_reader(selafin)
#%%
o.set_config('general:coastline_action', 'previous')
start_time = selafin.start_time generally wrong
time_step = timedelta(hours=0.5)
length= timedelta(hours=(35
*24)) num_steps = ((35*48)+1)
center seeds in the middle
#x,y = (selafin.x.max()-selafin.x.min())/2+selafin.x.min(),\
(selafin.y.max()-selafin.y.min())/2+selafin.y.min()
lon,lat = 123.7716, 10.2259
o.seed_elements(lon=lon, lat=lat, radius=20, number= 200,
time= start_time)
o.run(time_step=timedelta(hours=0.5), duration=timedelta(1/24))
—
Reply to this email directly, view it on GitHub
<#1293 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACJCEFVURBLEJGSDF47WMYDY75LVPAVCNFSM6AAAAABG2LKFY6VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TENZSGU2DE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Yes, I checked that, the variables are being read correctly by the reader. The error arises in the later part, when ocean drift needs to interpolate the velocity values from the selafin file. The error message is as follows... argmin of an empty sequence |
Beta Was this translation helpful? Give feedback.
-
Is it possible to have an extract of the file?
Not sure what the empty sequence means. Sounds like new python jargon.
I can adapt the reader to the 2D example if that's the issue.
Personally, I don't really like slf files, they are from another century ;)
I transform them to xarray zarr archives. It is easier to understand what's
in it. I have a repo with a script to do that if you are interested.
I still don't really know what's in your file, all kinds of things can be
stored in these Fortran files and I have had access to only few of them.
Cheers
…On Tue, 30 Apr 2024, 13:03 eroome, ***@***.***> wrote:
Yes, I checked that, the variables are being read correctly by the reader.
The error arises in the later part, when ocean drift needs to interpolate
the velocity values from the selafin file. The error message is as
follows...
argmin of an empty sequence
Traceback (most recent call last):
File "C:\Users\edroo\opendrift\opendrift\models\basemodel\environment.py",
line 646, in get_environment
reader.get_variables_interpolated(
File "C:\Users\edroo\opendrift\opendrift\readers\basereader\variables.py",
line 898, in get_variables_interpolated
env, env_profiles = self.get_variables_interpolated_xy(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\edroo\opendrift\opendrift\readers\basereader\variables.py",
line 764, in get_variables_interpolated_xy
env, env_profiles = self.*get_variables_interpolated*(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"C:\Users\edroo\opendrift\opendrift\readers\basereader\unstructured.py",
line 61, in *get_variables_interpolated*
env = self.get_variables(variables, time, reader_x, reader_y, z)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"C:\Users\edroo\opendrift\opendrift\readers\reader_telemac_selafin.py",
line 231, in get_variables
idx_layer = np.abs(pm - z).argmin(axis=0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: attempt to get argmin of an empty sequence
—
Reply to this email directly, view it on GitHub
<#1293 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACJCEFXHB6LMXHHSBSE627TY76CCHAVCNFSM6AAAAABG2LKFY6VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TENZUGYZTI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hi Julien,
I no longer need a 2D file reader. From now onwards I will just run my model in 3D. But I am still having trouble running your example with the 3D reader.
Sent from Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Julien Moreau ***@***.***>
Sent: Monday, May 6, 2024 8:05:44 PM
To: OpenDrift/opendrift ***@***.***>
Cc: Edward Roome (Staff) ***@***.***>; Author ***@***.***>
Subject: Re: [OpenDrift/opendrift] 2D telemac output (Discussion #1293)
I went through the 2D file and it is possible to make some reader out of it if I think about it. Should be relatively easy,
For the 3D file I see that there are 2 layers but I am unable to place them in space with what's in the file.
—
Reply to this email directly, view it on GitHub<#1293 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BEJBZYCI4AMEQVHHJLJGHYTZA7IARAVCNFSM6AAAAABG2LKFY6VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TGMZTGM3DI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
Mae croeso i chi gysylltu gyda'r Brifysgol yn Gymraeg neu Saesneg. Ni fydd gohebu yn Gymraeg yn arwain at oedi.
You are welcome to contact the University in Welsh or English. Corresponding in Welsh will not lead to delay.
Rhif Elusen Gofrestredig 1141565 - Registered Charity No. 1141565
Gall y neges e-bost hon, ac unrhyw atodiadau a anfonwyd gyda hi, gynnwys deunydd cyfrinachol ac wedi eu bwriadu i'w defnyddio'n unig gan y sawl y cawsant eu cyfeirio ato (atynt). Os ydych wedi derbyn y neges e-bost hon trwy gamgymeriad, rhowch wybod i'r anfonwr ar unwaith a dilewch y neges. Os na fwriadwyd anfon y neges atoch chi, rhaid i chi beidio a defnyddio, cadw neu ddatgelu unrhyw wybodaeth a gynhwysir ynddi. Mae unrhyw farn neu safbwynt yn eiddo i'r sawl a'i hanfonodd yn unig ac nid yw o anghenraid yn cynrychioli barn Prifysgol Bangor. Nid yw Prifysgol Bangor yn gwarantu bod y neges e-bost hon neu unrhyw atodiadau yn rhydd rhag firysau neu 100% yn ddiogel. Oni bai fod hyn wedi ei ddatgan yn uniongyrchol yn nhestun yr e-bost, nid bwriad y neges e-bost hon yw ffurfio contract rhwymol - mae rhestr o lofnodwyr awdurdodedig ar gael o Swyddfa Cyllid Prifysgol Bangor.
This email and any attachments may contain confidential material and is solely for the use of the intended recipient(s). If you have received this email in error, please notify the sender immediately and delete this email. If you are not the intended recipient(s), you must not use, retain or disclose any information contained in this email. Any views or opinions are solely those of the sender and do not necessarily represent those of Bangor University. Bangor University does not guarantee that this email or any attachments are free from viruses or 100% secure. Unless expressly stated in the body of the text of the email, this email is not intended to form a binding contract - a list of authorised signatories is available from the Bangor University Finance Office.
|
Beta Was this translation helpful? Give feedback.
-
Hi, you have a configuration problem, you should not specifically change this line, you should create an environmental variable called HOMETEL as per specification of Telemac installation. In your case it should be 'C:\Users\edroo\opendrift' |
Beta Was this translation helpful? Give feedback.
-
Yep, it works fine so far!
Thinking about it, I think I will need a 2D reader to get variables such as Depth, Wind X Y and Stokes Drift from my 2D mesh.
I think there could be a easier work around though by using this xarray-selafin · PyPI<https://pypi.org/project/xarray-selafin/>
But my python skills are not good enough to clearly see how you can input the xarray dataset into open drift.
Ed
…________________________________
From: Julien Moreau ***@***.***>
Sent: 07 May 2024 11:03
To: OpenDrift/opendrift ***@***.***>
Cc: Edward Roome (Staff) ***@***.***>; Author ***@***.***>
Subject: Re: [OpenDrift/opendrift] 2D telemac output (Discussion #1293)
Glad it works!
in my to-do list I need to make a test if HOMETEL exists.
—
Reply to this email directly, view it on GitHub<#1293 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BEJBZYHGZWTOPJ5SM3LGDJ3ZBCRFXAVCNFSM6AAAAABG2LKFY6VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TGMZZGY2DC>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
Mae croeso i chi gysylltu gyda'r Brifysgol yn Gymraeg neu Saesneg. Ni fydd gohebu yn Gymraeg yn arwain at oedi.
You are welcome to contact the University in Welsh or English. Corresponding in Welsh will not lead to delay.
Rhif Elusen Gofrestredig 1141565 - Registered Charity No. 1141565
Gall y neges e-bost hon, ac unrhyw atodiadau a anfonwyd gyda hi, gynnwys deunydd cyfrinachol ac wedi eu bwriadu i'w defnyddio'n unig gan y sawl y cawsant eu cyfeirio ato (atynt). Os ydych wedi derbyn y neges e-bost hon trwy gamgymeriad, rhowch wybod i'r anfonwr ar unwaith a dilewch y neges. Os na fwriadwyd anfon y neges atoch chi, rhaid i chi beidio a defnyddio, cadw neu ddatgelu unrhyw wybodaeth a gynhwysir ynddi. Mae unrhyw farn neu safbwynt yn eiddo i'r sawl a'i hanfonodd yn unig ac nid yw o anghenraid yn cynrychioli barn Prifysgol Bangor. Nid yw Prifysgol Bangor yn gwarantu bod y neges e-bost hon neu unrhyw atodiadau yn rhydd rhag firysau neu 100% yn ddiogel. Oni bai fod hyn wedi ei ddatgan yn uniongyrchol yn nhestun yr e-bost, nid bwriad y neges e-bost hon yw ffurfio contract rhwymol - mae rhestr o lofnodwyr awdurdodedig ar gael o Swyddfa Cyllid Prifysgol Bangor.
This email and any attachments may contain confidential material and is solely for the use of the intended recipient(s). If you have received this email in error, please notify the sender immediately and delete this email. If you are not the intended recipient(s), you must not use, retain or disclose any information contained in this email. Any views or opinions are solely those of the sender and do not necessarily represent those of Bangor University. Bangor University does not guarantee that this email or any attachments are free from viruses or 100% secure. Unless expressly stated in the body of the text of the email, this email is not intended to form a binding contract - a list of authorised signatories is available from the Bangor University Finance Office.
|
Beta Was this translation helpful? Give feedback.
-
Probably better than making a specific reader for Xarray, is to update the generic unstructured reader to accept an Xarray dataset, as alternative to providing filename or URL. However, this would require that the Telemac data structure is the same as expected in the generic unstructured reader, which I guess is to some degree adapted to FVCOM: |
Beta Was this translation helpful? Give feedback.
-
Hi,
Does opendrift work with a 2D telemac (selafin) output?
cheers,
Ed
Beta Was this translation helpful? Give feedback.
All reactions