Skip to content

Commit

Permalink
Merge branch 'UXARRAY:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
hongyuchen1030 authored Feb 13, 2024
2 parents 7738774 + a756811 commit e5aab20
Show file tree
Hide file tree
Showing 68 changed files with 5,425 additions and 2,516 deletions.
24 changes: 20 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,41 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest", "windows-latest"]
os: [ "ubuntu-latest", "macos-latest", "macos-14", "windows-latest"]
python-version: [ "3.9", "3.10", "3.11"]
steps:
- name: Cancel previous runs
uses: styfle/[email protected].0
uses: styfle/[email protected].1
with:
access_token: ${{ github.token }}

- name: checkout
uses: actions/checkout@v4
with:
token: ${{ github.token }}
- name: conda_setup

- name: conda_setup (x64)
uses: conda-incubator/setup-miniconda@v3
if: matrix.os != 'macos-14'
with:
activate-environment: uxarray_build
channel-priority: strict
python-version: ${{ matrix.python-version }}
channels: conda-forge
environment-file: ci/environment.yml
miniforge-variant: Mambaforge
miniforge-version: latest

- name: conda_setup (ARM64)
uses: conda-incubator/setup-miniconda@v3
if: matrix.os == 'macos-14'
with:
activate-environment: uxarray_build
channel-priority: strict
python-version: ${{ matrix.python-version }}
channels: conda-forge
environment-file: ci/environment.yml
installer-url: https://github.com/conda-forge/miniforge/releases/download/23.11.0-0/Mambaforge-23.11.0-0-MacOSX-arm64.sh

- name: Install uxarray
run: |
Expand All @@ -55,7 +71,7 @@ jobs:
python -m pytest test -v --cov=./uxarray --cov-report=xml
- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v3.1.4
uses: codecov/codecov-action@v4.0.1
with:
file: ./coverage.xml
flags: unittests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
- uses: pre-commit/[email protected].0
- uses: pre-commit/[email protected].1
19 changes: 13 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
repos:
- repo: https://github.com/pre-commit/mirrors-yapf # To format the code to conform YAPF
rev: v0.31.0
hooks:
- id: yapf
args: ['--in-place', '--recursive', '--style', 'google']

- repo: https://github.com/myint/docformatter # To format the doc strings to conform PEP257
rev: v1.4
hooks:
Expand All @@ -20,3 +14,16 @@ repos:
- id: end-of-file-fixer # Makes sure files end with a newline.
- id: trailing-whitespace # Checks for any tabs or spaces after the last non-whitespace character on the line.
- id: check-docstring-first # Checks that code comes after the docstrings.

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.5
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
exclude: ".test"

# Run the formatter.
- id: ruff-format
exclude: ".test"
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@



<img src='https://raw.githubusercontent.com/UXARRAY/uxarray/a2d893cf597dd1a6e775f9dad029c662c64a39c7/docs/_static/images/logos/uxarray_logo_quad_tri.svg' width='400'>
[comment]: <> (<img src='https://raw.githubusercontent.com/UXARRAY/uxarray/a2d893cf597dd1a6e775f9dad029c662c64a39c7/docs/_static/images/logos/uxarray_logo_quad_tri.svg' width='400'>)

---



Expand All @@ -20,8 +19,8 @@ UXarray aims to address the geoscience community's need for tools that enable
standard data analysis techniques to operate directly on unstructured grid
data. UXarray provides Xarray-styled functionality to better read in and use
unstructured grid datasets that follow standard conventions, including UGRID,
MPAS, SCRIP, and Exodus formats. This effort is a result of the
collaboration between Project Raijin (NCAR and Pennsylvania State University)
MPAS, SCRIP, ESMF, and Exodus grid formats. This effort is a result of the
collaboration between Project Raijin (NSF NCAR and Pennsylvania State University)
and the SEATS Project (Argonne National Laboratory, UC Davis, and Lawrence
Livermore National Laboratory). The UXarray team welcomes community
members to become part of this collaboration at any level of contribution.
Expand Down Expand Up @@ -51,7 +50,7 @@ is receptive to additional functionality requests.

