Skip to content

Commit

Permalink
Updating some logging for the final v1.0 push
Browse files Browse the repository at this point in the history
  • Loading branch information
natgeo-wong committed Feb 8, 2022
1 parent b89962d commit 125d0f4
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: julia-actions/setup-julia@latest
with:
version: 1.3
version: 1.6
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
Expand Down
6 changes: 3 additions & 3 deletions extra/pressurevariable.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# List of ERA5 Pressue-Level Variables (v0.1)
# (1)ID, (2)era5, (3)Full, (4)Units

u,u_component_of_wind,u-Wind,m s^{-1}
v,v_component_of_wind,v-Wind,m s^{-1}
w,vertical_velocity,w-Wind,m s^{-1}
u,u_component_of_wind,Zonal Wind,m s^{-1}
v,v_component_of_wind,Meridional Wind,m s^{-1}
w,lagrangian_tendency_of_air_pressure,Vertical Wind,Pa s^{-1}
t,temperature,Temperature,K
z,geopotential,Pressure Level Geopotential,m^2 s^{-2}
d,divergence,Divergence,s^{-1}
Expand Down
2 changes: 2 additions & 0 deletions src/downloads/cdsretrieve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ function cdsretrieve(
dtvec = cdsretrieve_dtvec(e5ds)
ckeys = cdskey()

@info "$(modulelog()) - Using CDSAPI in Julia to download $(uppercase(e5ds.lname)) $(evar.vname) data in $(ereg.geo.name) (Horizontal Resolution: $(ereg.gres)) from $(e5ds.dtbeg) to $(e5ds.dtend)."

for dtii in dtvec

fnc = e5dfnc(e5ds,evar,ereg,dtii)
Expand Down
2 changes: 2 additions & 0 deletions src/downloads/pythonprint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ function pythonprint(

fID = open(joinpath(fol,"$(fname).py"),"w")

@info "$(modulelog()) - Creating python download scripts to download $(uppercase(e5ds.lname)) $(evar.vname) data in $(ereg.geo.name) (Horizontal Resolution: $(ereg.gres)) from $(e5ds.dtbeg) to $(e5ds.dtend)."

write(fID,"#!/usr/bin/env python\n")
write(fID,"import cdsapi\n")
write(fID,"import os\n")
Expand Down
22 changes: 16 additions & 6 deletions src/variable/pressure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ function PressureVariable(
if vtype == "pressurevariable"
@info "$(modulelog()) - The ERA5Variable defined by \"$varID\" is of the PressureVariable type"
return PressureVariable{ST}(
varID,lname,vname,units,hPa,
varID,lname,vname * " ($(hPa) hPa)",units,hPa,
"reanalysis-era5-pressure-levels"
)
else
@info "$(modulelog()) - The ERA5Variable defined by \"$varID\" is of the PressureCustom type"
return PressureCustom{ST}(
varID,lname,vname,units,hPa,
varID,lname,vname * " ($(hPa) hPa)",units,hPa,
"reanalysis-era5-pressure-levels"
)
end
Expand Down Expand Up @@ -196,7 +196,8 @@ end
"""
isPressure(
varID :: AbstractString;
throw :: Bool = true
throw :: Bool = true,
dolog :: Bool = false
) -> tf :: Bool
Extracts information of the Pressure-Level Variable with the ID `varID`. If no Pressure-Level Variable with this ID exists, an error is thrown.
Expand All @@ -207,6 +208,7 @@ Arguments
- `RegID` : The keyword ID that will be used to identify the Pressure-Level Variable.
If the ID is not valid (i.e. not being used), then an error will be thrown.
- `throw` : If `true`, then throws an error if `RegID` is not a valid Pressure-Level Variable identifier instead of returning the Boolean `tf`
- `dolog` : If `true`, then return logging to screen along with results
Returns
=======
Expand All @@ -215,10 +217,16 @@ Returns
"""
function isPressure(
varID :: AbstractString;
throw :: Bool = true
throw :: Bool = true,
dolog :: Bool = false
)

@info "$(modulelog()) - Checking to see if the PressureVariable ID \"$varID\" is in use"
if dolog
@info "$(modulelog()) - Checking if the PressureVariable ID \"$varID\" is in use"
else
@debug "$(modulelog()) - Checking if the PressureVariable ID \"$varID\" is in use"
end

vlist,_ = listPressures()

if sum(vlist.==varID) == 0
Expand All @@ -229,7 +237,9 @@ function isPressure(
return false
end
else
@info "$(modulelog()) - The PressureVariable ID \"$varID\" is already in use"
if dolog
@info "$(modulelog()) - The PressureVariable ID \"$varID\" is already in use"
end
return true
end

Expand Down
18 changes: 14 additions & 4 deletions src/variable/single.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ end
"""
isSingle(
varID :: AbstractString;
throw :: Bool = true
throw :: Bool = true,
dolog :: Bool = false
) -> tf :: Bool
Extracts information of the Single-Level Variable with the ID `varID`. If no Single-Level Variable with this ID exists, an error is thrown.
Expand All @@ -171,6 +172,7 @@ Arguments
- `RegID` : The keyword ID that will be used to identify the Single-Level Variable.
If the ID is not valid (i.e. not being used), then an error will be thrown.
- `throw` : If `true`, then throws an error if `RegID` is not a valid Single-Level Variable identifier instead of returning the Boolean `tf`
- `dolog` : If `true`, then return logging to screen along with results
Returns
=======
Expand All @@ -179,10 +181,16 @@ Returns
"""
function isSingle(
varID :: AbstractString;
throw :: Bool = true
throw :: Bool = true,
dolog :: Bool = false
)

@info "$(modulelog()) - Checking to see if the SingleVariable ID \"$varID\" is in use"
if dolog
@info "$(modulelog()) - Checking if the SingleVariable ID \"$varID\" is in use"
else
@debug "$(modulelog()) - Checking if the SingleVariable ID \"$varID\" is in use"
end

vlist,_ = listSingles()

if sum(vlist.==varID) == 0
Expand All @@ -193,7 +201,9 @@ function isSingle(
return false
end
else
@info "$(modulelog()) - The SingleVariable ID \"$varID\" is already in use"
if dolog
@info "$(modulelog()) - The SingleVariable ID \"$varID\" is already in use"
end
return true
end

Expand Down

2 comments on commit 125d0f4

@natgeo-wong
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

Release Notes:

  • A package to streamline the downloads and reading of ERA5 reanalysis datasets in Julia
  • Currently downloading, reading and saving functions available
  • LandSea masks can also be downloaded separately
  • Pressure-Level and Single-Level options available for variables, with some predefined variables included and the option to create custom ones
  • Hourly, Monthly and Monthly Hour-of-Day options available
  • Can specify specific regions using the GeoRegion package functionality (see GeoRegions.jl for more information)
  • Ensemble and Error datasets NOT CURRENTLY AVAILABLE

@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 updated: JuliaRegistries/General/54134

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.1.0 -m "<description of version>" 125d0f4906854c0f1fc6f8f8822946ac1b209579
git push origin v0.1.0

Please sign in to comment.