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

set local source for tidal forcing #872

Open
thopri opened this issue Jun 4, 2024 · 3 comments
Open

set local source for tidal forcing #872

thopri opened this issue Jun 4, 2024 · 3 comments

Comments

@thopri
Copy link

thopri commented Jun 4, 2024

Hi,

Can I request a way to set a custom tide forcing location? At the moment I need to edit the source code of interpolate_grid2gnd.py as the local forcing location of GTSMv4.1 is hard coded so I can use my own hard coded location! :)

I will probably get round to creating a PR eventually, but having the option to dynamically set a location for the tide forcing would be useful maybe an optional argument in the tide interpolation function below?

dfmt.interpolate_tide_to_bc(tidemodel=tidemodel, file_pli=poly_file, component_list=None)

@veenstrajelmer
Copy link
Collaborator

Thanks for this suggestion, this part of the code is still quite hard-coded indeed. Which tide model are you currently using?

@thopri
Copy link
Author

thopri commented Jun 4, 2024

I am currently using GTSM but a downloaded version, I had issues with the opendap version that I can't quite recall. We also have our own global tide model that I will want to be able to use (will need to make it compatible). I also use FES2014 a lot, and would probably want to use this (I know this an option in DFM_tools already).

@veenstrajelmer
Copy link
Collaborator

Ok, I think in that case for now it would be most convenient for you to use the functions that are used by dfmt.interpolate_tide_to_bc():

def interpolate_tide_to_bc(tidemodel, file_pli, component_list=None, nPoints=None, load=True):
gdf_points = read_polyfile_as_gdf_points(file_pli, nPoints=nPoints)
data_interp = interpolate_tide_to_plipoints(tidemodel=tidemodel, gdf_points=gdf_points,
component_list=component_list, load=load)
ForcingModel_object = plipointsDataset_to_ForcingModel(plipointsDataset=data_interp)

If you read in your own tidal dataset and interpolate it with dfmt.interp_regularnc_to_plipointsDataset() like is done here:
https://github.com/Deltares/dfm_tools/blob/03cabed8174f33a857823510aacb536531a7c8df/dfm_tools/interpolate_grid2bnd.py#L237C19-L238

This gives what you need by using the underlying modules from the dfm_tools code, so it would at least prevent you from having to edit the source code of dfm_tools.

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