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

Add additional models to provider JSON #331

Merged
merged 13 commits into from
Sep 6, 2024

Conversation

robbibt
Copy link
Contributor

@robbibt robbibt commented Sep 6, 2024

@tsutterley I've added the following new models to the relevant provider JSON files:

  • FES2012
  • FES2014_extrapolated
  • FES2022_extrapolated
  • GOT5.6
  • GOT5.6_extrapolated
  • TPXO8-atlas-nc

Have tested these locally and they seem to work:
image

However, I did find that my model definitions that use wildcard matching (e.g. "model_file": "TPXO8_atlas_v1/hf.*_tpxo8_atlas_30c_v1.nc") didn't recognise files in this new implementation, so I had to manually create the model file and constituent lists. I'm not experienced with this stuff so it would be great if you could double-check my changes and make sure I have specified them correctly/matched the right files to the right constituents!

@robbibt robbibt changed the title Add additional models to provider JSON DRAFT: Add additional models to provider JSON Sep 6, 2024
@@ -123,6 +123,83 @@
}
},
"elevation": {
"FES2012": {
"format": "FES-netcdf",
"constituents": [
Copy link
Contributor Author

@robbibt robbibt Sep 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is specifying constituents necessary, or will pyTMD auto-guess the constituent names? (previously, I had simply used "model_file": "fes2012/data/*_FES2012_SLEV.nc", but that wasn't being recognised here)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, the glob string capability isn't being run for the database as I figured the database will be more "maintained".

"m8",
"nu2"
],
"model_file": [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The one file I couldn't find a match for was Z0_FES2012_SLEV.nc - have left it out here for now

"fes2012/data/MS4_FES2012_SLEV.nc",
"fes2012/data/R2_FES2012_SLEV.nc",
"fes2012/data/Mu2_FES2012_SLEV.nc",
"fes2012/data/E2_FES2012_SLEV.nc",
Copy link
Contributor Author

@robbibt robbibt Sep 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is E2 a match for eps2?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the constituents from the database and am running the files through the parser as before. Should make maintenance easier :)

"fes2012/data/E2_FES2012_SLEV.nc",
"fes2012/data/S4_FES2012_SLEV.nc",
"fes2012/data/Ssa_FES2012_SLEV.nc",
"fes2012/data/La2_FES2012_SLEV.nc",
Copy link
Contributor Author

@robbibt robbibt Sep 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is La2 a match for l2? Or lambda2?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lambda2

"TPXO8-atlas-nc": {
"format": "ATLAS-netcdf",
"name": "TPXO8-atlas-nc",
"model_file": [
Copy link
Contributor Author

@robbibt robbibt Sep 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had previous used "model_file": "TPXO8_atlas_v1/hf.*_tpxo8_atlas_30c_v1.nc", so have attempted to adapt this to a list of model files

@robbibt robbibt changed the title DRAFT: Add additional models to provider JSON Add additional models to provider JSON Sep 6, 2024
@robbibt
Copy link
Contributor Author

robbibt commented Sep 6, 2024

Code used to test:

from pyTMD.compute import tide_elevations
import pandas as pd
import numpy as np


fes2014_extrap = tide_elevations(
    x=[122.269294],
    y=[-18.057430],
    delta_time=pd.date_range("2020", "2021", periods=50),
    DIRECTORY="/gdata1/data/tide_models_clipped/",
    MODEL="FES2014_extrapolated",
    EPSG=4326,
    TIME="datetime",
    EXTRAPOLATE=True,
    CUTOFF=np.inf,
)

fes2012 = tide_elevations(
    x=[122.269294],
    y=[-18.057430],
    delta_time=pd.date_range("2020", "2021", periods=50),
    DIRECTORY="/gdata1/data/tide_models_clipped/",
    MODEL="FES2012",
    EPSG=4326,
    TIME="datetime",
    EXTRAPOLATE=True,
    CUTOFF=np.inf,
)

fes2022_extrap = tide_elevations(
    x=[122.269294],
    y=[-18.057430],
    delta_time=pd.date_range("2020", "2021", periods=50),
    DIRECTORY="/gdata1/data/tide_models_clipped/",
    MODEL="FES2022_extrapolated",
    EPSG=4326,
    TIME="datetime",
    EXTRAPOLATE=True,
    CUTOFF=np.inf,
)

got56 = tide_elevations(
    x=[122.269294],
    y=[-18.057430],
    delta_time=pd.date_range("2020", "2021", periods=50),
    DIRECTORY="/gdata1/data/tide_models_clipped/",
    MODEL="GOT5.6",
    EPSG=4326,
    TIME="datetime",
    EXTRAPOLATE=True,
    CUTOFF=np.inf,
)

got56_extrap = tide_elevations(
    x=[122.269294],
    y=[-18.057430],
    delta_time=pd.date_range("2020", "2021", periods=50),
    DIRECTORY="/gdata1/data/tide_models_clipped/",
    MODEL="GOT5.6_extrapolated",
    EPSG=4326,
    TIME="datetime",
    EXTRAPOLATE=True,
    CUTOFF=np.inf,
)

tpxo8 = tide_elevations(
    x=[122.269294],
    y=[-18.057430],
    delta_time=pd.date_range("2020", "2021", periods=50),
    DIRECTORY="/gdata1/data/tide_models_clipped/",
    MODEL="TPXO8-atlas-nc",
    EPSG=4326,
    TIME="datetime",
    EXTRAPOLATE=True,
    CUTOFF=np.inf,
)

# Plot
pd.Series(fes2014_extrap, name="FES2014_extrapolated").plot(legend=True, figsize=(10, 5))
pd.Series(fes2012, name="FES2012").plot(legend=True)
pd.Series(fes2022_extrap, name="FES2022_extrapolated").plot(legend=True)
pd.Series(got56, name="GOT5.6").plot(legend=True)
pd.Series(got56_extrap, name="GOT5.6_extrapolated").plot(legend=True)
pd.Series(tpxo8, name="TPXO8-atlas-nc").plot(legend=True)

drop constituents from database
@tsutterley
Copy link
Owner

thanks @robbibt! Want to add yourself to the list of contributors?

@tsutterley tsutterley merged commit 1a1b015 into tsutterley:main Sep 6, 2024
3 checks passed
@robbibt robbibt deleted the add_models branch September 7, 2024 03:20
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

Successfully merging this pull request may close these issues.

2 participants