-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #502 from SpeedyWeather/mk/jeevanjee
Jeevanjee longwave radiation
- Loading branch information
Showing
21 changed files
with
272 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
# to avoid ambiguity with exporting plot | ||
plot(L::LowerTriangularMatrix{T}; kwargs...) where T = LowerTriangularMatrices.plot(L; kwargs...) | ||
plot(G::AbstractGrid{T}; kwargs...) where T = RingGrids.plot(G; kwargs...) | ||
|
||
; | ||
plot(G::AbstractGrid{T}; kwargs...) where T = RingGrids.plot(G; kwargs...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,61 @@ | ||
abstract type AbstractAlbedo end | ||
abstract type AbstractAlbedo <: AbstractModelComponent end | ||
|
||
## GLOBAL CONSTANT ALBEDO | ||
|
||
export GlobalConstantAlbedo | ||
Base.@kwdef struct GlobalConstantAlbedo{NF,Grid} <: AbstractAlbedo | ||
nlat_half::Int | ||
α::NF = 0.8 | ||
albedo::Grid = zeros(Grid, nlat_half) | ||
end | ||
|
||
function GlobalConstantAlbedo(SG::SpectralGrid; kwargs...) | ||
(;NF, Grid, nlat_half) = SG | ||
GlobalConstantAlbedo{NF, Grid{NF}}(; nlat_half, kwargs...) | ||
end | ||
|
||
function initialize!(albedo::GlobalConstantAlbedo,::PrimitiveEquation) | ||
albedo.albedo .= albedo.α | ||
end | ||
|
||
## ALEBDO CLIMATOLOGY | ||
|
||
export AlbedoClimatology | ||
Base.@kwdef struct AlbedoClimatology{NF,Grid} <: AbstractAlbedo | ||
"number of latitudes on one hemisphere, Equator included" | ||
nlat_half::Int | ||
|
||
"[OPTION] path to the folder containing the albedo file, pkg path default" | ||
path::String = "SpeedyWeather.jl/input_data" | ||
|
||
"[OPTION] filename of albedo" | ||
file::String = "albedo.nc" | ||
|
||
"[OPTION] variable name in netcdf file" | ||
varname::String = "alb" | ||
|
||
"[OPTION] Grid the albedo file comes on" | ||
file_Grid::Type{<:AbstractGrid} = FullGaussianGrid | ||
|
||
"Albedo climatology" | ||
albedo::Grid = zeros(Grid, nlat_half) | ||
end | ||
|
||
function AlbedoClimatology(SG::SpectralGrid; kwargs...) | ||
(; NF, Grid, nlat_half) = SG | ||
AlbedoClimatology{NF,Grid{NF}}(;nlat_half, kwargs...) | ||
end | ||
|
||
function initialize!(albedo::AlbedoClimatology, model::PrimitiveEquation) | ||
|
||
# LOAD NETCDF FILE | ||
if albedo.path == "SpeedyWeather.jl/input_data" | ||
path = joinpath(@__DIR__, "../../input_data", albedo.file) | ||
else | ||
path = joinpath(albedo.path, albedo.file) | ||
end | ||
ncfile = NCDataset(path) | ||
|
||
a = albedo.file_Grid(ncfile[albedo.varname][:, :]) | ||
interpolate!(albedo.albedo, a) | ||
end |
Oops, something went wrong.