Closed maucollu closed 7 months ago
I believe that is for backwards compatibility for when TPXO9-atlas models had served the u and v currents in separate files (see #258). I only have access to the binary (OTIS) file type, so I don't know how the netCDF files are currently provided. I can edit the io.model
class for TPXO9-atlas-v5 if each netCDF4 file provides both the zonal and meridional currents.
In the compute.tide_currents
function, the binary OTIS file type only reads from the u part of the dictionary. So in the mean time, using the binary files should (hopefully) work fine.
Many thanks, @tsutterley , for helping with this.
Unfortunately, I changed the setting to ATLASFORMAT='OTIS'. and it is still looking for the "v*" types as well, more precisely in:
pyTMD\io\model.py:842 in current
I was trying to identify, in the code, where it actually reads the two components of the velocity, but got a bit lost ;).
Many thanks for the help with this.
Kind Regards
Maurizio
you're right that is a problem. It's in the pathfinder
function within the io.model
class. There's a file check to make sure everything exists. I need to fix this.
I'm working on this now. Can you verify for me that the TPXO9-atlas-v5 netCDF4 files have both components?
I checked, and it seems so.
I quickly did a data = ncinfo('u_2n2_tpxo9_atlas_30_v5.nc')
in MATLAB, and in data.Variables I can see:
uRe
uIm
vRe
vIm
so I suppose these are the real and imaginary parts of the u and v velocities.
I'm checking tha tthe same can be seen in pythonYes, it seems so:
<class 'netCDF4._netCDF4.Dataset'> root group (NETCDF3_CLASSIC data model, file format NETCDF3): type: OTIS transport file title: TPXO9-ATLAS-v5 1/30 x 1/30 tidal SN and WE transports file dimensions(sizes): nx(10800), ny(5401), nct(4) variables(dimensions): |S1 con(nct), float64 lon_u(nx), float64 lat_u(ny), float64 lon_v(nx), float64 lat_v(ny), int32 uRe(nx, ny), int32 uIm(nx, ny), int32 vRe(nx, ny), int32 vIm(nx, ny)
Perfect thanks! I'll get this in as part of a PR I started earlier and will put out a release today. Thanks for your help on this. I don't really work with the current files. And, yes. Those are the real and imaginary parts of the current constituents.
Well, you're more than welcome, but it is I that should thank you for the quick reaction! I suppose the results are in meter per seconds, right?
should be in cm/s
Ahhh, that's why...I was getting some pretty big numbers if they were in m/s...thanks a lot.
This is all in the recently released v2.1.1
. Thanks for your help on this!
-ts
Hi, apologies for the "noob" question - but would be 2.1.1 available through the install mode "conda install -c conda-forge pytmd", or do I need to do the git and then python setup.py install? I tried both, but i do not seem to be able to use the new version....
For context, this is what I tried (on top of the git clone + setup): `conda update pyTMD Channels: Note: you may need to restart the kernel to use updated packages.
conda install -c conda-forge pytmd=2.1.1 Channels:
Note: you may need to restart the kernel to use updated packages.
PackagesNotFoundError: The following packages are not available from current channels:
Current channels:
To search for alternate channels that may provide the conda package you're looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.`
I think you should be able to do either (depending on your current installation):
conda update pyTMD
or
pip install --upgrade pyTMD
as both of the providers (conda-forge and pypi) are up-to-date with v2.1.1.
Which version of python is necessary?
We test against Python 3.11 and I currently run Python 3.12. But on my old machine I was running an earlier version of python3. I think I have included the imports necessary for earlier versions to work (from 3.6+).
It works! Many thanks.
Hi, following up on my last post, I basically went around by cloning and installing 2.1.1.
Anyway, when I try to use:
pyTMD,compute.tide_currents
it asks for separate u* and v input files (the several ones for the different constituents). In the database that I have, both the OTIS and netcdf, I only have h_ and u*, and when I asked Dr. Erofeeva, she told me that the u* contains both the eastward and northward components of the tidal currents, so there should be no need for two separate input files?As a patch in the short term, can i simply dubplicate and rename the u* files into the v*, or this would mess up something?
And a quick question: the results are in m/s, right?
Many thanks
Maurizio