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

Rename repo/package mom6_regional -> regional_mom6 #47

Merged
merged 12 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
src: "./mom6_regional ./tests"
src: "./regional_mom6 ./tests"

testing:
needs: formatting
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Test with pytest
run: |
if [[ "${{ matrix.python-version }}" == "3.10" ]]; then
python -m pytest --cov=mom6_regional --cov-report=xml tests/
python -m pytest --cov=regional_mom6 --cov-report=xml tests/
else
python -m pytest tests/
fi
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ __pycache__
.ipynb_checkpoints
build
_build
mom6_regional/_version.py
mom6_regional.egg-info
regional_mom6/_version.py
regional_mom6.egg-info
.pytest_cache
env
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Angus Gibson
Copyright (c) 2023 COSIMA

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# A regional domain generator for Modular Ocean Model 6
# regional_mom6: Python package for automatic generation of regional configurations for the Modular Ocean Model 6

[![codecov](https://codecov.io/gh/COSIMA/mom6-regional/branch/master/graph/badge.svg?token=7OEZ1UZRY4)](https://codecov.io/gh/COSIMA/mom6-regional) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![Documentation Status](https://readthedocs.org/projects/mom6-regional/badge/?version=latest)](https://mom6-regional.readthedocs.io/en/latest/?badge=latest)
[![codecov](https://codecov.io/gh/COSIMA/regional-mom6/branch/master/graph/badge.svg?token=7OEZ1UZRY4)](https://codecov.io/gh/COSIMA/regional-mom6) [![Documentation Status](https://readthedocs.org/projects/regional-mom6/badge/?version=latest)](https://regional-mom6.readthedocs.io/en/latest/?badge=latest) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

`mom6_regional` contains functions and classes that do most of the legwork in setting up a regional domain in MOM6.
Just provide it with some information about where, when and how big, and point it in the direction of your raw input files, and it'll sort out the boring details to create MOM6-friendly input files. Check out the [demo notebook](https://nbviewer.org/github/COSIMA/mom6-regional-scripts/blob/master/demo.ipynb)!
Just provide some information about where, when and how big, and also where raw input forcing files live. The package will sort out all the boring details to create MOM6-friendly input files.

### Python package
This repository is being converted into a python package that will be distributed via `pip` and `conda`. At the moment, there are still som legacy stuff -- hold on to your chairs as we clean up the repo and the pipelines for generating regional MOM6 configurations.
Check out the [demo notebook](https://nbviewer.org/github/COSIMA/regional-mom6/blob/main/demo.ipynb) and also the [documentation](https://readthedocs.org/projects/regional-mom6/badge/?version=latest)!
20 changes: 10 additions & 10 deletions demos/model-forced.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,10 @@
"import subprocess\n",
"from scipy.ndimage import binary_fill_holes\n",
"from importlib import reload\n",
"# os.chdir(\"/path/to/where/you/cloned/the/mom6-regional/repository\")\n",
"os.chdir(\"/home/149/ab8992/cosima_regional/mom6-regional-scripts/mom6_regional/\")\n",
"# os.chdir(\"/path/to/where/you/cloned/the/regional-mom6/repository\")\n",
"os.chdir(\"/home/149/ab8992/cosima_regional/regional-mom6/regional_mom6/\")\n",
"\n",
"import mom6_regional as ml\n",
"import regional_mom6 as rm\n",
"from dask.distributed import Client\n",
"client = Client()\n",
"client"
Expand Down Expand Up @@ -537,10 +537,10 @@
"yextent = [-48,-38.95] ## latitude\n",
"xextent = [143,150] ## longitude\n",
"\n",
"daterange = [\"1990-01-01 00:00:00\", \"1990-01-05 00:00:00\"] ## 2003 is a good compimise for GLORYs and JRA forcing as they overlap. JRA ends in 2012, GLORYS starts in 1993\n",
"daterange = [\"1990-01-01 00:00:00\", \"1990-01-05 00:00:00\"] ## 2003 is a good compromise for GLORYs and JRA forcing as they overlap. JRA ends in 2012, GLORYS starts in 1993\n",
"\n",
"## Place where all your input files go\n",
"inputdir = f\"{scratch}/mom6_regional_configs/{expt_name}/\"\n",
"inputdir = f\"{scratch}/regional_mom6_configs/{expt_name}/\"\n",
"\n",
"## Directory where you'll run the experiment from\n",
"rundir = f\"{home}/mom6_rundirs/{expt_name}/\"\n",
Expand Down Expand Up @@ -866,19 +866,19 @@
"ic = om2_input.isel(time = 0)\n",
"\n",
"## Nicer Slicer handles seams in longitude and different grids. Ensures that the output matches our 'xextent'\n",
"ic = ml.nicer_slicer(ic,[xextent[0],xextent[1]],[\"xu_ocean\",\"xt_ocean\"])\n",
"ic = rm.nicer_slicer(ic,[xextent[0],xextent[1]],[\"xu_ocean\",\"xt_ocean\"])\n",
"ic.to_netcdf(tmpdir + \"/ic_unprocessed\")\n",
"\n",
"## Cut out East and West segments. Does lat slice first then uses nicer slicer for lon slice\n",
"eastwest = om2_input.sel( \n",
" yu_ocean = slice(yextent[0] - 0.2,yextent[1] + 0.2),\n",
" yt_ocean = slice(yextent[0] - 0.2,yextent[1] + 0.2)\n",
")\n",
"ml.nicer_slicer(eastwest,[xextent[1],xextent[1]],[\"xu_ocean\",\"xt_ocean\"]).to_netcdf(tmpdir + \"/east_unprocessed\")\n",
"ml.nicer_slicer(eastwest,[xextent[0],xextent[0]],[\"xu_ocean\",\"xt_ocean\"]).to_netcdf(tmpdir + \"/west_unprocessed\")\n",
"rm.nicer_slicer(eastwest,[xextent[1],xextent[1]],[\"xu_ocean\",\"xt_ocean\"]).to_netcdf(tmpdir + \"/east_unprocessed\")\n",
"rm.nicer_slicer(eastwest,[xextent[0],xextent[0]],[\"xu_ocean\",\"xt_ocean\"]).to_netcdf(tmpdir + \"/west_unprocessed\")\n",
"\n",
"## Cut out North and South segments\n",
"northsouth = ml.nicer_slicer(om2_input,[xextent[0],xextent[1]],[\"xu_ocean\",\"xt_ocean\"])\n",
"northsouth = rm.nicer_slicer(om2_input,[xextent[0],xextent[1]],[\"xu_ocean\",\"xt_ocean\"])\n",
"northsouth.sel(\n",
" yu_ocean = slice(yextent[1] - 0.2,yextent[1] + 0.2),\n",
" yt_ocean = slice(yextent[1] - 0.2,yextent[1] + 0.2)\n",
Expand Down Expand Up @@ -935,7 +935,7 @@
],
"source": [
"reload(ml)\n",
"expt = ml.experiment(\n",
"expt = rm.experiment(\n",
" xextent,\n",
" yextent,\n",
" daterange,\n",
Expand Down
14 changes: 7 additions & 7 deletions demos/reanalysis-forced.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,10 @@
"import subprocess\n",
"from scipy.ndimage import binary_fill_holes\n",
"from importlib import reload\n",
"# os.chdir(\"/path/to/where/you/cloned/the/mom6-regional/repository\")\n",
"os.chdir(\"/home/149/ab8992/cosima_regional/mom6-regional-scripts/mom6_regional/\")\n",
"# os.chdir(\"/path/to/where/you/cloned/the/regional-mom6/repository\")\n",
"os.chdir(\"/home/149/ab8992/cosima_regional/regional-mom6/regional_mom6/\")\n",
"\n",
"import mom6_regional as ml\n",
"import regional_mom6 as rm\n",
"from dask.distributed import Client\n",
"client = Client()\n",
"client"
Expand Down Expand Up @@ -417,7 +417,7 @@
"daterange = [\"2003-01-01 00:00:00\", \"2003-01-05 00:00:00\"] ## 2003 is a good compimise for GLORYs and JRA forcing as they overlap. JRA ends in 2012, GLORYS starts in 1993\n",
"\n",
"## Place where all your input files go\n",
"inputdir = f\"{scratch}/mom6_regional_configs/{expt_name}/\"\n",
"inputdir = f\"{scratch}/regional_mom6_configs/{expt_name}/\"\n",
"\n",
"## Directory where you'll run the experiment from\n",
"rundir = f\"{home}/mom6_rundirs/{expt_name}/\"\n",
Expand Down Expand Up @@ -486,7 +486,7 @@
"usr = \"YOUR COPERNICUS USERNAME\" \n",
"file = open(f\"{tmpdir}/get_oceanfiles.sh\",\"w\")\n",
"file.write(\n",
" ml.motu_requests(xextent, yextent, daterange, tmpdir, usr, pwd,[\"north\",\"south\",\"east\",\"west\"])\n",
" rm.motu_requests(xextent, yextent, daterange, tmpdir, usr, pwd,[\"north\",\"south\",\"east\",\"west\"])\n",
")\n",
"file.close()\n",
"\n",
Expand Down Expand Up @@ -529,7 +529,7 @@
"outputs": [],
"source": [
"reload(ml)\n",
"expt = ml.experiment(\n",
"expt = rm.experiment(\n",
" xextent,\n",
" yextent,\n",
" daterange,\n",
Expand Down Expand Up @@ -837,7 +837,7 @@
"for fname , vname in zip([\"2t\",\"10u\",\"10v\",\"sp\",\"2d\"] , [\"t2m\",\"u10\",\"v10\",\"sp\",\"d2m\"]):\n",
"\n",
" ## Cut out this variable to our domain size\n",
" rawdata[fname] = ml.nicer_slicer(\n",
" rawdata[fname] = rm.nicer_slicer(\n",
" xr.open_mfdataset(f\"{erapath}/{fname}/{daterange[0].split('-')[0]}/{fname}*\",decode_times = False,chunks = {\"longitude\":100,\"latitude\":100}),\n",
" xextent,\n",
" \"longitude\"\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
API reference
===============

.. automodule:: mom6_regional.mom6_regional
.. automodule:: regional_mom6.regional_mom6
:members:
:undoc-members:
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "MOM6 Regional"
project = "Regional MOM6"
copyright = "2023, Ashley Barnes & COSIMA Contributors"
author = "Ashley Barnes & COSIMA Contributors"

Expand All @@ -23,6 +23,6 @@
html_theme = "sphinx_book_theme"
html_static_path = ["_static"]
html_theme_options = {
"repository_url": "https://github.com/COSIMA/mom6-regional",
"repository_url": "https://github.com/COSIMA/regional-mom6",
"use_repository_button": True,
}
2 changes: 1 addition & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Instructions for Contributors
=============================

Before you submit a [pull request](https://github.com/COSIMA/mom6-regional/pulls) it's always a
Before you submit a [pull request](https://github.com/COSIMA/regional-mom6/pulls) it's always a
good idea to run the tests locally and catch any potential bugs/errors that might have been
introduced. Also, sometimes it's also a good idea to build the documentation locally to see
how new docstrings or any new bits of documentation that you may have added look like.
Expand Down
7 changes: 5 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Welcome to MOM6 Regional's documentation!
=========================================
Regional MOM6 Documentation
===========================

``regional_mom6`` is a Python package for automatic generation of regional
configurations for the Modular Ocean Model 6

.. toctree::
:maxdepth: 2
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "mom6_regional"
name = "regional_mom6"
description = "Automatic generation of regional configurations for Modular Ocean Model 6"
keywords = ["mom6", "regional", "ocean modeling"]
authors = [
Expand All @@ -21,7 +21,7 @@ requires = ["setuptools", "setuptools_scm[toml]"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
packages = ["mom6_regional"]
packages = ["regional_mom6"]

[tool.setuptools_scm]
write_to = "mom6_regional/_version.py"
write_to = "regional_mom6/_version.py"
2 changes: 1 addition & 1 deletion mom6_regional/__init__.py → regional_mom6/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
except ImportError:
__version__ = "unknown"

from .mom6_regional import * # noqa
from .regional_mom6 import * # noqa
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/test_trivial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import numpy as np
from mom6_regional import angle_between
from regional_mom6 import angle_between


# placeholder trivial test test
Expand Down