Skip to content

Commit e8516e8

Browse files
(0.5.1) Metadata for JRA55 (#286)
* start modifying the data structure * going on... * comment * add some changes * in their folder * modernize * start changing stuff * starting a bit * let's go * correct alias * correct dates * syntax * more updates * all this should work? * clear comments * vestigial code * works * veeery much simplified * this part is already done * back to working * works * improve show method * change names * remove vestigial code * tests should pass * no bang for download_dataset * fix tests * fixed all tests? * more usefull comments * fix a couple of stuff * probably correct now * last fix * remove extra line * add a default architecture * correct default * fixed all tests * another bugfix * churning on * this should be ready to merge * add correct tests * fix tests * fix tests * updTE CLIMA COMMON * Update metadata.jl * fix delta * fix bugs * rivers and icebergs should be fixed * chnage to DateTime * bugfix * bugfix * bugfix * some fixes * correct examples * more bugfixing * bugfix * fix examples * export Metadata * update compats * fix typo in comment * fix stray spaces * add .vscode * add Oceananigans.defaults.FloatType = Float32 in example * infer FT in SimilarityTheoryFluxes from ocean_grid * remove spaces * slice times * unify interfaces * export all_dates * export all_dates * formatting fixes * scalar indexing error * pass the grid * change version to dataset * add start_date end_date * fix example * bugfix * bugfix * bump up --------- Co-authored-by: Navid C. Constantinou <[email protected]>
1 parent eb26ed3 commit e8516e8

40 files changed

+1095
-1118
lines changed

.buildkite/pipeline.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ steps:
3434
- wait
3535

3636
- label: "CPU JRA55 tests"
37-
key: "cpu_jra55_tests"
37+
key: "cpu_JRA55_tests"
3838
env:
39-
TEST_GROUP: "jra55"
39+
TEST_GROUP: "JRA55"
4040
commands:
4141
- "julia --project -e 'using Pkg; Pkg.test()'"
4242
agents:
@@ -78,9 +78,9 @@ steps:
7878
slurm_ntasks: 1
7979

8080
- label: "GPU JRA55 tests"
81-
key: "gpu_jra55_tests"
81+
key: "gpu_JRA55_tests"
8282
env:
83-
TEST_GROUP: "jra55"
83+
TEST_GROUP: "JRA55"
8484
GPU_TEST: "true"
8585
commands:
8686
- "julia --project -e 'using Pkg; Pkg.test()'"

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ docs/build/
2121
docs/site/
2222
docs/src/literated/
2323

24-
# Output files
24+
# Output files
2525
*.nc
2626
*.jld2
2727
*.mp4
@@ -57,3 +57,6 @@ docs/src/literated/
5757
*.tls
5858
*.tpc
5959
*.txt
60+
61+
# vscode
62+
.vscode

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name = "ClimaOcean"
22
uuid = "0376089a-ecfe-4b0e-a64f-9c555d74d754"
33
license = "MIT"
44
authors = ["Climate Modeling Alliance and contributors"]
5-
version = "0.5.0"
5+
version = "0.5.1"
66

77
[deps]
88
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ grid = ImmersedBoundaryGrid(grid, GridFittedBottom(bathymetry))
4949

5050
# Build an ocean simulation initialized to the ECCO state estimate on Jan 1, 1993
5151
ocean = ClimaOcean.ocean_simulation(grid)
52-
date = DateTimeProlepticGregorian(1993, 1, 1)
52+
date = DateTime(1993, 1, 1)
5353
set!(ocean.model, T = ClimaOcean.ECCOMetadata(:temperature; date),
5454
S = ClimaOcean.ECCOMetadata(:salinity; date))
5555

examples/ecco_inspect_temperature_salinity.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ using Oceananigans.ImmersedBoundaries: mask_immersed_field!
44
using CairoMakie
55
using Printf
66
using ClimaOcean
7-
using ClimaOcean.DataWrangling.ECCO: ECCO_field, ECCOFieldTimeSeries
7+
using ClimaOcean.DataWrangling.ECCO: ECCO_field, ECCOFieldTimeSeries, ECCO4Monthly
88
using CFTime
99
using Dates
1010

@@ -39,12 +39,12 @@ sb = SeawaterBuoyancy(; equation_of_state)
3939
tracers = (T=T, S=S)
4040
b = Field(buoyancy(sb, grid, tracers))
4141

42-
start = DateTimeProlepticGregorian(1993, 1, 1)
43-
stop = DateTimeProlepticGregorian(1999, 1, 1)
42+
start = DateTime(1993, 1, 1)
43+
stop = DateTime(1999, 1, 1)
4444
dates = range(start; stop, step=Month(1))
4545

46-
Tmeta = ECCOMetadata(:temperature; dates)
47-
Smeta = ECCOMetadata(:salinity; dates)
46+
Tmeta = Metadata(:temperature; dates, dataset=ECCO4Monthly())
47+
Smeta = Metadata(:salinity; dates, dataset=ECCO4Monthly())
4848

4949
Tt = ECCOFieldTimeSeries(Tmeta, grid; time_indices_in_memory=length(dates))
5050
St = ECCOFieldTimeSeries(Smeta, grid; time_indices_in_memory=length(dates))

examples/ecco_mixed_layer_depth.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using ClimaOcean
22
using ClimaOcean.Diagnostics: MixedLayerDepthField
3-
using ClimaOcean.DataWrangling.ECCO: ECCO_field, ECCOFieldTimeSeries
3+
using ClimaOcean.DataWrangling.ECCO: ECCO_field, ECCOFieldTimeSeries, ECCO4Monthly
44
using Oceananigans
55
using CairoMakie
66
using Printf
@@ -34,8 +34,8 @@ start = DateTimeProlepticGregorian(1993, 1, 1)
3434
stop = DateTimeProlepticGregorian(2003, 1, 1)
3535
dates = range(start; stop, step=Month(1))
3636

37-
Tmeta = ECCOMetadata(:temperature; dates)
38-
Smeta = ECCOMetadata(:salinity; dates)
37+
Tmeta = Metadata(:temperature; dates, dataset=ECCO4Monthly())
38+
Smeta = Metadata(:salinity; dates, dataset=ECCO4Monthly())
3939

4040
Tt = ECCOFieldTimeSeries(Tmeta, grid; time_indices_in_memory=2)
4141
St = ECCOFieldTimeSeries(Smeta, grid; time_indices_in_memory=2)

examples/generate_atmos_dataset.jl

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

examples/generate_surface_fluxes.jl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ save("ECCO_continents.png", fig) #hide
4343
# - downwelling shortwave radiation
4444
# - downwelling longwave radiation
4545
#
46-
# We invoke the constructor with only the first two time indices, corresponding to
47-
# January 1st (at 00:00 AM and 03:00 AM).
46+
# We load in memory only the first two time indices, corresponding to January 1st
47+
# (at 00:00 AM and 03:00 AM), by using `JRA55NetCDFBackend(2)`.
4848

49-
atmosphere = JRA55PrescribedAtmosphere(1:2; backend = InMemory())
49+
atmosphere = JRA55PrescribedAtmosphere(; backend = JRA55NetCDFBackend(2))
5050
ocean = ocean_simulation(grid, closure=nothing)
5151

5252
# Now that we have an atmosphere and ocean, we `set!` the ocean temperature and salinity
5353
# to the ECCO2 data by first creating T, S metadata objects,
5454

55-
T_metadata = ECCOMetadata(:temperature)
56-
S_metadata = ECCOMetadata(:salinity)
55+
T_metadata = Metadata(:temperature; dataset=ECCO4Monthly())
56+
S_metadata = Metadata(:salinity; dataset=ECCO4Monthly())
5757

58-
# Note that if a date is not provided to `ECCOMetadata`, then the default Jan 1st, 1992 is used.
58+
# Note that if a date is not provided to `Metadata`, then the default Jan 1st, 1992 is used.
5959
# To copy the ECCO state into `ocean.model`, we use `set!`,
6060

6161
set!(ocean.model; T=T_metadata, S=S_metadata)
@@ -65,7 +65,7 @@ set!(ocean.model; T=T_metadata, S=S_metadata)
6565
# uses the two-band shortwave (visible and UV) + longwave (mid and far infrared)
6666
# decomposition of the radiation spectrum.
6767

68-
coupled_model = OceanSeaIceModel(ocean; atmosphere, radiation=Radiation())
68+
coupled_model = OceanSeaIceModel(ocean; atmosphere, radiation=Radiation(eltype))
6969

7070
# # Now that the surface fluxes are computed, we can extract and visualize them.
7171
# # The turbulent fluxes are stored in `coupled_modelinterfaces.atmosphere_ocean_interface.fluxes`.
@@ -91,4 +91,5 @@ ax = Axis(fig[3, 1], title = "Water vapor flux (kg m⁻² s⁻¹)", xlabel = "Lo
9191
heatmap!(ax, λ, φ, interior(fluxes.water_vapor, :, :, 1); colormap = :bwr)
9292

9393
save("fluxes.png", fig)
94-
![](fluxes.png)
94+
95+
# ![](fluxes.png)

examples/inspect_JRA55_data.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ using Oceananigans
44
using Oceananigans.Units
55
using Printf
66

7-
time_indices = Colon()
8-
Qswt = ClimaOcean.JRA55.JRA55_field_time_series(:downwelling_shortwave_radiation; time_indices)
9-
rht = ClimaOcean.JRA55.JRA55_field_time_series(:relative_humidity; time_indices)
7+
Qswt = ClimaOcean.JRA55.JRA55FieldTimeSeries(:downwelling_shortwave_radiation)
8+
rht = ClimaOcean.JRA55.JRA55FieldTimeSeries(:relative_humidity)
109

1110
function lonlat2xyz(lons::AbstractVector, lats::AbstractVector)
1211
x = [cosd(lat) * cosd(lon) for lon in lons, lat in lats]

examples/mediterranean_simulation_with_ecco_restoring.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ grid = ImmersedBoundaryGrid(grid, GridFittedBottom(bottom_height))
7575

7676
dates = DateTimeProlepticGregorian(1993, 1, 1) : Month(1) : DateTimeProlepticGregorian(1993, 12, 1)
7777

78-
temperature = ECCOMetadata(:temperature, dates, ECCO4Monthly())
79-
salinity = ECCOMetadata(:salinity, dates, ECCO4Monthly())
78+
temperature = Metadata(:temperature; dates, dataset=ECCO4Monthly())
79+
salinity = Metadata(:salinity; dates, dataset=ECCO4Monthly())
8080

8181
FT = ECCO_restoring_forcing(temperature; architecture = GPU(), timescale = 2days)
8282
FS = ECCO_restoring_forcing(salinity; architecture = GPU(), timescale = 2days)

0 commit comments

Comments
 (0)