CATS2008 compute_tidal_elevations.py AttributeError: 'model' object has no attribute 'minor'
Hi tsutterley,
I have been able to successfully use CATS2008 with pyTMD.compute.tide_elevations, but running the compute_tidal_elevations.py gives me the error AttributeError: 'model' object has no attribute 'minor'.
e.g. python compute_tidal_elevations.py --directory /mnt/raid1/suzanne/ripice --tide CATS2008-v2023 --format geotiff --projection 3031 --type grid in.tif out.tif
I have also tried with CATS2008_V2023
Sorry I'm only a python beginner so may be doing something basic wrong.
Thanks, Suzanne
PS I see I can comment out line 340 to avoid the error.
Have you installed pyTMD before? The minor attribute is super new and only in the "bleeding edge". I'm thinking this might be a version conflict issue.
Hi, thanks for getting back. I've only just started to use it pyTMD so not downloaded before. I'm trying to find an alternative to using Matlab to implement a tidal correction. Ideally to work on grid files. If it's ok to just comment out the minor constituents bit I am happy to go with that.
Dr Suzanne Bevan Geography Dept Swansea University Singleton Park Swansea SA2 8PP 01792 602375
From: Tyler Sutterley @.> Sent: 20 August 2024 15:54 To: tsutterley/pyTMD @.> Cc: Suzanne Bevan @.>; Author @.> Subject: Re: [tsutterley/pyTMD] CATS2008 compute_tidal_elevations.py AttributeError: 'model' object has no attribute 'minor' (Issue #320)
You don't often get email from @.*** Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification
CAUTION: This email originated from outside of Swansea University. Do not click links or open attachments unless you recognise the sender and know the content is safe.
RHYBUDD: Daeth yr e-bost hwn o'r tu allan i Brifysgol Abertawe. Peidiwch â chlicio ar atodiadau neu agor atodiadau oni bai eich bod chi'n adnabod yr anfonwr a'ch bod yn gwybod bod y cynnwys yn ddiogel.
Have you installed pyTMD before? The minor attribute is super new and only in the "bleeding edge".
— Reply to this email directly, view it on GitHubhttps://github.com/tsutterley/pyTMD/issues/320#issuecomment-2299060972, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A7EZUXITXTFCARP6CRGHKJDZSNKBZAVCNFSM6AAAAABMZ3EIN6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJZGA3DAOJXGI. You are receiving this because you authored the thread.Message ID: @.***>
That works fine. I can't currently recreate this error, but I'll try to track it down.
if you check the version, what do you get?
>>> import pyTMD
>>> pyTMD.version.version
'2.1.5.dev1+g4275e2d'
Sorry for the delay. I have version 2.1.4
Ok! Yes, this is likely a version conflict issue (running a newer version of compute_tidal_elevations.py than the installed package). It should hopefully run smoothly if you run:
compute_tidal_elevations.py --directory /mnt/raid1/suzanne/ripice --tide CATS2008-v2023 --format geotiff --projection 3031 --type grid in.tif out.tif
(no python in the beginning) This would run the executable version that is installed with the package.
thank you, I will try that tomorrow. A second issue I had was needing to change the default geotiff driver in spatial.py from cog to GTiff. Is it possible to supply this via the call to compute_tidal_elevations.py?
Sure, I exposed that in #321. Note that now you need to use --format GTiff
So now I can use GTiff with the git cloned version of compute_tidal_elevations.py, but which still has the model.minor error. OK because I can comment out line 342.
One other small issue, somehow pip install pyTMD upgraded numpy to version 2, which then doesn't allow pyTMD to be imported. Sorry for my inexperience with python and github.
Thanks for your help.
No worries! There's definitely a learning curve to python and GitHub. I haven't made a release yet so pip installing will currently only install the "stable" version (2.1.4). There's still a few additions I want to make before releasing a potential 2.1.5.
For now, I think you can install the "bleeding edge" version directly using
python3 -m pip install --user git+https://github.com/tsutterley/pyTMD.git
This will install the latest version directly from the GitHub repo.
I created a release (2.1.5) that should simplify your workflows (can now be directly installed with pip for the latest version).
That works great, thanks Tyler. I admit I'd not had much luck with getting the pre-release version of it.