Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read ECCO-Darwin field from NASA Earthdata #328

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ImageMorphology = "787d08f9-d448-5407-9aad-5290dd7ab264"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
MeshArrays = "cb8c808f-1acf-59a3-9d2b-6e38d009f683"
NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
Oceananigans = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
Expand Down
11 changes: 7 additions & 4 deletions src/DataWrangling/ECCO/ECCO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module ECCO

export ECCOMetadata, ECCO_field, ECCO_mask, ECCO_immersed_grid, adjusted_ECCO_tracers, initialize!
export ECCO2Monthly, ECCO4Monthly, ECCO2Daily
export ECCODarwinMetadata, ECCO4DarwinMonthly, ECCO270DarwinMonthly
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note, "ECCO4" refers to ECCO version 4, but certainly "ECCO 270" does not refer to ECCO version 270. Do we have ideas for clearer naming?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unclear to me, at least, if LLC270 will be ECCOv5, or if it's a stop-gap for a high res run, that's not CS510 (which is what you're calling ECCO2). Also, FYI there are 5 "releases" of ECCO version 4. ECCODarwin has results on V4r4 and V4r5, but I left that out for now, and just stuck to "ECCO4".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, well the key for the metadata is to define the grid and a way to set the variables. So if the different releases occupy the same pattern, then loading data from different releases can be described through properties of the types rather than the type names; for example ECCO4Monthly(release=5) or whatever.

We can call ECCO2 CS510 btw. As I understand it, "ECCO v2" refers to the run, whereas CS510 is the name of the grid "cubed sphere 510 points" or whatever. So the name "CS510" is less specific than "ECCO2"; there are many runs with CS510 that are not ECCO, or not on Earth at all. Similarly LLC270 is the name of the grid, right?

export ECCORestoring, LinearlyTaperedPolarMask

using ClimaOcean
Expand Down Expand Up @@ -33,6 +34,8 @@ include("ECCO_metadata.jl")
include("ECCO_mask.jl")
include("ECCO_restoring.jl")

include("ECCODarwin.jl")

# Vertical coordinate
const ECCO_z = [
-6128.75,
Expand Down Expand Up @@ -90,7 +93,7 @@ const ECCO_z = [

empty_ECCO_field(variable_name::Symbol; kw...) = empty_ECCO_field(ECCOMetadata(variable_name); kw...)

function empty_ECCO_field(metadata::ECCOMetadata;
function empty_ECCO_field(metadata::Union{ECCOMetadata,ECCODarwinMetadata};
seamanticscience marked this conversation as resolved.
Show resolved Hide resolved
architecture = CPU(),
horizontal_halo = (7, 7))

Expand Down Expand Up @@ -235,15 +238,15 @@ end
# Fallback
ECCO_field(var_name::Symbol; kw...) = ECCO_field(ECCOMetadata(var_name); kw...)

function inpainted_metadata_filename(metadata::ECCOMetadata)
function inpainted_metadata_filename(metadata::Union{ECCOMetadata,ECCODarwinMetadata})
seamanticscience marked this conversation as resolved.
Show resolved Hide resolved
original_filename = metadata_filename(metadata)
without_extension = original_filename[1:end-3]
return without_extension * "_inpainted.jld2"
end

inpainted_metadata_path(metadata::ECCOMetadata) = joinpath(metadata.dir, inpainted_metadata_filename(metadata))
inpainted_metadata_path(metadata::Union{ECCOMetadata,ECCODarwinMetadata}) = joinpath(metadata.dir, inpainted_metadata_filename(metadata))
seamanticscience marked this conversation as resolved.
Show resolved Hide resolved

function set!(field::Field, ECCO_metadata::ECCOMetadata; kw...)
function set!(field::Field, ECCO_metadata::Union{ECCOMetadata,ECCODarwinMetadata}; kw...)

# Fields initialized from ECCO
grid = field.grid
Expand Down
Loading
Loading