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

Breaking: Add future data for worldclim and improve climate model handling #69

Merged
merged 23 commits into from
Oct 9, 2024

Conversation

tiemvanderdeure
Copy link
Contributor

Defines all climate models in a loop instead of manually. This is breaking because the types will have different names (right now there isn't a very consistent system).

Also adds future worldclim.

src/worldclim/future.jl Outdated Show resolved Hide resolved
@rafaqz
Copy link
Member

rafaqz commented Sep 5, 2024

Guess we need to update the tests for all of the changed types

@tiemvanderdeure
Copy link
Contributor Author

I still have to add and fix the tests.

The file system for future worldclim is a little different than for current worldclim. For bioclimatic variables, there is just one file for all 19 bioclim variables, which are bands on the geotiff.

For now I just dropped the layer argument on the getraster signature, and then we can hack around with it in the Rasters extension, so you can still load it as a RasterStack and specifiy the layers - although all of them will inevitably get downloaded at the same time.

@rafaqz
Copy link
Member

rafaqz commented Sep 10, 2024

Can we allow the layer argument here and validate it but not use it?

Just for syntax consistency here with all the other bioclim things.

@tiemvanderdeure
Copy link
Contributor Author

What do you mean by validating? That layers should be an argument that would also be accepted by a signature with WorldClim{BioClim}?

I can add a dispatch with layers and that just doesn't forward them to the actual function, but otherwise I don't really see how we can make it work consistently.

A call like getraster(WorldClim{BioClim}, 1:5) would return a vector with 5 filenames. But the equivalent for the future would always return a single filename, so I don't think we really can make it consistent.

@rafaqz
Copy link
Member

rafaqz commented Sep 11, 2024

I mean we need to allow bioclim layer arguments and check they are actually bioclim names (as usual) so you can swap between bioclim data without changing the function call and always get a file download.

Writing different file structure to disk is probably inevitable. But we could actually return a vector of the same filename repeated so the returned variable is consistent.

Overall my point that consistency in getraster method signatures is very important for this package to not feel like a mess. I think it's the reason it gets a lot of clean PRs, because the patterns are simple and repeated.

In this case for me it would be cool if using the same code for Future or current Bioclim worked, just swapping the type. Users will of course have to adapt to the downloaded file being a different shape, but your getraster call for a :bio3 layer will at least still always give you the file that contains bio3, instead of throwing an error.

src/chelsa/future.jl Outdated Show resolved Hide resolved
@tiemvanderdeure
Copy link
Contributor Author

tiemvanderdeure commented Oct 3, 2024

Okay now I don't have anything more!

Test failures are still this codecov issue.

@tiemvanderdeure
Copy link
Contributor Author

@rafaqz this is good to go as far as I'm concerned.

@rafaqz rafaqz changed the title [WIP] Add future data for worldclim and improve climate model handling Breaking: Add future data for worldclim and improve climate model handling Oct 9, 2024
@rafaqz rafaqz merged commit a4d36d1 into EcoJulia:master Oct 9, 2024
2 of 4 checks passed
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