-
Notifications
You must be signed in to change notification settings - Fork 22
Add datawrangling tutorial #587
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
navidcy
wants to merge
15
commits into
main
Choose a base branch
from
ncc-glw/datawrangling-tutorial
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.
+556
−17
Open
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
af8904c
add dataset tutorial
navidcy edf9ef8
add missing all_dates method
navidcy b564a37
add module docstring
navidcy 0d4ae96
first go
navidcy b3c230a
drop uncessecary all_dates methods
navidcy ed112c6
add land
navidcy 22c2592
less data
navidcy d505877
rephrase
navidcy b5d5ade
bit more realistic coast
navidcy 596f477
remove ClimaOcean
navidcy 0d3c699
Merge branch 'main' into ncc-glw/datawrangling-tutorial
navidcy 3495dba
Merge branch 'main' into ncc-glw/datawrangling-tutorial
glwagner 914e5ec
Update docs/src/datasets.md
glwagner fb6ccdf
Merge branch 'main' into ncc-glw/datawrangling-tutorial
glwagner e30b9c1
building out
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
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 |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # Datasets | ||
|
|
||
| The [`DataWrangling`](@ref ClimaOcean.DataWrangling) module allows us to use various datasets | ||
| in ClimaOcean simulations. | ||
|
|
||
| A central concept in the `DataWrangling` module is that of [`Metadata`](@ref). | ||
| Metadata is a collection of information for the dataset, like the dataset's name, the variable | ||
| that it involves, the date range, where the dataset is stored locally. | ||
|
|
||
| For example, below we construct a metadata for the temperature variable from the EN4Monthly dataset. | ||
|
|
||
| ```@example metadata | ||
| using ClimaOcean | ||
| using Dates | ||
|
|
||
| T_meta = Metadata(:temperature, dataset=EN4Monthly()) | ||
| ``` | ||
|
|
||
| We can use `start_date` and `end_date` keyword arguments to select only some of the data | ||
| available in the dataset. For example, to get only the first quarter of 2010 we do | ||
|
|
||
| ```@example metadata | ||
| T_meta = Metadata(:temperature, dataset=EN4Monthly(), | ||
| start_date = Date(2010, 1), | ||
| end_date = Date(2010, 3)) | ||
| ``` | ||
|
|
||
| We can use `set!` on a field or a model | ||
|
|
||
| ```@example metadata | ||
| using Oceananigans | ||
|
|
||
| Nx, Ny, Nz = 720, 360, 4 | ||
| underlying_grid = LatitudeLongitudeGrid(size=(Nx, Ny, Nz), | ||
| longitude = (0, 360), | ||
| latitude = (-90, 90), | ||
| z = (-5000, 0)) | ||
|
|
||
| bottom_height = regrid_bathymetry(underlying_grid) | ||
|
|
||
| grid = ImmersedBoundaryGrid(underlying_grid, GridFittedBottom(bottom_height)) | ||
|
|
||
| T = CenterField(grid) | ||
| ``` | ||
|
|
||
| Note that `T` field above is empty. Now we can set it to the first time slice of `T_meta`. | ||
|
|
||
| ```@example metadata | ||
| set!(T, first(T_meta)) | ||
| ``` | ||
|
|
||
| Now `T` has values. Also note how `set!` above triggered downloading the dataset that | ||
| corresponds to `T_meta`. | ||
|
|
||
| ```@example metadata | ||
| using CairoMakie | ||
|
|
||
| heatmap(view(T, :, :, grid.Nz)) | ||
| ``` | ||
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
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.