Skip to content

Commit

Permalink
CHELSA url changed? (#283)
Browse files Browse the repository at this point in the history
* bug: fix CHELSA1 url

* bug(datasets): chelsa v2 url

* semver(datasets): v0.2.3

* bug: fix errant typo

* bug(dataset): chelsa2 future

* bug(datasets): chelsa v2 future

* doc: fix demo

* doc: fig size instead of resolution

* bug: doc
  • Loading branch information
tpoisot authored Sep 26, 2024
1 parent 9ef4952 commit a1aae3c
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion SimpleSDMDatasets/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SimpleSDMDatasets"
uuid = "2c7d61d0-5c73-410d-85b2-d2e7fbbdcefa"
authors = ["Timothée Poisot <[email protected]>"]
version = "0.2.2"
version = "0.2.3"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
4 changes: 2 additions & 2 deletions SimpleSDMDatasets/src/providers/CHELSA/chelsa_future_v1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function source(
) where {T <: BioClim, S <: CHELSA1Scenario, M <: CHELSA1Model}
var_code = (layer isa Integer) ? layer : findfirst(isequal(layer), layers(data))
year_sep = string(timespan.first.value) * "-" * string(timespan.second.value)
root = "https://os.zhdk.cloud.switch.ch/envicloud/chelsa/chelsa_V1/cmip5/$(year_sep)/bio/"
root = "https://os.zhdk.cloud.switch.ch/chelsav1/cmip5/$(year_sep)/bio/"
stem = "CHELSA_bio_mon_$(replace(string(M), "_" => "-"))_$(lowercase(string(S)))_r1i1p1_g025.nc_$(var_code)_$(year_sep)_V1.2.tif"
return (
url = root * stem,
Expand All @@ -88,7 +88,7 @@ function source(
Dict(["pr" => "prec", "tasmin" => "tmin", "tas" => "temp", "tasmax" => "tmax"])
month_code = string(month.value)
year_sep = string(timespan.first.value) * "-" * string(timespan.second.value)
root = "https://os.zhdk.cloud.switch.ch/envicloud/chelsa/chelsa_V1/cmip5/$(year_sep)/$(var_url[var_code])/"
root = "https://os.zhdk.cloud.switch.ch/chelsav1/cmip5/$(year_sep)/$(var_url[var_code])/"
stem = "CHELSA_$(var_code)_mon_$(replace(string(M), "_" => "-"))_$(lowercase(string(S)))_r1i1p1_g025.nc_$(month_code)_$(year_sep)_V1.2.tif"
return (
url = root * stem,
Expand Down
6 changes: 4 additions & 2 deletions SimpleSDMDatasets/src/providers/CHELSA/chelsa_future_v2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function source(
var_code = (layer isa Integer) ? layer : findfirst(isequal(layer), layers(data))
year_sep = string(timespan.first.value) * "-" * string(timespan.second.value)
model_sep = replace(uppercase(string(M)) * "/" * lowercase(string(S)), "_" => "-")
root = "https://envicloud.wsl.ch/envicloud/chelsa/chelsa_V2/GLOBAL/climatologies/$(year_sep)/$(model_sep)/bio/"
root = "https://os.zhdk.cloud.switch.ch/chelsav2/GLOBAL/climatologies/$(year_sep)/$(model_sep)/bio/"
stem = "CHELSA_bio$(var_code)_$(year_sep)_$(lowercase(replace(string(M), "_" => "-")))_$(lowercase(string(S)))_V.2.1.tif"
return (
url = root * stem,
Expand All @@ -44,8 +44,10 @@ function source(
month_code = lpad(string(month.value), 2, '0')
year_sep = string(timespan.first.value) * "-" * string(timespan.second.value)
model_code = replace(uppercase(string(M)), "_" => "-")
model_sep = replace(uppercase(string(M)) * "/" * lowercase(string(S)), "_" => "-")
scenario_code = replace(lowercase(string(S)), "_" => "-")
root = "https://envicloud.wsl.ch/envicloud/chelsa/chelsa_V2/GLOBAL/climatologies/$(year_sep)/$(model_code)/$(scenario_code)/$(var_code)/"
scenario_sep = lowercase(string(S))
root = "https://os.zhdk.cloud.switch.ch/chelsav2/GLOBAL/climatologies/$(year_sep)/$(model_sep)/$(var_code)/"
stem = "CHELSA_$(lowercase(model_code))_r1i1p1f1_w5e5_$(scenario_code)_$(var_code)_$(month_code)_$(replace(year_sep, "-"=>"_"))_norm.tif"
return (
url = root * stem,
Expand Down
6 changes: 3 additions & 3 deletions SimpleSDMDatasets/src/providers/CHELSA/chelsa_v1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ _var_slug(::RasterData{CHELSA1, Precipitation}) = "prec"
function source(data::RasterData{CHELSA1, Precipitation}; month = Month(1))
var_code = _var_slug(data)
month_code = lpad(string(month.value), 2, '0')
root = "https://envicloud.wsl.ch/envicloud/chelsa/chelsa_V1/climatologies/$(var_code)/"
root = "https://os.zhdk.cloud.switch.ch/chelsav1/climatologies/$(var_code)/"
stem = "CHELSA_$(var_code)_$(month_code)_V1.2_land.tif"
return (
url = root * stem,
Expand All @@ -89,7 +89,7 @@ end
function source(data::RasterData{CHELSA1, T}; month = Month(1)) where {T <: CHELSA1Dataset}
var_code = _var_slug(data)
month_code = lpad(string(month.value), 2, '0')
root = "https://envicloud.wsl.ch/envicloud/chelsa/chelsa_V1/climatologies/$(var_code)/"
root = "https://os.zhdk.cloud.switch.ch/chelsav1/climatologies/$(var_code)/"
layer_code = (T <: AverageTemperature) ? "temp" : var_code
stem = "CHELSA_$(layer_code)10_$(month_code)_1979-2013_V1.2_land.tif"
return (
Expand All @@ -102,7 +102,7 @@ end
function source(data::RasterData{CHELSA1, BioClim}; layer = "BIO1")
var_code = (layer isa Integer) ? layer : findfirst(isequal(layer), layers(data))
var_pad = lpad(string(var_code), 2, '0')
root = "https://envicloud.wsl.ch/envicloud/chelsa/chelsa_V1/climatologies/bio/"
root = "https://os.zhdk.cloud.switch.ch/chelsav1/climatologies/bio/"
stem = "CHELSA_bio10_$(var_pad).tif"
return (
url = root * stem,
Expand Down
4 changes: 2 additions & 2 deletions SimpleSDMDatasets/src/providers/CHELSA/chelsa_v2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ _var_slug(::RasterData{CHELSA2, BioClim}) = "bio"
# Get the dataset source
function source(data::RasterData{CHELSA2, BioClim}; layer = "BIO1")
var_code = (layer isa Integer) ? layer : findfirst(isequal(layer), layers(data))
root = "https://envicloud.wsl.ch/envicloud/chelsa/chelsa_V2/GLOBAL/climatologies/1981-2010/bio/"
root = "https://os.zhdk.cloud.switch.ch/chelsav2/GLOBAL/climatologies/1981-2010/bio/"
stem = "CHELSA_bio$(var_code)_1981-2010_V.2.1.tif"
return (
url = root * stem,
Expand All @@ -82,7 +82,7 @@ end
function source(data::RasterData{CHELSA2, T}; month = Month(1)) where {T <: CHELSA2Dataset}
var_code = _var_slug(data)
month_code = lpad(string(month.value), 2, '0')
root = "https://envicloud.wsl.ch/envicloud/chelsa/chelsa_V2/GLOBAL/climatologies/1981-2010/$(var_code)/"
root = "https://os.zhdk.cloud.switch.ch/chelsav2/GLOBAL/climatologies/1981-2010/$(var_code)/"
stem = "CHELSA_$(var_code)_$(month_code)_1981-2010_V.2.1.tif"
return (
url = root * stem,
Expand Down
2 changes: 1 addition & 1 deletion docs/src/howto/makie.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CairoMakie.activate!(; type = "png", px_per_unit = 3.0) #hide

spatial_extent = (; left = -4.87, right=9.63, bottom=41.31, top=51.14)
data_prov = RasterData(CHELSA1, BioClim)
temperature = SDMLayer(data_prov; layer="BIO1", spatial_extent...)
temperature = 0.1SDMLayer(data_prov; layer="BIO1", spatial_extent...)
precipitation = SDMLayer(data_prov; layer="BIO8", spatial_extent...)

# ::: info Additional arguments
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/arithmetic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ rescale!(resistance_layer)
resistance_map = heatmap(
resistance_layer;
colormap = Reverse(:linear_protanopic_deuteranopic_kbjyw_5_95_c25_n256),
figure = (; resolution = (400, 350)),
figure = (; size = (400, 350)),
axis = (;
aspect = DataAspect(),
xlabel = "Latitude",
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/futureclimate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ end
fig, ax, hm = heatmap(
Δclim;
colormap = :lipari,
figure = (; resolution = (800, 400)),
figure = (; size = (800, 400)),
axis = (; aspect = DataAspect()),
)
Colorbar(fig[:, end + 1], hm)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/layers_and_occurrences.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ end
# indexing method to extract the values from the layers at the location of each
# occurrence.

figure = Figure(; resolution = (800, 400))
figure = Figure(; size = (800, 400))

envirovars =
Axis(figure[1, 1]; xlabel = "Temperature (°C)", ylabel = "Precipitation (kg×m⁻²)")
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/polygons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ SpeciesDistributionToolkit.gadmlist("FRA", 3)[1:3]
# The next step is to get a layer, and so we will download the data about
# deciduous broadleaf trees from [EarthEnv](/datasets/EarthEnv#landcover):

provider = RasterData(EartheEnv, LandCover)
provider = RasterData(EarthEnv, LandCover)
layer = SDMLayer(
provider;
layer = "Deciduous Broadleaf Trees",
Expand Down
6 changes: 3 additions & 3 deletions docs/src/tutorials/pseudoabsences.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ heatmap(
temperature;
colormap = :deep,
axis = (; aspect = DataAspect()),
figure = (; resolution = (800, 500)),
figure = (; size = (800, 500)),
)
heatmap!(bgmask; colormap = cgrad([:transparent, :white]; alpha = 0.3))
scatter!(presences; color = :black)
Expand All @@ -87,7 +87,7 @@ heatmap(
temperature;
colormap = :deep,
axis = (; aspect = DataAspect()),
figure = (; resolution = (800, 500)),
figure = (; size = (800, 500)),
)
heatmap!(sre; colormap = cgrad([:transparent, :white]; alpha = 0.3))
scatter!(presences; color = :black)
Expand All @@ -108,7 +108,7 @@ heatmap(
temperature;
colormap = :deep,
axis = (; aspect = DataAspect()),
figure = (; resolution = (800, 500)),
figure = (; size = (800, 500)),
)
heatmap!(bgmask; colormap = cgrad([:transparent, :white]; alpha = 0.3))
scatter!(presences; color = :black)
Expand Down
6 changes: 3 additions & 3 deletions docs/src/tutorials/statistics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fig, ax, hm = heatmap(
z_temperature;
colormap = :broc,
colorrange = (-2, 2),
figure = (; resolution = (800, 400)),
figure = (; size = (800, 400)),
axis = (; aspect = DataAspect()),
)
Colorbar(fig[:, end + 1], hm)
Expand All @@ -62,7 +62,7 @@ current_figure() #hide
fig, ax, hm = heatmap(
rescale(precipitation, (0.0, 1.0));
colormap = :bamako,
figure = (; resolution = (800, 400)),
figure = (; size = (800, 400)),
axis = (; aspect = DataAspect()),
)
Colorbar(fig[:, end + 1], hm)
Expand All @@ -74,7 +74,7 @@ current_figure() #hide
fig, ax, hm = heatmap(
quantize(precipitation, 5);
colormap = :bamako,
figure = (; resolution = (800, 400)),
figure = (; size = (800, 400)),
axis = (; aspect = DataAspect()),
)
Colorbar(fig[:, end + 1], hm)
Expand Down

2 comments on commit a1aae3c

@tpoisot
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator register() subdir=SimpleSDMDatasets

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/116080

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a SimpleSDMDatasets-v0.2.3 -m "<description of version>" a1aae3c776f49fc152423cc9624c0b762e00e8f8
git push origin SimpleSDMDatasets-v0.2.3

Please sign in to comment.