## Intended Functionality for Grids

* Support for reading and writing UGRID, SCRIP and Exodus formatted grids.
* Support for reading and writing UGRID, SCRIP ESMF, and Exodus formatted grids.
* Support for reading and writing shapefiles.
* Support for arbitrary structured and unstructured grids on the sphere,
including latitude-longitude grids, grids with only partial coverage of
Expand Down
3 changes: 2 additions & 1 deletion ci/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies:
- jupyter_client
- scikit-learn
- sphinx-book-theme
- sphinx-autosummary-accessors
- myst-nb
- sphinx-design
- nbsphinx
Expand All @@ -30,7 +31,7 @@ dependencies:
- cartopy
- pandas<2.1.0
- geocat-datafiles
- spatialpandas
- pip:
- antimeridian
- pyfma
- git+https://github.com/holoviz/spatialpandas.git
2 changes: 1 addition & 1 deletion ci/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ dependencies:
- scikit-learn
- scipy
- shapely
- spatialpandas
- xarray
- pip:
- antimeridian
- pyfma
- git+https://github.com/holoviz/spatialpandas.git
2 changes: 1 addition & 1 deletion ci/install-upstream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ conda remove -y --force \
shapely \
xarray

python -m pip uninstall \
pip uninstall -y \
antimeridian \
spatialpandas

Expand Down
113 changes: 49 additions & 64 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@
import pathlib
import yaml
from sphinx.application import Sphinx
import sphinx_autosummary_accessors
from sphinx.util import logging
from textwrap import dedent, indent

sys.path.insert(0,
os.path.abspath('../')) # Source code dir relative to this file
import datetime

import uxarray
import matplotlib.pyplot

__all__ = (uxarray, matplotlib.pyplot)

sys.path.insert(0, os.path.abspath("../")) # Source code dir relative to this file

LOGGER = logging.getLogger("conf")

Expand All @@ -25,11 +29,8 @@
except ImportError:
from mock import Mock as MagicMock

import matplotlib.pyplot


class Mock(MagicMock):

@classmethod
def __getattr__(cls, name):
return MagicMock()
Expand All @@ -44,48 +45,34 @@ def __getattr__(cls, name):
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx.ext.mathjax',
'myst_nb',
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"sphinx.ext.mathjax",
"sphinx_autosummary_accessors",
"myst_nb",
"sphinx_design",
"nbsphinx",
]

