Skip to content

Milestones required in order to bump ERA5Reanalysis.jl to v0.5 #15

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
61 changes: 22 additions & 39 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
tags: '*'
tags: ['*']
paths:
- src/**
- test/**
- .github/workflows/CI.yml
- Project.toml
workflow_dispatch:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
actions: write
contents: read
strategy:
fail-fast: false
matrix:
version:
- '1.10' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'.
- '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia.
- '1'
- '1.10'
os:
- ubuntu-latest
arch:
Expand All @@ -27,41 +39,12 @@ jobs:
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v5
with:
file: lcov.info
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- run: |
julia --project=docs -e '
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()'
- run: |
julia --project=docs -e '
using Documenter: doctest
using ERA5Reanalysis
doctest(ERA5Reanalysis)'
- run: julia --project=docs docs/make.jl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
5 changes: 2 additions & 3 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
name: CompatHelper

on:
schedule:
- cron: 0 0 1 * *

workflow_dispatch:
jobs:
CompatHelper:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
50 changes: 50 additions & 0 deletions .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Documentation
on:
push:
branches:
- main
tags: ['*']
paths:
- docs/**
- src/**
- test/**
- .github/workflows/Documentation.yml
- Project.toml
workflow_dispatch:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
docs:
name: Documentation
runs-on: ubuntu-latest
permissions:
actions: write # needed to allow julia-actions/cache to proactively delete old caches that it has created
contents: write
statuses: write
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: julia-actions/cache@v2
- name: Configure doc environment
shell: julia --project=docs --color=yes {0}
run: |
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
- name: Run doctests
shell: julia --project=docs --color=yes {0}
run: |
using Documenter: DocMeta, doctest
using ERA5Reanalysis
DocMeta.setdocmeta!(ERA5Reanalysis, :DocTestSetup, :(using ERA5Reanalysis); recursive=true)
doctest(ERA5Reanalysis)
16 changes: 16 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ on:
types:
- created
workflow_dispatch:
inputs:
lookback:
default: "3"
permissions:
actions: read
checks: read
contents: write
deployments: read
issues: read
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
Expand Down
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ERA5Reanalysis"
uuid = "99c076f5-c00e-46eb-a0bd-7ba31777c146"
authors = ["Nathanael Wong <[email protected]>"]
version = "0.4.0"
version = "0.5.0"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand All @@ -23,16 +23,16 @@ UnitfulParsableString = "06c00241-927a-4d5b-bb5e-6b5a2ada3567"
[compat]
Dates = "1"
DelimitedFiles = "1"
GeoRegions = "7"
GeoRegions = "^8.0.1"
HTTP = "1"
JSON3 = "1"
LandSea = "0.0.2"
LandSea = "0.1"
Logging = "1"
NCDatasets = "0.14"
PrettyTables = "2"
Printf = "1"
Reexport = "1"
RegionGrids = "0.0.5"
RegionGrids = "0.1"
Statistics = "1"
Unitful = "1"
UnitfulParsableString = "0.1"
Expand Down
1 change: 0 additions & 1 deletion src/ERA5Reanalysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,5 @@ include("save/define.jl")
include("save/hourly.jl")
include("save/daily.jl")
include("save/monthly.jl")
include("save/extract.jl")

end
43 changes: 3 additions & 40 deletions src/downloads/cdsretrieve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,6 @@ function cdsretrieve(

if !isfile(fnc) || overwrite
retrieve(cdsretrieve_dataset(evar,e5ds),e5dkey,fnc,ckeys)
# tryretrieve = 0
# while isinteger(tryretrieve) && (tryretrieve < 20)
# try
# retrieve(cdsretrieve_dataset(evar,e5ds),e5dkey,fnc,ckeys)
# tryretrieve += 0.5
# catch
# tryretrieve += 1
# @info "$(modulelog()) - Failed to retrieve/request data from CDSAPI on Attempt $(tryretrieve) of 20"
# end
# end
# if tryretrieve == 20
# @warn "$(modulelog()) - Failed to retrieve/request data, skipping to next set of requests"
# end
end

flush(stderr)
Expand Down Expand Up @@ -176,19 +163,7 @@ function cdsretrievegrib(
cdsretrieve_area!(e5dkey,ereg)

if !isfile(fnc) || overwrite
tryretrieve = 0
while isinteger(tryretrieve) && (tryretrieve < 20)
try
retrieve(cdsretrieve_dataset(evar,e5ds),e5dkey,fnc,ckeys)
tryretrieve += 0.5
catch
tryretrieve += 1
@info "$(modulelog()) - Failed to retrieve/request data from CDSAPI on Attempt $(tryretrieve) of 20"
end
end
if tryretrieve == 20
@warn "$(modulelog()) - Failed to retrieve/request data, skipping to next set of requests"
end
retrieve(cdsretrieve_dataset(evar,e5ds),e5dkey,fnc,ckeys)
end

flush(stderr)
Expand Down Expand Up @@ -237,19 +212,7 @@ function cdsretrieve(
cdsretrieve_area!(e5dkey,ereg)

if !isfile(inc) || overwrite
tryretrieve = 0
while isinteger(tryretrieve) && (tryretrieve < 20)
try
retrieve(cdsretrieve_dataset(evar[1],e5ds),e5dkey,fnc,ckeys)
tryretrieve += 0.5
catch
tryretrieve += 1
@info "$(modulelog()) - Failed to retrieve/request data from CDSAPI on Attempt $(tryretrieve) of 20"
end
end
if tryretrieve == 20
@warn "$(modulelog()) - Failed to retrieve/request data, skipping to next set of requests"
end
retrieve(cdsretrieve_dataset(evar,e5ds),e5dkey,fnc,ckeys)
split(e5ds,evar,ereg,lsd,dtii,fnc,tmpd)
end

Expand All @@ -273,7 +236,7 @@ function cdsretrieve_area!(

if !(ereg.isglb)
geo = ereg.geo
dkeys["area"] = geo.bound[1,4,2,3]
dkeys["area"] = [geo.N, geo.W, geo.S, geo.E]
end

return
Expand Down
46 changes: 10 additions & 36 deletions src/downloads/downloads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,11 @@ function download(
e5ds :: ERA5CDStore,
evar :: SingleVariable,
ereg :: ERA5Region;
ispy :: Bool = false,
grib :: Bool = false,
overwrite :: Bool = false
)

downloadcheckereg(ereg)

if ispy
pythonprint(e5ds,evar,ereg)
else; cdsretrieve(e5ds,evar,ereg,grib,overwrite)
end
cdsretrieve(e5ds,evar,ereg,grib,overwrite)

end

Expand Down Expand Up @@ -71,7 +65,6 @@ function download(
overwrite :: Bool = false
)

downloadcheckereg(ereg)
cdsretrieve(e5ds,evar,ereg,overwrite)

end
Expand Down Expand Up @@ -113,7 +106,6 @@ function download(
e5ds :: ERA5CDStore,
evar :: PressureVariable,
ereg :: ERA5Region;
ispy :: Bool = false,
pall :: Bool = false,
ptop :: Int = 0,
pbot :: Int = 0,
Expand All @@ -122,23 +114,17 @@ function download(
overwrite :: Bool = false
)

downloadcheckereg(ereg)

if ispy
pythonprint(e5ds,evar,ereg)
else
if pvec == [0] || iszero(evar.hPa)
pvec = downloadcheckplvl(pall,ptop,pbot)
end
if pall
if !grib
cdsretrieve(e5ds,evar,ereg,pvec,overwrite)
else
cdsretrievegrib(e5ds,evar,ereg,pvec,overwrite)
end
if pvec == [0] || iszero(evar.hPa)
pvec = downloadcheckplvl(pall,ptop,pbot)
end
if pall
if !grib
cdsretrieve(e5ds,evar,ereg,pvec,overwrite)
else
cdsretrieve(e5ds,evar,ereg,grib,overwrite)
cdsretrievegrib(e5ds,evar,ereg,pvec,overwrite)
end
else
cdsretrieve(e5ds,evar,ereg,grib,overwrite)
end

end
Expand All @@ -155,18 +141,6 @@ function downloadcheckhPa(

end

function downloadcheckereg(
ereg :: ERA5Region
)

if !(typeof(ereg.geo) <: RectRegion)

error("$(modulelog()) - ERA5Reanalysis is not yet set up to download GeoRegions that are not RectRegions. Check back in a later update for more.")

end

end

function downloadcheckplvl(
pall :: Bool,
ptop :: Int,
Expand Down
Loading