You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Accessing list of model constituents for any supported pyTMD model #449
Hey Tyler, I'm looking for a way to access a list of valid constituent names for a given tide model. I can do this easily for models I have access to locally, e.g.:
Is there an easy way to get a list of consitituent names for any pyTMD-supported tide model, without having access to their files? I've had a look in the model database, but I can't see a list of standardised constituent names defined in there.
(My end goal is to support running a tide aliasing analysis for all constituents in a given model, based on the overpass frequency of certain EO satellites).
great question! Right now for several model types the constituents are parsed or read from the files. I should be able to update the database to add the constituent parameter for any of the models.
OK, makes sense! Not a high priority thing - I think for now I can just base it on models the user has installed, as that's probably the most useful option anyway. 🙂
So this likely isn't defined for non-FES models. Is there another way to get a list of model constituent names for a non-FES model like TPXO10, or would I need to read the model files first?
Hey @robbibt
Yeah, for models where it's just parsing the filenames to get the constituents (like the TPXO atlas models) you should just need to run the model's parse_constituents function.
Thanks @tsutterley! That's great to know. The only other issue I'm seeing now is that the list of returned constituents seems to be the full list supported by the model, and not any smaller subset of constituents the user has chosen to load - I'm not sure if that's because read_constants loads all available constituents (i.e. not just the requested subset), or because parse_constituents reads directly from the full list of file paths (i.e. not just the loaded constituents)
Activity
tsutterley commentedon Aug 18, 2025
great question! Right now for several model types the constituents are parsed or read from the files. I should be able to update the database to add the constituent parameter for any of the models.
robbibt commentedon Aug 19, 2025
OK, makes sense! Not a high priority thing - I think for now I can just base it on models the user has installed, as that's probably the most useful option anyway. 🙂
robbibt commentedon Sep 8, 2025
Hey @tsutterley, a possible related issue: I can do this to get a list of model constituents for most models:
However, if I do the same thing for TPXO10, this just returns
None:(I'm on
pyTMD==2.2.7)robbibt commentedon Sep 8, 2025
Ah, I just saw this:
So this likely isn't defined for non-FES models. Is there another way to get a list of model constituent names for a non-FES model like TPXO10, or would I need to read the model files first?
tsutterley commentedon Sep 8, 2025
Hey @robbibt
Yeah, for models where it's just parsing the filenames to get the constituents (like the TPXO atlas models) you should just need to run the model's
parse_constituentsfunction.robbibt commentedon Sep 8, 2025
Thanks @tsutterley! That's great to know. The only other issue I'm seeing now is that the list of returned constituents seems to be the full list supported by the model, and not any smaller subset of constituents the user has chosen to load - I'm not sure if that's because
read_constantsloads all available constituents (i.e. not just the requested subset), or becauseparse_constituentsreads directly from the full list of file paths (i.e. not just the loaded constituents)tsutterley commentedon Sep 8, 2025
oh in that case I think it might be even easier. You should just need to run:
OR! for all cases (including models where the constituents are not parsed from the filename)
robbibt commentedon Sep 8, 2025
The second option unfortunately doesn't seem to pick up the subset either:
But the first option works perfectly!
tsutterley commentedon Sep 8, 2025
Oh right I ran into that. Should be fixed in
2.2.8!But glad you have a solution!
robbibt commentedon Sep 8, 2025
Neat, yep, works great in
2.2.8:Thanks for the troubleshooting help!