mathjax_config = {
'tex2jax': {
'inlineMath': [['$', '$'], ['\\(', '\\)']],
'displayMath': [['$$', '$$'], ['\\[', '\\]']],
'processEscapes': True,
},
'HTML-CSS': {
'linebreaks': {
'automatic': True,
'width': 'container'
},
'fonts': {
'availableFonts': ['TeX'],
'preferredFont': 'TeX',
'webFont': 'TeX'
}
"tex2jax": {
"inlineMath": [["$", "$"], ["\\(", "\\)"]],
"displayMath": [["$$", "$$"], ["\\[", "\\]"]],
"processEscapes": True,
},
'CommonHTML': {
'linebreaks': {
'automatic': True,
'width': 'container'
}
"HTML-CSS": {
"linebreaks": {"automatic": True, "width": "container"},
"fonts": {"availableFonts": ["TeX"], "preferredFont": "TeX", "webFont": "TeX"},
},
'SVG': {
'linebreaks': {
'automatic': True,
'width': 'container'
}
}
"CommonHTML": {"linebreaks": {"automatic": True, "width": "container"}},
"SVG": {"linebreaks": {"automatic": True, "width": "container"}},
}

mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
mathjax_path = (
"https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
)

extlinks = {
"issue": ("https://github.com/uxarray/uxarray/issues/%s", "GH"),
Expand All @@ -104,7 +91,7 @@ def __getattr__(cls, name):
"cftime": ("https://unidata.github.io/cftime", None),
"rasterio": ("https://rasterio.readthedocs.io/en/latest", None),
"sparse": ("https://sparse.pydata.org/en/latest/", None),
'xarray': ('http://xarray.pydata.org/en/stable/', None),
"xarray": ("http://xarray.pydata.org/en/stable/", None),
}

napoleon_use_admonition_for_examples = True
Expand All @@ -113,36 +100,34 @@ def __getattr__(cls, name):
autosummary_generate = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates", sphinx_autosummary_accessors.templates_path]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = {
'.rst': 'restructuredtext',
'.ipynb': 'myst-nb',
'.myst': 'myst-nb',
".rst": "restructuredtext",
".ipynb": "myst-nb",
".myst": "myst-nb",
}

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = u'uxarray'

import datetime
project = "uxarray"

current_year = datetime.datetime.now().year
copyright = u'{}, Uxarray'.format(current_year)
author = u'UXARRAY'
copyright = "{}, Uxarray".format(current_year)
author = "UXARRAY"


# The version info for the project being documented
def read_version():
for line in open('../meta.yaml').readlines():
index = line.find('set version')
for line in open("../meta.yaml").readlines():
index = line.find("set version")
if index > -1:
return line[index + 15:].replace('\" %}', '').strip()
return line[index + 15 :].replace('" %}', "").strip()


# The short X.Y version.
Expand All @@ -163,7 +148,7 @@ def read_version():
exclude_patterns = []

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
Expand Down Expand Up @@ -199,7 +184,7 @@ def read_version():
use_issues_button=True,
home_page_in_toc=False,
navbar_footer_text="",
#extra_footer="""<p></p>""",
# extra_footer="""<p></p>""",
)

# The name for this set of Sphinx documents.
Expand All @@ -208,23 +193,23 @@ def read_version():

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
html_logo = '_static/images/logos/uxarray_temp_logo.png'
html_logo = "_static/images/logos/uxarray_temp_logo.png"

# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
html_favicon = '_static/images/logos/uxarray_temp_logo.png'
html_favicon = "_static/images/logos/uxarray_temp_logo.png"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]
html_css_files = ["style.css"]

# Output file base name for HTML help builder.
htmlhelp_basename = 'uxarraydoc'
htmlhelp_basename = "uxarraydoc"

autodoc_typehints = 'none'
autodoc_typehints = "none"


# custom scripts for making a gallery of examples notebooks
Expand All @@ -233,8 +218,7 @@ def update_gallery(app: Sphinx):

LOGGER.info("creating gallery...")

notebooks = yaml.safe_load(
pathlib.Path(app.srcdir, "gallery.yml").read_bytes())
notebooks = yaml.safe_load(pathlib.Path(app.srcdir, "gallery.yml").read_bytes())

items = [
f"""
Expand All @@ -246,7 +230,8 @@ def update_gallery(app: Sphinx):
:alt: {item['title']}
+++
{item['title']}
""" for item in notebooks
"""
for item in notebooks
]

items_md = indent(dedent("\n".join(items)), prefix=" ")
Expand All @@ -264,5 +249,5 @@ def update_gallery(app: Sphinx):

# Allow for changes to be made to the css in the theme_overrides file
def setup(app):
app.add_css_file('theme_overrides.css')
app.add_css_file("theme_overrides.css")
app.connect("builder-inited", update_gallery)
6 changes: 3 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
:description: Uxarray Python module
:keywords: weather research and forecasting,
model, weather, numerical weather prediction, model,
matplotlib, cartopy, ncar, ucar, cisl, UC Davis, SEATs, ugrid,
national center for atmospheric research,
university corporation for atmospheric research
matplotlib, cartopy, nsf ncar, ucar, cisl, UC Davis, SEATS, ugrid,
nsf national center for atmospheric research, university
corporation for atmospheric research


.. .. image:: _static/images/nsf.png
Expand Down
Loading

0 comments on commit e5aab20

Please sign in to comment.