Skip to content

Commit

Permalink
Remove rasterization functions (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
meggart authored Jun 9, 2023
1 parent e5067fe commit e2dd142
Show file tree
Hide file tree
Showing 5 changed files with 248 additions and 248 deletions.
10 changes: 3 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "EarthDataLab"
uuid = "359177bc-a543-11e8-11b7-bb015dba3358"
authors = ["Fabian Gans <[email protected]>"]
version = "0.10.0"
version = "0.11.0"

[deps]
CFTime = "179af706-886a-5703-950a-314cd64e0468"
Expand All @@ -10,12 +10,10 @@ DiskArrayTools = "fcd2136c-9f69-4db6-97e5-f31981721d63"
DiskArrays = "3c3547ce-8d99-4f5e-a174-61eb10b00ae3"
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
NetCDF = "30363a11-5582-574a-97bb-aa9a979735b9"
OnlineStats = "a15396b6-48d5-5d58-9928-6d29437db91e"
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
Shapefile = "8e980c4a-a4fe-5da2-b3a7-4b4b0353a2f4"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
Expand All @@ -28,16 +26,14 @@ CFTime = "0.1"
DiskArrayTools = "0.1"
DiskArrays = "0.2, 0.3"
FFTW = "1"
GeoInterface = "0.4, 0.5, 1"
NetCDF = "0.11"
OnlineStats = "1"
Polynomials = "1, 2.0, 3"
Shapefile = "0.6, 0.7, 0.8"
StatsBase = "0.32, 0.33"
StatsBase = "0.32, 0.33, 0.34"
Tables = "0.2, 1.0"
WeightedOnlineStats = "0.5, 0.6"
YAXArrays = "0.4"
Zarr = "0.6.2, 0.7"
Zarr = "0.9"
julia = "1.6"

[extras]
Expand Down
91 changes: 45 additions & 46 deletions src/ESDLTools.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module ESDLTools
using Distributed
import ..EarthDataLab: ESDLdir
export freshworkermodule, passobj, @everywhereelsem,
@loadOrGenerate, PickAxisArray
struct PickAxisArray{T,N,AT<:AbstractArray,P,PERM}
Expand Down Expand Up @@ -62,57 +61,57 @@ function Base.eltype(p::PickAxisArray{T}) where T
end
Base.getindex(p::PickAxisArray,i::CartesianIndex) = p[i.I...]

"""
macro loadOrGenerate(x...,expression)
# """
# macro loadOrGenerate(x...,expression)

Takes a list of `variablename=>"Storage Name"` pairs. Checks if all datasets can be found
on disk and loads them. If not, the datasets will be regenerated by evaluating the given expression.
# Takes a list of `variablename=>"Storage Name"` pairs. Checks if all datasets can be found
# on disk and loads them. If not, the datasets will be regenerated by evaluating the given expression.

To force recalculation, call `EarthDataLab.recalculate(true)` before evaluating the macro.
# To force recalculation, call `EarthDataLab.recalculate(true)` before evaluating the macro.

### Example
# ### Example

The following lines will check if cubes with the names "Filled" and "Normalized"
exist on disk, load them and assign the variable names `cube_filled` and `cube_norm`.
If the datasets to not exist on disk, they are generated and saved under the given names.
# The following lines will check if cubes with the names "Filled" and "Normalized"
# exist on disk, load them and assign the variable names `cube_filled` and `cube_norm`.
# If the datasets to not exist on disk, they are generated and saved under the given names.

````julia
@loadOrGenerate cube_filled=>"Filled" cube_norm=>"Normalized" begin
cube_filled = mapCube(gapFillMSC,d)
cube_norm = mapCube(normalize_TS,d)
end
# ````julia
# @loadOrGenerate cube_filled=>"Filled" cube_norm=>"Normalized" begin
# cube_filled = mapCube(gapFillMSC,d)
# cube_norm = mapCube(normalize_TS,d)
# end

````
"""
macro loadOrGenerate(x...)
code=x[end]
x=x[1:end-1]
x2=map(x) do i
isa(i,Symbol) ? (i,string(i)) : (i.head==:call && i.args[1]==:(=>)) ? (i.args[2],i.args[3]) : error("Wrong Argument type")
end
xnames=map(i->i[2],x2)
loadEx=map(x2) do i
:($(i[1]) = loadcube($(i[2])))
end
loadEx=Expr(:block,loadEx...)
saveEx=map(x2) do i
:(savecube($(i[1]),$(i[2])))
end
saveEx=Expr(:block,saveEx...)
rmEx=map(x2) do i
:(rmcube($(i[2])))
end
rmEx=Expr(:block,rmEx...)
esc(quote
if !EarthDataLab.recalculate() && all(i->isdir(joinpath(ESDLdir(),i)),$xnames)
$loadEx
else
$rmEx
$code
$saveEx
end
end)
end
# ````
# """
# macro loadOrGenerate(x...)
# code=x[end]
# x=x[1:end-1]
# x2=map(x) do i
# isa(i,Symbol) ? (i,string(i)) : (i.head==:call && i.args[1]==:(=>)) ? (i.args[2],i.args[3]) : error("Wrong Argument type")
# end
# xnames=map(i->i[2],x2)
# loadEx=map(x2) do i
# :($(i[1]) = loadcube($(i[2])))
# end
# loadEx=Expr(:block,loadEx...)
# saveEx=map(x2) do i
# :(savecube($(i[1]),$(i[2])))
# end
# saveEx=Expr(:block,saveEx...)
# rmEx=map(x2) do i
# :(rmcube($(i[2])))
# end
# rmEx=Expr(:block,rmEx...)
# esc(quote
# if !EarthDataLab.recalculate() && all(i->isdir(joinpath(ESDLdir(),i)),$xnames)
# $loadEx
# else
# $rmEx
# $code
# $saveEx
# end
# end)
# end

# Here we define ouur own reexport macro copied from
# https://github.com/simonster/Reexport.jl/blob/master/src/Reexport.jl
Expand Down
2 changes: 1 addition & 1 deletion src/MSC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function getMedSC(aout::AbstractVector{Union{T,Missing}},ain::AbstractVector) wh
for doy=1:NpY
empty!(yvec)
for i=doy:NpY:length(ain)
ismissing(ain[i]) || push!(yvec,ain[i])
ismissing(ain[i]) || isnan(ain[i]) || push!(yvec,ain[i])
end
aout[doy] = isempty(yvec) ? missing : quantile!(yvec,q)[1]
end
Expand Down
Loading

2 comments on commit e2dd142

@meggart
Copy link
Member Author

@meggart meggart commented on e2dd142 Jun 9, 2023

Choose a reason for hiding this comment

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

@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/85195

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 v0.11.0 -m "<description of version>" e2dd142f12f250fd3bf972251cc3b3054afa52d7
git push origin v0.11.0

Please sign in to comment.