Skip to content

Commit 1a412ea

Browse files
authored
fix timestamp to address phase offset (#1332)
1 parent 44e05c4 commit 1a412ea

File tree

12 files changed

+138
-48
lines changed

12 files changed

+138
-48
lines changed

docs/src/tutorials/calibration/obs_site_level_calibration.jl

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ site_ID_val = FluxnetSimulations.replace_hyphen(site_ID);
7070
FluxnetSimulations.get_location(FT, Val(site_ID_val))
7171
(; atmos_h) = FluxnetSimulations.get_fluxtower_height(FT, Val(site_ID_val));
7272

73-
# Get maximum simulation start and end dates in UTC; these must be included in the forcing data range
74-
start_date = DateTime(2010, 3, 1)
73+
# Get simulation start and stop dates in UTC; these must be included in the forcing data range
74+
# Here we calibrate with only two months of data.
75+
start_date = DateTime(2010, 5, 1)
7576
stop_date = DateTime(2010, 7, 1)
7677
Δt = 450.0; # seconds
7778

@@ -185,14 +186,16 @@ function model(Vcmax25, g1)
185186
land_model,
186187
)
187188

188-
#md # Configure diagnostics to output sensible and latent heat fluxes hourly
189+
#md # Configure diagnostics to output sensible and latent heat fluxes half-hourly
190+
#md # Since fluxnet data is recorded every half hour, with the average of the half hour,
191+
#md # we need to be consistent here.
189192
output_vars = ["lhf"]
190193
diagnostics = ClimaLand.default_diagnostics(
191194
land_model,
192195
start_date;
193196
output_writer = ClimaDiagnostics.Writers.DictWriter(),
194197
output_vars,
195-
average_period = :hourly,
198+
average_period = :halfhourly,
196199
)
197200

198201
#md # Create and run the simulation
@@ -238,7 +241,7 @@ end;
238241
function get_lhf(simulation)
239242
return ClimaLand.Diagnostics.diagnostic_as_vectors(
240243
simulation.diagnostics[1].output_writer,
241-
"lhf_1h_average",
244+
"lhf_30m_average",
242245
)
243246
end;
244247

