Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
42fa985
Add Column region type for single-column metadata
glwagner Mar 24, 2026
acfbdf2
Refactor dataset_location to (dataset, name) dispatch with fallback
glwagner Mar 24, 2026
f79bd10
bump to 0.3.0
glwagner Mar 24, 2026
82ee2c7
Add Column region type for single-column metadata
glwagner Mar 24, 2026
d182979
Fix missing location import in JRA55 module
glwagner Mar 24, 2026
dab6d50
Add PrescribedOcean, Metadata tutorial, and ERA5 flux example
glwagner Mar 24, 2026
a07ebc0
Replace single-column example with ERA5+GLORYS flux demo
glwagner Mar 24, 2026
933cfe2
Clean up underscore prefixes, fix ERA5 location, simplify PrescribedO…
glwagner Mar 24, 2026
5a9fc22
Add ERA5PrescribedAtmosphere; rewrite single-column example with ERA5…
glwagner Mar 24, 2026
e245ef3
Limit ECCO4 tests to 1 date to match available artifacts
glwagner Mar 24, 2026
19c578b
Validate cached NetCDF files and delete corrupt ones before tests
glwagner Mar 24, 2026
9c92076
Disable ocean station papa docs build (requires Copernicus credentials)
glwagner Mar 24, 2026
8bde2ed
Add CopernicusMarine to docs dependencies for GLORYS example
glwagner Mar 24, 2026
7d9ec4b
Add using CopernicusMarine to ocean station papa example
glwagner Mar 24, 2026
a0f2307
Update Copernicus Marine secret names in CI and docs workflows
glwagner Mar 24, 2026
6921b62
Use correct COPERNICUSMARINE_SERVICE env var names
glwagner Mar 24, 2026
530db40
Update src/Oceans/prescribed_ocean.jl
glwagner Mar 25, 2026
4ca42d4
Add ERA5 and column field tests; work around ECCO4 artifact gaps
glwagner Mar 27, 2026
70de82e
Revert ECCO4 download workarounds now that ecco.jpl.nasa.gov is reliable
glwagner Mar 28, 2026
92c121f
Fix initialization_update_state\! import for Julia 1.12 strict mode
glwagner Mar 30, 2026
eedb7e1
Merge branch 'main' into glw-eq/regional-metadata
glwagner Mar 31, 2026
d5099cf
Fix GPU scalar indexing in Nearest column extraction
glwagner Mar 31, 2026
049256e
Use Oceananigans fractional_x_index/fractional_y_index for nearest index
glwagner Mar 31, 2026
3742fca
Merge branch 'main' of github.com:NumericalEarth/NumericalEarth.jl in…
ewquon Apr 1, 2026
c6e039a
Add convenience constructor
ewquon Apr 2, 2026
7c4e057
Align text
ewquon Apr 2, 2026
cce3752
Fix metadata_field.jl for ERA5 column retrieval and small bounding boxes
ewquon Apr 2, 2026
8fc3be1
Fix ERA5 file naming bug for hourly data
ewquon Apr 2, 2026
6b5ed45
Add LATITUDE_T and LONGITUDE_T to coordinate variable lookups
glwagner Apr 2, 2026
36f5055
Remove LatitudeLongitude constructor alias for Column
glwagner Apr 2, 2026
2082bc9
Fix z_interfaces for multi-date GLORYS metadata
ewquon Apr 2, 2026
e01815f
Add end-to-end Column Field tests and fix Linear interpolation
glwagner Apr 2, 2026
9d89980
Address review feedback from Simone
glwagner Apr 2, 2026
734e609
Fix zero-limit plotting crash in single column example
glwagner Apr 3, 2026
8288c8a
Add tests for PrescribedOcean, ERA5PrescribedAtmosphere, and GLORYS C…
glwagner Apr 3, 2026
d65666c
Clean up hardcoded coordinates in column field tests
glwagner Apr 3, 2026
74ba2be
Move ERA5 variables to supported_variables.md; fix notation
glwagner Apr 3, 2026
0bd9cb6
Convert tutorial code blocks to @example blocks
glwagner Apr 3, 2026
0958b2e
Remove is_column; move Column docstring to constructor; document z kwarg
glwagner Apr 3, 2026
6fe9683
Remove fluxes field from PrescribedOcean struct
glwagner Apr 3, 2026
449b177
Fix alignment in tutorial code examples
glwagner Apr 3, 2026
dfc3904
Use Column region for ERA5 atmosphere in single column example
glwagner Apr 3, 2026
c26d442
Fix missing CPU import in ERA5PrescribedAtmosphere
glwagner Apr 3, 2026
61db7ac
Fix column_field to use dataset native grid; fix docstring placement
glwagner Apr 3, 2026
d53754c
Move Column Field extraction to ECCO-specific dispatch
glwagner Apr 3, 2026
698761c
Reduce single column example to 3 days of ERA5 data, 2 day simulation
glwagner Apr 3, 2026
c95906e
Batch ERA5 downloads; skip single column example on PRs
glwagner Apr 3, 2026
609dc38
Fix Column Field for non-ECCO datasets; re-enable example on PRs
glwagner Apr 3, 2026
3e3d3d5
Fix Column Field for all datasets; batch ERA5 downloads; fix imports
glwagner Apr 3, 2026
4d5922e
Fix missing Nearest import in single column example
glwagner Apr 3, 2026
acf0a34
Export Linear and Nearest from NumericalEarth
glwagner Apr 3, 2026
ebcd53c
Export ERA5Hourly/ERA5Monthly; clean up example imports
glwagner Apr 3, 2026
09be919
Merge branch 'main' into glw-eq/regional-metadata
glwagner Apr 3, 2026
02d9978
Fix single column example to use JRA55 atmosphere
glwagner Apr 3, 2026
1eaf541
Increase JRA55 backend memory to 24 snapshots; restore 30-day simulation
glwagner Apr 3, 2026
d065590
Remove ERA5PrescribedAtmosphere test
glwagner Apr 3, 2026
9faf712
Skip inpainting in column_field_from_file
glwagner Apr 3, 2026
9dcfe1e
Fix single column example: use Float64 clock, fix time types
glwagner Apr 3, 2026
96b271e
Set explicit JRA55 date range in single column example
glwagner Apr 4, 2026
043f855
Export location and native_grid from NumericalEarth
glwagner Apr 9, 2026
9b25189
Revert EarthSystemModel files to match main branch
glwagner Apr 9, 2026
ff234da
Import location from Oceananigans for re-export
glwagner Apr 9, 2026
a7b720e
Revert remaining Oceananigans 0.106.3 changes to match main
glwagner Apr 9, 2026
b76de32
Restrict Oceananigans compat to 0.104-0.105
glwagner Apr 9, 2026
20fef3c
Exclude ClimaSeaIce 0.4.6 from compat bounds
glwagner Apr 9, 2026
6a29b9c
Fix FieldTimeSeries bugs and convert data-downloading doc examples
glwagner Apr 9, 2026
e2b10a6
Fix CI env vars for CopernicusMarine and revert ORCA Ny assertions
glwagner Apr 9, 2026
f099ac3
Move GLORYS test to Data Downloading job; fix CI secret names
glwagner Apr 10, 2026
e9eaa99
Exclude test_orca_grid from GPU CI to reduce disk usage
glwagner Apr 10, 2026
d99b6cd
Clean GPU runner Julia depot before tests to free disk space
glwagner Apr 10, 2026
04057ed
More aggressive GPU depot cleanup: also remove packages dir
glwagner Apr 10, 2026
b3b7140
Increase Data Downloading job timeout to 90 minutes
glwagner Apr 10, 2026
e02202e
Split Data Downloading into 3 parallel CI jobs
glwagner Apr 10, 2026
692c378
Fix CI summary job to reference renamed data_downloading job
glwagner Apr 10, 2026
ffee998
Skip bulk data downloads when running specialized download tests
glwagner Apr 10, 2026
8332735
Replace test_downloading with lightweight dataset-specific download t…
glwagner Apr 11, 2026
39c5a58
Merge branch 'main' into glw-eq/regional-metadata
glwagner Apr 12, 2026
2764899
Fix CI failures from external service outages and h5py incompatibility
glwagner Apr 12, 2026
919131c
Skip test_ecco_atmosphere on GPU to avoid disk space issues
glwagner Apr 12, 2026
b80ad8a
Fix ERA5PrescribedAtmosphere: use specific_humidity instead of dewpoi…
glwagner Apr 12, 2026
81d7bea
Skip ECCO2Daily test and data on GPU to avoid disk space exhaustion
glwagner Apr 12, 2026
cbac838
Skip all ECCO2 datasets on GPU to fit within disk limits
glwagner Apr 12, 2026
2a7779f
Skip all dataset download tests on GPU
glwagner Apr 13, 2026
3197893
Aggressively clean GPU depot to reclaim disk space
glwagner Apr 13, 2026
1ad15d2
Stop removing artifacts in GPU cleanup to avoid timeout
glwagner Apr 13, 2026
2d2e798
Wipe temp depot entirely on GPU runner to reclaim disk
glwagner Apr 13, 2026
eb53cbd
Add continue-on-error to GPU job due to disk space limitations
glwagner Apr 13, 2026
3bc51b3
Fix CI summary job to only require CPU and Reactant to pass
glwagner Apr 13, 2026
98927d0
Revert GPU test exclusions and CI workarounds to match main
glwagner Apr 14, 2026
f64bed6
Strip PR to minimal Column/region changes only
glwagner Apr 14, 2026
1b320ee
Pin Oceananigans compat to 0.106.3
glwagner Apr 14, 2026
e9fc213
Widen Oceananigans compat to 0.106 (any patch)
glwagner Apr 14, 2026
04feea8
Fix test/Project.toml Oceananigans compat to match Project.toml
glwagner Apr 14, 2026
1a5d2eb
Pin Oceananigans to 0.106.3 (avoid 0.106.5 breaking change)
glwagner Apr 14, 2026
6835d19
Pin Oceananigans to exactly 0.106.3 with = syntax
glwagner Apr 14, 2026
3a009c9
Pin ClimaSeaIce to exactly 0.4.4
glwagner Apr 14, 2026
a2857b8
Fix Oceananigans 0.106.5 compat: remove initialization_update_state! …
glwagner Apr 14, 2026
960bafc
Fix remaining initialization_update_state! references
glwagner Apr 14, 2026
d1379bc
Pin Oceananigans to 0.106.3 in Project.toml
glwagner Apr 14, 2026
cb1c64c
Pin Oceananigans to 0.106.3 in test/Project.toml too
glwagner Apr 14, 2026
24a3523
Use exact pin syntax "= 0.106.3" for Oceananigans
glwagner Apr 15, 2026
b2e6389
Pin ClimaSeaIce to exactly 0.4.4
glwagner Apr 15, 2026
22f1ae2
Use Oceananigans 0.106 compat (accept 0.106.5)
glwagner Apr 15, 2026
6634f7a
Revert all package version and unrelated infrastructure changes
glwagner Apr 15, 2026
2d25532
Sync test/Project.toml Oceananigans compat with Project.toml
glwagner Apr 15, 2026
2fcea5f
Fix Oceananigans 0.106.5 compat: remove initialization_update_state! …
glwagner Apr 15, 2026
fdd993c
restore ci.yml to main
glwagner Apr 16, 2026
1d163bc
restore orca grid to main
glwagner Apr 16, 2026
d9b275f
Add example back
glwagner Apr 16, 2026
472f552
ignore claude
glwagner Apr 16, 2026
67853dc
restoration
glwagner Apr 16, 2026
ea7751e
restore
glwagner Apr 16, 2026
c9b5f30
restoer
glwagner Apr 16, 2026
0ead36a
restore
glwagner Apr 16, 2026
86439c0
more of that
glwagner Apr 16, 2026
fcaea53
Apply suggestion from @glwagner
glwagner Apr 16, 2026
81dc441
Apply suggestion from @glwagner
glwagner Apr 16, 2026
182169e
Use GLORYS + Column region for ocean IC in single column example
glwagner Apr 16, 2026
7e70142
Fix GLORYS test: rename bounding_box kwarg to region
glwagner Apr 16, 2026
291ee42
Merge branch 'main' into glw-eq/regional-metadata
glwagner Apr 22, 2026
7bd4277
fix test errors
glwagner Apr 22, 2026
d6ae2ff
Merge branch 'glw-eq/regional-metadata' of https://github.com/Numeric…
glwagner Apr 22, 2026
3863c47
Merge branch 'main' into glw-eq/regional-metadata
glwagner Apr 23, 2026
77d7d08
fix test
glwagner Apr 23, 2026
5db26cb
bounding_box -> region
glwagner Apr 23, 2026
6355614
fix formatting
glwagner Apr 23, 2026
2a113cf
Add disk cleanup to data_downloading CI job
glwagner Apr 23, 2026
d7cdfcb
Add extra disk cleanup to GPU CI job
glwagner Apr 23, 2026
ea8f781
Revert "Add extra disk cleanup to GPU CI job"
glwagner Apr 23, 2026
8db5b49
Revert "Add disk cleanup to data_downloading CI job"
glwagner Apr 23, 2026
0736aeb
rm fallback from glorys test
glwagner Apr 24, 2026
f00a387
Move GLORYS downloading test to the data downloading CI job
glwagner Apr 24, 2026
7d9e9a0
Rename test_downloading.jl to test_jra55_ecco_en4_etopo_downloading.jl
glwagner Apr 24, 2026
ae27d2a
Fix GLORYS free_surface location: use dataset_location instead of loc…
glwagner Apr 24, 2026
37ce2a9
Merge branch 'main' into glw-eq/regional-metadata
simone-silvestri Apr 24, 2026
12a49fc
correct username and passwords
simone-silvestri Apr 24, 2026
0105162
Add Copernicus credentials to docs workflow
glwagner Apr 24, 2026
b6be342
Update docs.yml to manage ECCO credentials
glwagner Apr 24, 2026
0f1a9e7
Update src/NumericalEarth.jl
glwagner Apr 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ jobs:
using Pkg;
Pkg.test(; coverage=true,
julia_args=["--check-bounds=yes", "--compiled-modules=yes", "-O0"],
test_args=["--verbose", "test_cds_downloading", "test_downloading"])
test_args=["--verbose", "test_cds_downloading", "test_jra55_ecco_en4_etopo_downloading", "test_glorys_downloading"])
'
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v5
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ env:
NUMERICAL_EARTH_LABEL_BUILD_ALL_EXAMPLES: 'build all examples'
CDSAPI_URL: "https://cds.climate.copernicus.eu/api"
CDSAPI_KEY: ${{ secrets.CDSAPI_KEY }}
COPERNICUS_USERNAME: ${{ secrets.COPERNICUSMARINE_SERVICE_USERNAME }}
COPERNICUS_PASSWORD: ${{ secrets.COPERNICUSMARINE_SERVICE_PASSWORD }}
ECCO_USERNAME: ${{ secrets.ECCO_USERNAME }}
ECCO_WEBDAV_PASSWORD: ${{ secrets.ECCO_WEBDAV_PASSWORD }}

