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

Should we decouple download from regridding for bathymetry? #389

Open
navidcy opened this issue Mar 9, 2025 · 2 comments · May be fixed by #391
Open

Should we decouple download from regridding for bathymetry? #389

navidcy opened this issue Mar 9, 2025 · 2 comments · May be fixed by #391
Labels
bathymetry ⛰️ When things aren't as smooth as expected question Further information is requested user interface When humans and machines miscommunicate

Comments

@navidcy
Copy link
Collaborator

navidcy commented Mar 9, 2025

At the moment, regrid_bathymetry

function regrid_bathymetry(target_grid;

both downloads the bathymetry dataset and regrids. Me and @taimoorsohail were envisioning something like where

filepath = joinpath(dir, filename)
# No need for @root here, because only rank 0 accesses this function
if !isfile(filepath)
Downloads.download(url, filepath; progress=download_progress)
end
dataset = Dataset(filepath, "r")

are a separate download_bathymetry method.

@navidcy navidcy added bathymetry ⛰️ When things aren't as smooth as expected question Further information is requested user interface When humans and machines miscommunicate labels Mar 9, 2025
@glwagner
Copy link
Member

glwagner commented Mar 9, 2025

Why can't you just define

function download_bathymetry
 # No need for @root here, because only rank 0 accesses this function 
 if !isfile(filepath) 
     Downloads.download(url, filepath; progress=download_progress) 
 end
end 

and then call download_bathymetry inside regrid_bathymetry?

There is an old issue about improving the name of regrid_bathymetry too I think which has not been addressed.

@glwagner
Copy link
Member

glwagner commented Mar 9, 2025

But if there is a reason to "enforce" a workflow, I am up for it. I like to think of software development as building out features that people can use for a variety of purposes, rather than enforcing a workflow. It's quite trivial to define a function download_bathymetry that would be useful, and we don't have to change any existing tests or examples. Not having to change tests or examples makes it something that might take just a few minutes to implement. Would you like me to implement it?

If we have some motivation to actually discontinue support for downloading bathymetry inside regrid_bathymetry though, we can do that. I don't see it right away, because regrid_bathymetry already checks for an existing file. So if you choose to call download_bathymetry prior to regrid_bathymetry, it seems like you have effectively achieved downloading and regridding in separate functions.

@glwagner glwagner linked a pull request Mar 9, 2025 that will close this issue
@navidcy navidcy linked a pull request Mar 9, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bathymetry ⛰️ When things aren't as smooth as expected question Further information is requested user interface When humans and machines miscommunicate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants