Skip to content

Commit d60a26b

Browse files
committed
debugging net radiation on clima [skip ci]
1 parent 3abec2d commit d60a26b

File tree

6 files changed

+66
-19
lines changed

6 files changed

+66
-19
lines changed

.buildkite/Manifest.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is machine-generated - editing it directly is not advised
22

3-
julia_version = "1.10.8"
3+
julia_version = "1.10.0"
44
manifest_format = "2.0"
55
project_hash = "404dad335da65f39c10339b0364e8bfb81472ec4"
66

@@ -373,7 +373,7 @@ weakdeps = ["SparseArrays"]
373373

374374
[[deps.ClimaAnalysis]]
375375
deps = ["Artifacts", "Dates", "Interpolations", "NCDatasets", "NaNStatistics", "OrderedCollections", "Reexport", "Statistics", "Unitful"]
376-
git-tree-sha1 = "b67f8f5f754fde6132bae1a2add06e51cf26227b"
376+
path = "../../ClimaAnalysis.jl"
377377
uuid = "29b5916a-a76c-4e73-9657-3c8fd22e65e6"
378378
version = "0.5.12"
379379
weakdeps = ["GeoMakie", "Makie"]
@@ -551,7 +551,7 @@ weakdeps = ["Dates", "LinearAlgebra"]
551551
[[deps.CompilerSupportLibraries_jll]]
552552
deps = ["Artifacts", "Libdl"]
553553
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
554-
version = "1.1.1+0"
554+
version = "1.0.5+1"
555555

556556
[[deps.CompositionsBase]]
557557
git-tree-sha1 = "802bb88cd69dfd1509f6670416bd4434015693ad"
@@ -1973,7 +1973,7 @@ version = "0.2.6"
19731973
[[deps.OpenBLAS_jll]]
19741974
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
19751975
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
1976-
version = "0.3.23+4"
1976+
version = "0.3.23+2"
19771977

19781978
[[deps.OpenEXR]]
19791979
deps = ["Colors", "FileIO", "OpenEXR_jll"]
@@ -2992,7 +2992,7 @@ version = "0.15.2+0"
29922992
[[deps.libblastrampoline_jll]]
29932993
deps = ["Artifacts", "Libdl"]
29942994
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
2995-
version = "5.11.0+0"
2995+
version = "5.8.0+1"
29962996

29972997
[[deps.libfdk_aac_jll]]
29982998
deps = ["Artifacts", "JLLWrappers", "Libdl"]

Artifacts.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,6 @@ git-tree-sha1 = "839224a62b59d73073bdb9a5c55d3dc75e30fe33"
100100
[[ilamb_data.download]]
101101
sha256 = "64a9a344ebfbb0113014178a1f93a655c401431565907c07fd33aff8860b62d6"
102102
url = "https://caltech.box.com/shared/static/eii2bfwfp47axfeuysgxlgzbczz27u5g.gz"
103+
104+
[era5_surface_fluxes]
105+
git-tree-sha1 = "f2cb69e41cba84991054162e794292f98bf0ae34"

experiments/long_runs/data_paper_plots.jl

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ function get_sim_var_dict(simdir)
8282
lwn = lwd - lwu
8383
lwn.attributes["long_name"] = "Net longwave radiation"
8484
lwn.attributes["units"] = "W m⁻²"
85+
lwn.attributes["start_date"] = lwd.attributes["start_date"]
8586
return lwn
8687
end
8788

@@ -93,22 +94,27 @@ function get_sim_var_dict(simdir)
9394
swn = swd - swu
9495
swn.attributes["long_name"] = "Net shortwave radiation"
9596
swn.attributes["units"] = "W m⁻²"
97+
swn.attributes["start_date"] = swd.attributes["start_date"]
9698
return swn
9799
end
98100

99101
return sim_var_dict
100102
end
101103

102104
function get_obs_var_dict()
105+
# era5_data_path = joinpath(
106+
# ClimaLand.Artifacts.era5_monthly_averages_2008_folder_path(),
107+
# "era5_monthly_surface_fluxes_200801-200812.nc",
108+
# )
103109
era5_data_path = joinpath(
104-
ClimaLand.Artifacts.era5_monthly_averages_2008_folder_path(),
110+
ClimaLand.Artifacts.era5_surface_data2008_path(),
105111
"era5_monthly_surface_fluxes_200801-200812.nc",
106112
)
107113
era5_land_forcing_data_path = joinpath(
108114
ClimaLand.Artifacts.era5_land_forcing_data2008_folder_path(
109115
lowres = false,
110116
),
111-
"era5_2008_0.9x1.25.nc",
117+
"era5_2008_1.0x1.0.nc",
112118
)
113119

114120
# Dict for loading in observational data
@@ -245,15 +251,17 @@ function get_obs_var_dict()
245251
obs_var_dict["lwd"] =
246252
(start_date) -> begin
247253
obs_var = ClimaAnalysis.OutputVar(
248-
era5_data_path,
254+
era5_land_forcing_data_path,
249255
"msdwlwrf",
250256
new_start_date = start_date,
251257
shift_by = Dates.firstdayofmonth,
252258
) # units (W/m²)
253259
obs_var = ClimaAnalysis.replace(obs_var, missing => NaN)
254260

255261
# Copy data at lon = 0 to lon = 360 to avoid white lines
256-
push!(obs_var.dims["longitude"], 360)
262+
@show ClimaAnalysis.longitude_name(obs_var)
263+
push!(obs_var.dims[ClimaAnalysis.longitude_name(obs_var)], 360)
264+
# push!(obs_var.dims["longitude"], 360)
257265
new_data = cat(obs_var.data, obs_var.data[[1], :, :], dims = 1)
258266
# Manually set attributes
259267
attribs = Dict(
@@ -276,7 +284,7 @@ function get_obs_var_dict()
276284
obs_var_dict["swd"] =
277285
(start_date) -> begin
278286
obs_var = ClimaAnalysis.OutputVar(
279-
era5_data_path,
287+
era5_land_forcing_data_path,
280288
"msdwswrf",
281289
new_start_date = start_date,
282290
shift_by = Dates.firstdayofmonth,
@@ -305,24 +313,51 @@ function get_obs_var_dict()
305313

306314

307315
# Compute LWN = LWD - LWU
316+
#TODO era5_land_forcing (for lwd) has hourly data, need to resample to monthly
308317
obs_var_dict["lwn"] =
309318
(start_date) -> begin
310319
lwd = obs_var_dict["lwd"](start_date)
311320
lwu = obs_var_dict["lwu"](start_date)
312-
lwn = lwd - lwu
313-
lwn.attributes["long_name"] = "Net longwave radiation"
314-
lwn.attributes["units"] = "W m⁻²"
315-
return lwu
321+
322+
lwn_data = lwd.data .- lwu.data
323+
324+
attribs = Dict(
325+
"short_name" => "lwn",
326+
"long_name" => "Net longwave radiation",
327+
"units" => "W m⁻²",
328+
"start_date" => start_date,
329+
)
330+
331+
lwn = ClimaAnalysis.OutputVar(
332+
attribs,
333+
lwd.dims,
334+
lwd.dim_attributes,
335+
lwn_data, # W/m²
336+
)
337+
338+
return lwn
316339
end
317340

318341
# Compute SWN = SWD - SWU
319342
obs_var_dict["swn"] =
320343
(start_date) -> begin
321344
swd = obs_var_dict["swd"](start_date)
322345
swu = obs_var_dict["swu"](start_date)
323-
swn = swd - swu
324-
swn.attributes["long_name"] = "Net shortwave radiation"
325-
swn.attributes["units"] = "W m⁻²"
346+
swn_data = swd.data - swu.data
347+
348+
attribs = Dict(
349+
"short_name" => "lwn",
350+
"long_name" => "Net shortwave radiation",
351+
"units" => "W m⁻²",
352+
"start_date" => start_date,
353+
)
354+
355+
swn = ClimaAnalysis.OutputVar(
356+
attribs,
357+
swd.dims,
358+
swd.dim_attributes,
359+
swn_data, # W/m²
360+
)
326361
return swn
327362
end
328363

experiments/long_runs/global_paper_plots.jl

Lines changed: 0 additions & 1 deletion
This file was deleted.

experiments/long_runs/paper_plots.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ root_path = joinpath(pwd(), "snowy_land_longrun_gpu")
2828
outdir = "/scratch/clima/slurm-buildkite/climaland-long-runs/3785/climaland-long-runs/snowy_land_longrun_gpu_alpha1/global_diagnostics/output_active/" # on clima
2929
root_path = outdir
3030

31-
short_names = ["lhf", "shf", "lwu", "swu", "lwn", "swn"]
31+
short_names = ["lwn", "swn"]#["lhf", "shf", "lwu", "swu", "lwn", "swn"]
3232
title_stubs = Dict(
3333
"lhf" => "Latent heat flux",
3434
"shf" => "Sensible heat flux",
@@ -93,6 +93,7 @@ function make_paper_figures(
9393
sim_var = sim_var_dict[short_name]()
9494
sim_var_times = ClimaAnalysis.times(sim_var)
9595

96+
@show short_name
9697
obs_var = obs_var_dict[short_name](sim_var.attributes["start_date"])
9798

9899

src/Artifacts.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ function era5_monthly_averages_2008_folder_path(; context = nothing)
3434
return @clima_artifact("era5_monthly_averages_2008", context)
3535
end
3636

37+
38+
"""
39+
era5_surface_data2008_path(; context)
40+
Return the path to the folder that contains the ERA5 monthly surface data
41+
"""
42+
function era5_surface_data2008_path(; context = nothing)
43+
return @clima_artifact("era5_surface_fluxes", context)
44+
end
45+
3746
"""
3847
era5_lai_forcing_data2008_path(; context)
3948

0 commit comments

Comments
 (0)