@@ -402,3 +405,9 @@ axislegend(
402405
CairoMakie.resize_to_layout!(fig)
403406
CairoMakie.save("G_first_and_last.png", fig)
404407
fig
408+
# Here we can see that the calibration has improved the fit to the data;
409+
# but this it not the fully story. If other parameters have been set to
410+
# unrealistic values, the parameters here may be compensating to
411+
# achieve a lower loss. Moreover, we have only calibrated with two months
412+
# of data. Production-level calibration runs require careful choice
413+
# of free parameters and target observations.

docs/src/tutorials/integrated/snowy_land_fluxnet_tutorial.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ diagnostics = ClimaLand.default_diagnostics(
103103
);
104104

105105
# Choose how often we want to update the forcing.
106+
# Choosing a frequency > the data frequency results in linear
107+
# interpolation in time to the intermediate times.
106108
data_dt = Second(FluxnetSimulations.get_data_dt(site_ID));
107109
updateat = Array(start_date:data_dt:stop_date);
108110

docs/src/tutorials/standalone/Canopy/canopy_tutorial.jl

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,27 +65,26 @@ import ClimaLand.LandSimVis as LandSimVis
6565
const FT = Float32;
6666
earth_param_set = LP.LandParameters(FT);
6767

68-
# First provide some information about the site:
69-
# Timezone (offset from UTC in hrs)
70-
time_offset = 7
71-
start_date = DateTime(2010) + Hour(time_offset)
72-
73-
# Select a time range to perform time stepping over, and a dt. As usual,
74-
# the timestep depends on the problem you are solving, the accuracy of the
75-
# solution required, and the timestepping algorithm you are using.
76-
N_days = 364
77-
stop_date = start_date + Day(N_days)
78-
dt = 225.0
68+
# We will use prescribed atmospheric and radiative forcing from the
69+
# US-MOz tower.
70+
site_ID = "US-MOz";
71+
site_ID_val = FluxnetSimulations.replace_hyphen(site_ID);
72+
# Get the latitude and longitude in degrees, as well as the
73+
# time offset in hours of local time from UTC
74+
(; time_offset, lat, long) =
75+
FluxnetSimulations.get_location(FT, Val(site_ID_val));
76+
# Get the height of the sensors in m
77+
(; atmos_h) = FluxnetSimulations.get_fluxtower_height(FT, Val(site_ID_val));
78+
# Set a start and stop date of the simulation in UTC, as well as
79+
# a timestep in seconds
80+
start_date = DateTime("2010-05-01", "yyyy-mm-dd")
81+
stop_date = DateTime("2010-09-01", "yyyy-mm-dd")
82+
dt = 450.0
7983

8084
# Site latitude and longitude
8185
lat = FT(38.7441) # degree
8286
long = FT(-92.2000) # degree
8387

84-
# Height of the sensor at the site
85-
atmos_h = FT(32)
86-
# Site ID
87-
site_ID = "US-MOz";
88-
8988
# # Setup the Canopy Model
9089

9190
# We want to simulate a vegetative canopy in standalone mode, without coupling
@@ -103,8 +102,6 @@ site_ID = "US-MOz";
103102
# would change.
104103
domain = Point(; z_sfc = FT(0.0), longlat = (long, lat));
105104

106-
107-
108105
# We will be using prescribed atmospheric and radiative drivers from the
109106
# US-MOz tower, which we read in here. We are using prescribed
110107
# atmospheric and radiative flux conditions, but it is also possible to couple

experiments/integrated/fluxnet/ozark_pft.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,12 @@ diags = ClimaLand.default_diagnostics(
302302
start_date;
303303
output_writer = output_writer,
304304
output_vars,
305-
average_period = :hourly,
305+
average_period = :halfhourly,
306306
)
307307

308308
## How often we want to update the drivers
309309
## defined in the simulatons file
310-
data_dt = Float64(FluxnetSimulations.get_data_dt(site_ID))
311-
updateat = Array(start_date:Second(data_dt):stop_date)
310+
updateat = Array(start_date:Second(dt):stop_date)
312311
simulation = LandSimulation(
313312
start_date,
314313
stop_date,

experiments/integrated/fluxnet/ozark_pmodel.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,11 @@ diags = ClimaLand.default_diagnostics(
246246
start_date;
247247
output_writer = ClimaDiagnostics.Writers.DictWriter(),
248248
output_vars,
249-
average_period = :hourly,
249+
average_period = :halfhourly,
250250
);
251251

252252
## How often we want to update the drivers.
253-
data_dt = Second(FluxnetSimulations.get_data_dt(site_ID))
254-
updateat = Array(start_date:data_dt:stop_date)
253+
updateat = Array(start_date:Second(dt):stop_date)
255254
pmodel_cb = ClimaLand.make_PModel_callback(FT, start_date, dt, land.canopy)
256255
simulation = LandSimulation(
257256
start_date,

experiments/integrated/fluxnet/ozark_soilsnow.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ simulation = LandSimulation(
186186
set_ic! = set_ic!,
187187
updateat,
188188
solver_kwargs = (; saveat = saveat),
189+
diagnostics = nothing,
189190
)
190191
sol = solve!(simulation)
191192

experiments/integrated/fluxnet/run_fluxnet.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,11 @@ diags = ClimaLand.default_diagnostics(
270270
start_date;
271271
output_writer = ClimaDiagnostics.Writers.DictWriter(),
272272
output_vars,
273-
average_period = :hourly,
273+
average_period = :halfhourly,
274274
);
275275

276276
## How often we want to update the drivers.
277-
data_dt = Second(FluxnetSimulations.get_data_dt(site_ID))
278-
updateat = Array(start_date:data_dt:stop_date)
279-
277+
updateat = Array(start_date:Second(dt):stop_date)
280278
simulation = LandSimulation(
281279
start_date,
282280
stop_date,

experiments/standalone/Vegetation/no_vegetation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ long = FT(-92.2000) # degree
2929
land_domain = Point(; z_sfc = FT(0.0), longlat = (long, lat))
3030
atmos_h = FT(32)
3131
site_ID = "US-MOz"
32-
start_date = DateTime(2010) + Hour(time_offset)
32+
start_date = DateTime(2010, 1, 2)
3333
N_days = 10
3434
stop_date = start_date + Day(N_days)
3535
dt = 225.0;

experiments/standalone/Vegetation/varying_lai.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ long = FT(-92.2000) # degree
2828
land_domain = Point(; z_sfc = FT(0.0), longlat = (long, lat))
2929
atmos_h = FT(32)
3030
site_ID = "US-MOz"
31-
start_date = DateTime(2010) + Hour(time_offset)
31+
start_date = DateTime(2010, 1, 2)
3232
N_days = 364
3333
stop_date = start_date + Day(N_days)
3434
dt = 225.0;

experiments/standalone/Vegetation/varying_lai_with_stem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ long = FT(-92.2000) # degree
2828
land_domain = Point(; z_sfc = FT(0.0), longlat = (long, lat))
2929
atmos_h = FT(32)
3030
site_ID = "US-MOz"
31-
start_date = DateTime(2010) + Hour(time_offset)
31+
start_date = DateTime(2010, 1, 2)
3232
N_days = 60
3333
stop_date = start_date + Day(N_days)
3434
dt = FT(225);

0 commit comments

Comments
 (0)