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

Added ROMS ocean model example notebook #3116

Merged
merged 10 commits into from
Aug 16, 2019
Merged

Added ROMS ocean model example notebook #3116

merged 10 commits into from
Aug 16, 2019

Conversation

hetland
Copy link

@hetland hetland commented Jul 13, 2019

  • Fully documented, including whats-new.rst for all changes and api.rst for new API

This is an example of reading and visualizing ROMS model output. A highlight is adding a lazily calculated vertical coordinate. This notebook will need an example ROMS output file to run, called ROMS_example.nc. This will be uploaded to the data repository.

@codecov
Copy link

codecov bot commented Jul 13, 2019

Codecov Report

Merging #3116 into scipy19-docs will increase coverage by <.01%.
The diff coverage is 100%.

@@               Coverage Diff                @@
##           scipy19-docs    #3116      +/-   ##
================================================
+ Coverage         95.99%   95.99%   +<.01%     
================================================
  Files                63       63              
  Lines             12796    12799       +3     
================================================
+ Hits              12284    12287       +3     
  Misses              512      512

* switching out examples to use nbsphinx

* added jupyter_client to doc env

* allow non netcdf tutorial files
@rabernat
Copy link
Contributor

@hetland - thanks so much for this! Now that pydata/xarray-data#13 has been merged, can you try to update your example to use the xr.tutorial.open_dataset('ROMS_example.nc') function?

@hetland
Copy link
Author

hetland commented Jul 15, 2019 via email

added some extra documentation.
@hetland
Copy link
Author

hetland commented Jul 15, 2019

I'm having a hard time getting the docs to compile, they fail when loading the ROMS_example.nc file, though I switched to xr.tutorial.open_dataset('ROMS_example.nc'). Is there something else I need to do? I pushed a revised version.

@rabernat
Copy link
Contributor

Can you post the error and stack trace?

@rabernat
Copy link
Contributor

You have to rebase your feature branch on the upstream/scipy19-docs branch in order to get #3121 to work locally.

git fetch upstream
git rebase upstream/scipy19-docs

@rabernat
Copy link
Contributor

I just saw the new PR (#3134). You don't need to start a new PR unless something is truly broken here. You can just keep pushing to this one.

@hetland
Copy link
Author

hetland commented Jul 16, 2019

OK, I closed the other pull request, and updated this branch.

"import cartopy.feature as cfeature\n",
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"# import cmocean # TODO: Add this dependency to the docs\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep cmocean out since it isn't strictly necessary for the example.

"ds = xr.tutorial.open_dataset('ROMS_example.nc', chunks={'ocean_time': 1})\n",
"\n",
"# This is a way to turn on chunking and lazy evaluation. Opening with mfdataset, or \n",
"# setting the chunking in the open_dataset would also achive this.\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"# setting the chunking in the open_dataset would also achive this.\n",
"# setting the chunking in the open_dataset would also achieve this.\n",

"outputs": [],
"source": [
"section = ds.salt.isel(xi_rho=50, eta_rho=slice(0, 167), ocean_time=0)\n",
"section.plot(x='lon_rho', y='z_rho', figsize=(15, 6), cmap=cmocean.cm.haline, clim=(25, 35))\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets just use a standard matplotlib colormap

@rabernat
Copy link
Contributor

rabernat commented Aug 2, 2019

I am returning to this after some vacation. Thanks so much @hetland for this great example!

The test failures are not related to this PR. I see only three things that need to be done to get this ready to merge.

  • Add a short introductory paragraph at the very top of the notebook with some very general backgroud. Remember we have users from tons of different fields (e.g. finance, bioinformatics); they will have no idea what ROMS stands for or even what an ocean model is. We need a few sentences to introduce this example and explain what it shows (primarily how to visualize data that has irregular / derived coordinate geometry)
  • Remove or resolve the commented-out code in the example.
  • Add credit to @hetland in whats-new.rst

@hetland
Copy link
Author

hetland commented Aug 2, 2019 via email

@rabernat
Copy link
Contributor

Thanks for this @hetland! I'm going to merge now!

@rabernat rabernat merged commit 79aa804 into pydata:scipy19-docs Aug 16, 2019
@rabernat
Copy link
Contributor

I finally got the page to build and it looks great!
http://xarray.pydata.org/en/scipy19-docs/examples/ROMS_ocean_model.html

There was an issue with the ROMS MD5 checksum which I fixed in pydata/xarray-data#17. The checksums .md5 files cannot have newlines at the end.

@dcherian
Copy link
Contributor

It looks awesome!

keewis pushed a commit to keewis/xarray that referenced this pull request Nov 21, 2019
* change name of test env to xarray-tests (pydata#3110)

* ROMS_ocean_model example added

* Allow other tutorial filename extensions (pydata#3121)

* switching out examples to use nbsphinx

* added jupyter_client to doc env

* allow non netcdf tutorial files

* Changed load to xr.tutorial.open_dataset(), and
added some extra documentation.

* change name of test env to xarray-tests (pydata#3110)

* ROMS_ocean_model example added

* Changed load to xr.tutorial.open_dataset(), and
added some extra documentation.

* fixed colormap issues leftover from cmocean import

* Added intro paragraph to ROMS example notebook, removed comments, and added citation in whats-new.
@keewis keewis mentioned this pull request Nov 21, 2019
1 task
dcherian pushed a commit that referenced this pull request Nov 22, 2019
* Switch doc examples to use nbsphinx (#3105)

* switching out examples to use nbsphinx

* added jupyter_client to doc env

* added ipykernel to doc env

* Replace sphinx_gallery with notebook (#3106)

* switching out examples to use nbsphinx

* added jupyter_client to doc env

* moved gallery to notebook

* Allow other tutorial filename extensions (#3121)

* switching out examples to use nbsphinx

* added jupyter_client to doc env

* allow non netcdf tutorial files

* Added ROMS ocean model example notebook (#3116)

* change name of test env to xarray-tests (#3110)

* ROMS_ocean_model example added

* Allow other tutorial filename extensions (#3121)

* switching out examples to use nbsphinx

* added jupyter_client to doc env

* allow non netcdf tutorial files

* Changed load to xr.tutorial.open_dataset(), and
added some extra documentation.

* change name of test env to xarray-tests (#3110)

* ROMS_ocean_model example added

* Changed load to xr.tutorial.open_dataset(), and
added some extra documentation.

* fixed colormap issues leftover from cmocean import

* Added intro paragraph to ROMS example notebook, removed comments, and added citation in whats-new.

* Add an example of ERA5 and GRIB data & visualization to the gallery (#3199)

* Adds an example of ERA5 and GRIB data to the gallery

* Add markdown narrative cells to GRIB example

* Update load method to use xr.tutorial

* Fix load method

* require nbsphinx for the documentation builds

* add more nbsphinx dependencies

* install cfgrib using pip

* add the eccodes library to the dependencies

* remove the dependency on sphinx-gallery

* add the ERA5 GRIB example to the list

* update the documentation links

Missing: section links in visualization_gallery.ipynb don't work yet,
also the one in io.rst (it has a unicode char).

* Fix leap year condition in monthly means example (#3464)

* Typo correction in docs (#3387)

* Update terminology.rst (#3455)

Fixed broken link

* Error in leap year?

I've tried this script; however, it adds +1 to all months of the leap years. It sounds like an error, or I am wrong? So I wrote the condition "and month == 2" line 86 so that only the month of February gets +1.

* Fix leap year (#3464)

* Update doc/whats-new.rst

Co-Authored-By: Deepak Cherian <[email protected]>

* fix the reference to the rasterio geocoordinates docs

* update whats-new.rst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants