-
Couldn't load subscription status.
- Fork 22
Add Copernicus BGC DataWrangling #607
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
Open
vtamsitt
wants to merge
12
commits into
CliMA:main
Choose a base branch
from
vtamsitt:add_bgc_datawrangling
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f9d3425
added BGC products to Copernicus.jl
7983fca
fixed typo
dd4c45c
split sizes and variable names
6b35151
update available_variables
c6c0312
Merge branch 'CliMA:main' into add_bgc_datawrangling
vtamsitt ecb54a4
simplify + add test for download CopernicusBGC
navidcy 91b7663
Merge branch 'main' into add_bgc_datawrangling
navidcy a659054
Merge branch 'CliMA:main' into add_bgc_datawrangling
vtamsitt 9fc87c1
master variable names dict
c9a505a
write out variable names
1ccacf4
new abstract types and cleanup
glwagner 44c69f3
bugfix
glwagner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| module Copernicus | ||
|
|
||
| export GLORYSStatic, GLORYSDaily, GLORYSMonthly | ||
| export GLORYSStatic, GLORYSDaily, GLORYSMonthly, GLORYSBGCDaily, GLORYSBGCMonthly | ||
|
|
||
| using NCDatasets | ||
| using Printf | ||
|
|
@@ -33,37 +33,79 @@ end | |
|
|
||
| # Datasets | ||
| abstract type CopernicusDataset end | ||
| abstract type GLORYSDataset <: CopernicusDataset end | ||
|
|
||
| default_download_directory(::CopernicusDataset) = download_Copernicus_cache | ||
|
|
||
| struct GLORYSDaily <: GLORYSDataset end | ||
| struct GLORYSMonthly <: GLORYSDataset end | ||
| struct GLORYSBGCDaily <: GLORYSDataset end | ||
| struct GLORYSBGCMonthly <: GLORYSDataset end | ||
|
|
||
| # This contains "static" variables -- eg the grid | ||
| struct GLORYSStatic <: CopernicusDataset end | ||
| struct GLORYSDaily <: CopernicusDataset end | ||
| struct GLORYSMonthly <: CopernicusDataset end | ||
| struct GLORYSStatic <: GLORYSDataset end | ||
|
|
||
| dataset_name(::GLORYSStatic) = "GLORYSStatic" | ||
| dataset_name(::GLORYSDaily) = "GLORYSDaily" | ||
| dataset_name(::GLORYSMonthly) = "GLORYSMonthly" | ||
| dataset_name(::GLORYSBGCDaily) = "GLORYSBGCDaily" | ||
| dataset_name(::GLORYSBGCMonthly) = "GLORYSBGCMonthly" | ||
|
|
||
| all_dates(::GLORYSStatic, var) = [nothing] | ||
| all_dates(::GLORYSDaily, var) = range(DateTime("1993-01-01"), stop=DateTime("2021-06-30"), step=Day(1)) | ||
| all_dates(::GLORYSMonthly, var) = range(DateTime("1993-01-01"), stop=DateTime("2024-12-01"), step=Month(1)) | ||
| all_dates(::GLORYSDaily, var) = range(DateTime("1993-01-01"), stop=DateTime("2021-06-30"), step=Day(1)) | ||
| all_dates(::GLORYSMonthly, var) = range(DateTime("1993-01-01"), stop=DateTime("2024-12-01"), step=Month(1)) | ||
| all_dates(::GLORYSBGCDaily, var) = range(DateTime("1993-01-01"), stop=DateTime("2022-12-30"), step=Day(1)) | ||
| all_dates(::GLORYSBGCMonthly, var) = range(DateTime("1993-01-01"), stop=DateTime("2022-11-30"), step=Month(1)) | ||
|
|
||
| copernicusmarine_dataset_id(::GLORYSStatic) = "cmems_mod_glo_phy_my_0.083deg_static" | ||
| copernicusmarine_dataset_id(::GLORYSDaily) = "cmems_mod_glo_phy_my_0.083deg_P1D-m" | ||
| copernicusmarine_dataset_id(::GLORYSMonthly) = "cmems_mod_glo_phy_my_0.083deg_P1M-m" | ||
| # :static => "cmems_mod_glo_phy_my_0.083deg_static", | ||
| copernicusmarine_dataset_id(::GLORYSBGCDaily) = "cmems_mod_glo_bgc_my_0.25deg_P1D-m" | ||
| copernicusmarine_dataset_id(::GLORYSBGCMonthly) = "cmems_mod_glo_bgc_my_0.25deg_P1M-m" | ||
|
|
||
| struct CMEMSHourlyAnalysis <: CopernicusDataset end | ||
| copernicusmarine_dataset_id(::CMEMSHourlyAnalysis) = "cmems_mod_glo_phy_anfc_0.083deg_PT1H-m" | ||
|
|
||
| CopernicusMetadata{D} = Metadata{<:CopernicusDataset, D} | ||
| CopernicusMetadatum = Metadatum{<:CopernicusDataset} | ||
|
|
||
| Base.size(::CopernicusMetadatum) = (4320, 2040, 50, 1) | ||
| Base.size(::GLORYSStatic) = (4320, 2040, 50, 1) | ||
| Base.size(::GLORYSDaily) = (4320, 2040, 50, 1) | ||
| Base.size(::GLORYSMonthly) = (4320, 2040, 50, 1) | ||
| Base.size(::GLORYSBGCDaily) = (1440, 680, 75, 1) | ||
| Base.size(::GLORYSBGCMonthly) = (1440, 680, 75, 1) | ||
|
|
||
| reversed_vertical_axis(::CopernicusDataset) = true | ||
|
|
||
| available_variables(::CopernicusDataset) = copernicus_dataset_variable_names | ||
| available_variables(::GLORYSDataset) = ( | ||
| :temperature, | ||
| :depth, | ||
| :salinity, | ||
| :sea_ice_concentration, | ||
| :sea_ice_thickness, | ||
| :u_velocity, | ||
| :v_velocity, | ||
| :sea_ice_u_velocity, | ||
| :sea_ice_v_velocity, | ||
| :free_surface, | ||
| ) | ||
|
|
||
| available_variables(::GLORYSBGCDaily) = ( | ||
| :total_chlorophyll, | ||
| :primary_production, | ||
| :nitrate, | ||
| :phosphate, | ||
| :dissolved_silicate, | ||
| :dissolved_oxygen, | ||
| ) | ||
|
|
||
| available_variables(::GLORYSBGCMonthly) = tuple( | ||
| available_variables(GLORYSBGCDaily())..., | ||
| :dissolved_iron, | ||
| :ph, | ||
| :surface_co2, | ||
| :total_phytoplankton, | ||
| ) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vtamsitt this expresses how the monthly variables are a superset of the daily variables |
||
|
|
||
| copernicus_dataset_variable_names = Dict( | ||
| :temperature => "thetao", | ||
|
|
@@ -76,6 +118,16 @@ copernicus_dataset_variable_names = Dict( | |
| :sea_ice_u_velocity => "usi", | ||
| :sea_ice_v_velocity => "vsi", | ||
| :free_surface => "zos", | ||
| :total_chlorophyll => "chl", | ||
| :primary_production => "nppv", | ||
| :nitrate => "no3", | ||
| :phosphate => "po4", | ||
| :dissolved_silicate => "si", | ||
| :dissolved_oxygen => "o2", | ||
| :dissolved_iron => "fe", | ||
| :ph => "ph", | ||
| :surface_co2 => "spCO2", | ||
| :total_phytoplankton => "phyc", | ||
| ) | ||
|
|
||
| start_date_str(date) = string(date) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This abstract type allows us to implement one
available_variablesfor the two physics datasetsGLORYSMonthly,GLORYSDaily