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

Tutorial 3 - Add first draft of an xarray integration tutorial #15

Merged
merged 11 commits into from
Dec 1, 2024
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

# Jupyter Notebook
.ipynb_checkpoints/

# Data
book/data.nc
56 changes: 56 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-json
- id: check-yaml
- id: debug-statements
- id: mixed-line-ending

- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0
hooks:
- id: pyupgrade
args:
- "--py38-plus"

- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black

- repo: https://github.com/keewis/blackdoc
rev: v0.3.9
hooks:
- id: blackdoc

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.7.2"
hooks:
- id: ruff
args: ["--fix"]
Copy link
Member

Choose a reason for hiding this comment

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

Oh, and just on this pre-commit config, there's this comment at https://github.com/astral-sh/ruff-pre-commit/tree/v0.7.4?tab=readme-ov-file#using-ruff-with-pre-commit:

When running with --fix, Ruff's lint hook should be placed before Ruff's formatter hook, and before Black, isort, and other formatting tools, as Ruff's fix behavior can output code changes that require reformatting

So maybe best to put ruff-pre-commit before black? Or just rely on ruff-format and remove black.


- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.7
hooks:
- id: nbqa-ruff
args: ["--fix"]
- id: nbqa-isort
args: ["--profile=black"]
additional_dependencies: [isort==5.6.4]
- id: nbqa-black
- id: nbqa-pyupgrade
args: ["--py37-plus"]

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
6,707 changes: 6,707 additions & 0 deletions book/tut03_spec_xarray.ipynb
Copy link
Member

Choose a reason for hiding this comment

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

Was trying to put inline comments with gitnotebooks but hit into this error - #9 (comment), so will have to put these all in one go:

  1. Description in first few cells
This tutorial is part of the AGU2024 annual meeting GMT/PyGMT pre-conference workshop (PREWS9) Mastering Geospatial Visualizations with GMT/PyGMT

Conference: https://agu.confex.com/agu/agu24/meetingapp.cgi/Session/226736
GitHub: https://github.com/GenericMappingTools/agu24workshop
Website: https://www.generic-mapping-tools.org/agu24workshop
Recommended version: PyGMT v0.13.0 with GMT 6.5.0

Debating on whether all of this needs to be here (thinking of when this goes into the Jupyter Book)? I could put some of this into #12 perhaps?

  1. Typo grd_image - grdimage

Copy link
Member

Choose a reason for hiding this comment

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

Was trying to put inline comments with gitnotebooks but hit into this error - #9 (comment)

Please see my comments in Issue #9.

  1. Description in first few cells
    Debating on whether all of this needs to be here (thinking of when this goes into the Jupyter Book)? I could put > some of this into Add getting started and installation instructions to the welcome page #12 perhaps?

Yeah, I was thinking about this, when adding this part at the beginning of tutorial 4. I like to see, that all JN or files share a consistent layout of the introduction cell and clearly state to what this JN or script belongs and for which version it should work. So, I feel it makes sense to add this part for all JN or files together within one PR. Do we plan to upload the final workshop to Zenodo? Then we can also add this as a new line later.

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ dependencies:
- jupyterlab=4.2.5
- pygmt=0.13.0
- python=3.12
# Xarray tutorial
- xarray=2024.10.0
- gcsfs=2024.10.0
- zarr=2.18.3
# Optional dependencies
- geopandas=1.0.1
- jupyter-book=1.0.2
# Optional dev dependencies
- pre-commit