Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CATS2008 compute_tidal_elevations.py AttributeError: 'model' object has no attribute 'minor' #320

Closed
suzannelbevan opened this issue Aug 20, 2024 · 13 comments

Comments

@suzannelbevan
Copy link

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

@suzannelbevan
Copy link
Author

PS I see I can comment out line 340 to avoid the error.

@tsutterley
Copy link
Owner

tsutterley commented Aug 20, 2024

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.

@suzannelbevan
Copy link
Author

suzannelbevan commented Aug 20, 2024 via email

@tsutterley
Copy link
Owner

That works fine. I can't currently recreate this error, but I'll try to track it down.

@tsutterley
Copy link
Owner

if you check the version, what do you get?

>>> import pyTMD
>>> pyTMD.version.version
'2.1.5.dev1+g4275e2d'

@suzannelbevan
Copy link
Author

Sorry for the delay. I have version 2.1.4

@tsutterley
Copy link
Owner

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.

@suzannelbevan
Copy link
Author

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?

@tsutterley
Copy link
Owner

Sure, I exposed that in #321. Note that now you need to use --format GTiff

tsutterley added a commit that referenced this issue Aug 22, 2024
* refactor: change `'geotiff'` to `'GTiff'` and `'cog'` for #320

* Create pyproject.toml
@suzannelbevan
Copy link
Author

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.

@tsutterley
Copy link
Owner

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.

@tsutterley
Copy link
Owner

I created a release (2.1.5) that should simplify your workflows (can now be directly installed with pip for the latest version).

@suzannelbevan
Copy link
Author

That works great, thanks Tyler. I admit I'd not had much luck with getting the pre-release version of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants