Skip to content

Commit ba3d432

Browse files
Remove data_loader in RRTMGPInterface
1 parent f8dd087 commit ba3d432

File tree

4 files changed

+10
-35
lines changed

4 files changed

+10
-35
lines changed

src/ClimaAtmos.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ import .AtmosArtifacts as AA
2828
include(joinpath("topography", "topography.jl"))
2929
include(joinpath("topography", "steady_state_solutions.jl"))
3030

31-
include(
32-
joinpath("parameterized_tendencies", "radiation", "radiation_utilities.jl"),
33-
)
3431
include(joinpath("parameterized_tendencies", "radiation", "RRTMGPInterface.jl"))
3532
import .RRTMGPInterface as RRTMGPI
3633
include(joinpath("parameterized_tendencies", "radiation", "radiation.jl"))

src/parameterized_tendencies/radiation/RRTMGPInterface.jl

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module RRTMGPInterface
22

33
import ..AbstractCloudInRadiation
44

5+
import NCDatasets as NC
56
using RRTMGP
67
import RRTMGP.AtmosphericStates as AS
78
using ClimaCore: DataLayouts, Spaces, Fields
@@ -318,8 +319,7 @@ top/bottom of the atmosphere can be specified as a scalar, or as the full 1D
318319
array.
319320
320321
# Positional Arguments
321-
- `data_loader(callback::Function, file_name)`: a function for
322-
loading RRTMGP.jl artifacts, stored in `RRTMGPReferenceData/<file_name>`.
322+
- Artifacts stored in `RRTMGPReferenceData/<file_name>`.
323323
Should be callable with filenames:
324324
- `lookup_tables/clearsky_lw.nc`
325325
- `lookup_tables/cloudysky_lw.nc`
@@ -410,7 +410,6 @@ array.
410410
"""
411411
function RRTMGPModel(
412412
params::RRTMGP.Parameters.ARP,
413-
data_loader::Function,
414413
context;
415414
ncol::Int,
416415
domain_nlay::Int,
@@ -486,7 +485,7 @@ function RRTMGPModel(
486485
nbnd_lw = 1
487486
else
488487
local lookup_lw, idx_gases
489-
data_loader(RRTMGP.ArtifactPaths.get_lookup_filename(:gas, :lw)) do ds
488+
NC.Dataset(RRTMGP.ArtifactPaths.get_lookup_filename(:gas, :lw)) do ds
490489
lookup_lw, idx_gases = RRTMGP.LookUpTables.LookUpLW(ds, FT, DA)
491490
end
492491
lookups = (; lookups..., lookup_lw, idx_gases)
@@ -496,7 +495,7 @@ function RRTMGPModel(
496495

497496
if !(radiation_mode isa ClearSkyRadiation)
498497
local lookup_lw_cld
499-
data_loader(
498+
NC.Dataset(
500499
RRTMGP.ArtifactPaths.get_lookup_filename(:cloud, :lw),
501500
) do ds
502501
lookup_lw_cld = RRTMGP.LookUpTables.LookUpCld(ds, FT, DA)
@@ -505,7 +504,7 @@ function RRTMGPModel(
505504
end
506505
if radiation_mode.aerosol_radiation
507506
local lookup_lw_aero, idx_aerosol, idx_aerosize
508-
data_loader(
507+
NC.Dataset(
509508
RRTMGP.ArtifactPaths.get_lookup_filename(:aerosol, :lw),
510509
) do ds
511510
lookup_lw_aero, idx_aerosol, idx_aerosize =
@@ -554,7 +553,7 @@ function RRTMGPModel(
554553
nbnd_sw = 1
555554
else
556555
local lookup_sw, idx_gases
557-
data_loader(RRTMGP.ArtifactPaths.get_lookup_filename(:gas, :sw)) do ds
556+
NC.Dataset(RRTMGP.ArtifactPaths.get_lookup_filename(:gas, :sw)) do ds
558557
lookup_sw, idx_gases = RRTMGP.LookUpTables.LookUpSW(ds, FT, DA)
559558
end
560559
lookups = (; lookups..., lookup_sw, idx_gases)
@@ -564,7 +563,7 @@ function RRTMGPModel(
564563

565564
if !(radiation_mode isa ClearSkyRadiation)
566565
local lookup_sw_cld
567-
data_loader(
566+
NC.Dataset(
568567
RRTMGP.ArtifactPaths.get_lookup_filename(:cloud, :sw),
569568
) do ds
570569
lookup_sw_cld = RRTMGP.LookUpTables.LookUpCld(ds, FT, DA)
@@ -574,7 +573,7 @@ function RRTMGPModel(
574573

575574
if radiation_mode.aerosol_radiation
576575
local lookup_sw_aero, idx_aerosol, idx_aerosize
577-
data_loader(
576+
NC.Dataset(
578577
RRTMGP.ArtifactPaths.get_lookup_filename(:aerosol, :sw),
579578
) do ds
580579
lookup_sw_aero, idx_aerosol, idx_aerosize =

src/parameterized_tendencies/radiation/radiation.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import ClimaComms
66
import ClimaCore: DataLayouts, Geometry, Spaces, Fields, Operators
77
import Insolation
88
import Thermodynamics as TD
9+
import NCDatasets as NC
910
import .Parameters as CAP
1011
import RRTMGP
1112
import .RRTMGPInterface as RRTMGPI
@@ -108,7 +109,6 @@ function radiation_model_cache(
108109
insolation_mode;
109110
interpolation = RRTMGPI.BestFit(),
110111
bottom_extrapolation = RRTMGPI.SameAsInterpolation(),
111-
data_loader = rrtmgp_data_loader,
112112
)
113113
context = ClimaComms.context(axes(Y.c))
114114
device = context.device
@@ -150,9 +150,7 @@ function radiation_model_cache(
150150
latitude = Fields.field2array(zero(bottom_coords.z)) # flat space is on Equator
151151
end
152152
local rrtmgp_model
153-
data_loader(
154-
RRTMGP.ArtifactPaths.get_input_filename(:gas, :lw),
155-
) do input_data
153+
NC.Dataset(RRTMGP.ArtifactPaths.get_input_filename(:gas, :lw)) do input_data
156154
if radiation_mode isa RRTMGPI.GrayRadiation
157155
kwargs = (;
158156
lapse_rate = 3.5,
@@ -308,7 +306,6 @@ function radiation_model_cache(
308306

309307
rrtmgp_model = RRTMGPI.RRTMGPModel(
310308
rrtmgp_params,
311-
data_loader,
312309
context;
313310
ncol = length(Spaces.all_nodes(axes(Spaces.level(Y.c, 1)))),
314311
domain_nlay = Spaces.nlevels(axes(Y.c)),

src/parameterized_tendencies/radiation/radiation_utilities.jl

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)