jobs:
build-docs:
Expand Down Expand Up @@ -63,10 +67,6 @@ jobs:
run: julia --project=docs --color=yes -e 'using Pkg; Pkg.instantiate(verbose=true)'
- name: Build documentation
env:
ECCO_USERNAME: ${{ secrets.ECCO_USERNAME }}
ECCO_WEBDAV_PASSWORD: ${{ secrets.ECCO_WEBDAV_PASSWORD }}
COPERNICUS_USERNAME: ${{ secrets.COPERNICUS_SERVICE_USERNAME }}
COPERNICUS_PASSWORD: ${{ secrets.COPERNICUS_USERNAME_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JULIA_DEBUG: Documenter
JULIA_SSL_NO_VERIFY: "**"
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ docs/src/literated/
.CondaPkg
CondaPkg.toml
!docs/CondaPkg.toml

# claude
.claude
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "NumericalEarth"
uuid = "904d977b-046a-4731-8b86-9235c0d1ef02"
license = "MIT"
version = "0.2.3"
version = "0.3.0"
authors = ["NumericalEarth contributors"]

[deps]
Expand Down
6 changes: 4 additions & 2 deletions docs/CondaPkg.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Pin Python to < 3.14 to avoid the free-threaded build (cp314t)
# which is ABI-incompatible with PythonCall.

[deps.copernicusmarine]
channel = "conda-forge"

[deps.python]
version = ">=3.10,<3.14"
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
ClimaSeaIce = "6ba0ff68-24e6-4315-936c-2e99227c95a4"
CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab"
CopernicusMarine = "cd43e856-93a3-40c8-bc9e-6146cdce14fa"
DataDeps = "124859b0-ceae-595e-8997-d05f6a7a8dfe"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Expand Down
8 changes: 5 additions & 3 deletions docs/src/Metadata/metadata_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ The key ingredients stored in a [`Metadata`](@ref) or [`Metadatum`](@ref) object
- the variable name (for example `:temperature` or `:u_velocity`);
- the dataset (such as `EN4Monthly`, `ECCO2Daily`, or `GLORYSMonthly`);
- the temporal coverage: either a single timestamp (`Metadatum`) or a range/vector of dates (`Metadata`);
- an optional [`BoundingBox`](@ref NumericalEarth.DataWrangling.BoundingBox) describing regional subsets in
longitude, latitude, or depth;
- the on-disk `dir`ectory where the dataset are be cached.
- an optional `region` describing the spatial extent — either a
[`BoundingBox`](@ref NumericalEarth.DataWrangling.BoundingBox) for a rectangular sub-domain,
a [`Column`](@ref NumericalEarth.DataWrangling.Column) for a single horizontal location, or
`nothing` for the full global domain (see [Regions, locations, and FieldTimeSeries](@ref));
- the on-disk `dir`ectory where the dataset files are cached.

This bookkeeping lets downstream utilities (for example `set!` or `FieldTimeSeries`) request exactly the
slices of data they need, and it keeps track of where those slices live so we do not redownload
Expand Down
8 changes: 4 additions & 4 deletions examples/download_glorys_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ grid = LatitudeLongitudeGrid(arch;
latitude = (35, 55),
longitude = (200, 220))

bounding_box = NumericalEarth.DataWrangling.BoundingBox(longitude=(200, 220), latitude=(35, 55))
region = NumericalEarth.DataWrangling.BoundingBox(longitude=(200, 220), latitude=(35, 55))

# dataset = NumericalEarth.DataWrangling.Copernicus.GLORYSStatic()
# static_meta = NumericalEarth.DataWrangling.Metadatum(:depth; dataset, bounding_box)
# static_meta = NumericalEarth.DataWrangling.Metadatum(:depth; dataset, region)
# coords_path = NumericalEarth.DataWrangling.download_dataset(static_meta)
# @info "Downloaded coordinates data to $coords_path"

# T_ecco = NumericalEarth.DataWrangling.ECCOMetadatum(:temperature; dataset, bounding_box)
# T_ecco = NumericalEarth.DataWrangling.ECCOMetadatum(:temperature; dataset, region)
# T_en4_meta = NumericalEarth.DataWrangling.EN4Metadatum(:temperature)
# T_en4_path = NumericalEarth.DataWrangling.download_dataset(T_en4_meta)
# T_en4 = Field(T_en4_meta)

dataset = NumericalEarth.DataWrangling.Copernicus.GLORYSDaily()
T_meta = NumericalEarth.DataWrangling.Metadatum(:temperature; dataset, bounding_box)
T_meta = NumericalEarth.DataWrangling.Metadatum(:temperature; dataset, region)
T_path = NumericalEarth.DataWrangling.download_dataset(T_meta)
@info "Downloaded temperature data to $T_path"
T = Field(T_meta, inpainting=nothing)
Expand Down
13 changes: 9 additions & 4 deletions examples/single_column_os_papa_simulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# pkg"add Oceananigans, NumericalEarth, CairoMakie"
# ```

using CopernicusMarine
using NumericalEarth
using Oceananigans
using Oceananigans: prognostic_fields
Expand All @@ -29,7 +30,7 @@ using Printf

# Ocean station papa location
location_name = "ocean_station_papa"
λ★, φ★ = 35.1, 50.1
λ★, φ★ = -144.9, 50.1

grid = RectilinearGrid(size = 200,
x = λ★,
Expand All @@ -48,10 +49,14 @@ ocean = ocean_simulation(grid; Δt=10minutes, coriolis=FPlane(latitude = φ★))

ocean.model

# We set initial conditions from ECCO4:
# We set initial conditions from GLORYS, using a `Column` region so that
# only the single water column at `(λ★, φ★)` is downloaded from the
# Copernicus Marine Service.

set!(ocean.model, T=Metadatum(:temperature, dataset=ECCO4Monthly()),
S=Metadatum(:salinity, dataset=ECCO4Monthly()))
col = Column(λ★, φ★; interpolation=Nearest())

set!(ocean.model, T=Metadatum(:temperature, dataset=GLORYSMonthly(), region=col),
S=Metadatum(:salinity, dataset=GLORYSMonthly(), region=col))

# # A prescribed atmosphere based on JRA55 re-analysis
#
Expand Down
2 changes: 1 addition & 1 deletion ext/NumericalEarthCDSAPIExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function download_dataset(meta::ERA5Metadatum; skip_existing=true)
)

# Add area constraint from bounding box
area = build_era5_area(meta.bounding_box)
area = build_era5_area(meta.region)
if !isnothing(area)
request["area"] = area
end
Expand Down
41 changes: 34 additions & 7 deletions ext/NumericalEarthCopernicusMarineExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ function download_dataset(meta::GLORYSMetadatum;
(; start_datetime, end_datetime)
end

lon_kw = longitude_bounds_kw(meta.bounding_box)
lat_kw = latitude_bounds_kw(meta.bounding_box)
z_kw = depth_bounds_kw(meta.bounding_box)
lon_kw = longitude_bounds_kw(meta.region)
lat_kw = latitude_bounds_kw(meta.region)
z_kw = depth_bounds_kw(meta.region)
selection_method = coordinates_selection_method(meta.region)

kw = (; coordinates_selection_method = "outside",
kw = (; coordinates_selection_method = selection_method,
skip_existing,
dataset_id,
variables,
Expand All @@ -76,12 +77,38 @@ end
longitude_bounds_kw(::Nothing) = NamedTuple()
latitude_bounds_kw(::Nothing) = NamedTuple()
depth_bounds_kw(::Nothing) = NamedTuple()
coordinates_selection_method(::Nothing) = "outside"

const BBOX = NumericalEarth.DataWrangling.BoundingBox
const COL = NumericalEarth.DataWrangling.Column
const LIN = NumericalEarth.DataWrangling.Linear
const NR = NumericalEarth.DataWrangling.Nearest

longitude_bounds_kw(bbox::BBOX) = longitude_bounds_kw(bbox.longitude)
latitude_bounds_kw(bbox::BBOX) = latitude_bounds_kw(bbox.latitude)
depth_bounds_kw(bbox::BBOX) = depth_bounds_kw(bbox.z)
coordinates_selection_method(::BBOX) = "outside"

# Column with Nearest interpolation: download the single nearest point
longitude_bounds_kw(col::COL{<:Any, <:Any, <:Any, NR}) = (; minimum_longitude = col.longitude, maximum_longitude = col.longitude)
latitude_bounds_kw(col::COL{<:Any, <:Any, <:Any, NR}) = (; minimum_latitude = col.latitude, maximum_latitude = col.latitude)
depth_bounds_kw(col::COL) = depth_bounds_kw(col.z)
coordinates_selection_method(::COL{<:Any, <:Any, <:Any, NR}) = "nearest"

# Column with Linear interpolation: expand by a small margin for interpolation
longitude_bounds_kw(col::COL{<:Any, <:Any, <:Any, LIN}) = expand_longitude(col.longitude)
latitude_bounds_kw(col::COL{<:Any, <:Any, <:Any, LIN}) = expand_latitude(col.latitude)
coordinates_selection_method(::COL{<:Any, <:Any, <:Any, LIN}) = "outside"

function expand_longitude(lon)
ε = 1/6 # slightly more than one GLORYS grid cell (1/12°)
return (; minimum_longitude = lon - ε, maximum_longitude = lon + ε)
end

longitude_bounds_kw(bounding_box::BBOX) = longitude_bounds_kw(bounding_box.longitude)
latitude_bounds_kw(bounding_box::BBOX) = latitude_bounds_kw(bounding_box.latitude)
depth_bounds_kw(bounding_box::BBOX) = depth_bounds_kw(bounding_box.z)
function expand_latitude(lat)
ε = 1/6
return (; minimum_latitude = lat - ε, maximum_latitude = lat + ε)
end

function longitude_bounds_kw(longitude)
minimum_longitude = longitude[1]
Expand Down
3 changes: 3 additions & 0 deletions src/DataWrangling/DataWrangling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ restoring, or validation.
module DataWrangling

export Metadata, Metadatum, DatewiseFilename, ECCOMetadatum, EN4Metadatum, all_dates, first_date, last_date
export BoundingBox, Column, Linear, Nearest
export WOAClimatology, WOAAnnual, WOAMonthly
export metadata_time_step, metadata_epoch
export LinearlyTaperedPolarMask
export DatasetRestoring, SurfaceFluxRestoring
export ERA5Hourly, ERA5Monthly
export native_grid

using Oceananigans
using Downloads
Expand Down Expand Up @@ -189,6 +191,7 @@ function z_interfaces end
function longitude_interfaces end
function latitude_interfaces end
function reversed_vertical_axis end
reversed_latitude_axis(dataset) = false
function native_grid end
function binary_data_grid end
function binary_data_size end
Expand Down
51 changes: 45 additions & 6 deletions src/DataWrangling/ECCO/ECCO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,33 @@ using NumericalEarth.DataWrangling:
netrc_downloader,
NearestNeighborInpainting,
BoundingBox,
Column,
metadata_path,
GramPerKilogramMinus35,
MicromolePerLiter,
Metadata,
Metadatum,
download_progress,
InverseSign
InverseSign,
native_grid,
location,
compute_mask,
inpaint_mask!,
set_metadata_field!,
extract_column!

using KernelAbstractions: @kernel, @index

using Dates: year, month, day

import Oceananigans: location

import NumericalEarth.DataWrangling:
default_download_directory,
all_dates,
metadata_filename,
download_dataset,
conversion_units,
dataset_variable_name,
dataset_location,
metaprefix,
longitude_interfaces,
latitude_interfaces,
Expand Down Expand Up @@ -247,7 +253,7 @@ end
metaprefix(::ECCOMetadata) = "ECCOMetadata"

# File name generation specific to each dataset
function metadata_filename(::ECCO4Monthly, name, date, bounding_box)
function metadata_filename(::ECCO4Monthly, name, date, region)
shortname = ECCO4_dataset_variable_names[name]
yearstr = string(Dates.year(date))
monthstr = string(Dates.month(date), pad=2)
Expand All @@ -260,7 +266,7 @@ ecco2_is_three_dimensional(name) =
name == :u_velocity ||
name == :v_velocity

function metadata_filename(dataset::Union{ECCO2Daily, ECCO2Monthly}, name, date, bounding_box)
function metadata_filename(dataset::Union{ECCO2Daily, ECCO2Monthly}, name, date, region)
shortname = ECCO2_dataset_variable_names[name]
yearstr = string(Dates.year(date))
monthstr = string(Dates.month(date), pad=2)
Expand All @@ -278,7 +284,7 @@ end
dataset_variable_name(data::Metadata{<:ECCO2Daily}) = ECCO2_dataset_variable_names[data.name]
dataset_variable_name(data::Metadata{<:ECCO2Monthly}) = ECCO2_dataset_variable_names[data.name]
dataset_variable_name(data::Metadata{<:ECCO4Monthly}) = ECCO4_dataset_variable_names[data.name]
location(data::ECCOMetadata) = ECCO_location[data.name]
dataset_location(::ECCODataset, name) = ECCO_location[name]

is_three_dimensional(data::ECCOMetadata) =
data.name == :temperature ||
Expand Down Expand Up @@ -365,4 +371,37 @@ inpainted_metadata_path(metadata::ECCOMetadatum) = joinpath(metadata.dir, inpain

include("ECCO_atmosphere.jl")

#####
##### Column Field for ECCO datasets (which always download globally)
#####

using Oceananigans.BoundaryConditions: fill_halo_regions!

const ECCOColumnMetadatum = Metadatum{<:ECCODataset, <:Any, <:Column}

function Oceananigans.Fields.Field(metadata::ECCOColumnMetadatum, arch=CPU();
inpainting = default_inpainting(metadata),
mask = nothing,
halo = (3, 3, 3),
cache_inpainted_data = true)

download_dataset(metadata)
column_grid = native_grid(metadata, arch; halo)

# Build a full-grid Field without a region to load the global data
global_metadatum = Metadatum(metadata.name;
dataset = metadata.dataset,
date = metadata.dates)

intermediate_field = Field(global_metadatum, arch; inpainting, mask, halo, cache_inpainted_data)
fill_halo_regions!(intermediate_field)

# Extract the column
_, _, LZ = location(metadata)
column_field = Field{Nothing, Nothing, LZ}(column_grid)
extract_column!(column_field, intermediate_field, metadata.region)

return column_field
end

end # Module
6 changes: 2 additions & 4 deletions src/DataWrangling/ECCO/ECCO_darwin.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ all_dates(dataset::ECCO2DarwinMonthly, name) = metadata_epoch(dataset) : Month(1

# File name generation specific to each Dataset dataset
"""
metadata_filename(dataset, name, date, bounding_box)
metadata_filename(dataset, name, date, region)

Generate the filename for a given ECCO Darwin dataset and date.

The filename is constructed using the dataset variable name, and the iteration number is calculated
from the date and epoch.
"""
function metadata_filename(dataset::Union{ECCO2DarwinMonthly, ECCO4DarwinMonthly}, name, date, bounding_box)
function metadata_filename(dataset::Union{ECCO2DarwinMonthly, ECCO4DarwinMonthly}, name, date, region)
shortname = ECCO_darwin_dataset_variable_names[name]

reference_date = metadata_epoch(dataset)
Expand All @@ -52,8 +52,6 @@ default_mask_value(::ECCO2DarwinMonthly) = 0

dataset_variable_name(data::Metadata{<:Union{ECCO2DarwinMonthly,ECCO4DarwinMonthly}}) = ECCO_darwin_dataset_variable_names[data.name]

location(::Metadata{<:Union{ECCO2DarwinMonthly, ECCO4DarwinMonthly}}) = (Center, Center, Center)

variable_is_three_dimensional(::Metadata{<:Union{ECCO2DarwinMonthly, ECCO4DarwinMonthly}}) = true

ECCO_darwin_dataset_variable_names = Dict(
Expand Down
4 changes: 1 addition & 3 deletions src/DataWrangling/EN4/EN4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import NumericalEarth.DataWrangling:
inpainted_metadata_path,
available_variables

import Oceananigans.Fields: location

download_EN4_cache::String = ""
function __init__()
Expand Down Expand Up @@ -160,15 +159,14 @@ metaprefix(::EN4Metadatum) = "EN4Metadatum"

# Note, EN4 files contain all variables, so the filenames do not
# depend on name.
function metadata_filename(::EN4Monthly, name, date, bounding_box)
function metadata_filename(::EN4Monthly, name, date, region)
yearstr = string(Dates.year(date))
monthstr = string(Dates.month(date), pad=2)
return "EN.4.2.2.f.analysis.g10." * yearstr * lpad(string(monthstr), 2, '0') * ".nc"
end

# Convenience functions
dataset_variable_name(data::EN4Metadata) = EN4_dataset_variable_names[data.name]
location(::EN4Metadata) = (Center, Center, Center)
is_three_dimensional(::EN4Metadata) = true

## This function is explicitly for the downloader to check if the zip file/extracted file exists,
Expand Down
Loading
Loading