-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from xylar/move_repo
Move repo from xylar/pyremap to MPAS-Dev
- Loading branch information
Showing
45 changed files
with
3,026 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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,88 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# IPython Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# dotenv | ||
.env | ||
|
||
# virtualenv | ||
venv/ | ||
ENV/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
.DS_Store |
This file contains 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,2 @@ | ||
pycodestyle: | ||
max-line-length: 80 |
This file contains 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,74 @@ | ||
This software is open source software available under the BSD-3 license. | ||
|
||
Copyright (c) 2019 Triad National Security, LLC. All rights reserved. | ||
Copyright (c) 2019 Lawrence Livermore National Security, LLC. All rights reserved. | ||
Copyright (c) 2019 UT-Battelle, LLC. All rights reserved. | ||
|
||
|
||
Copyright (c) 2019 Triad National Security, LLC. This program was produced | ||
under U.S. Government contract 89233218CNA000001 for Los Alamos National | ||
Laboratory (LANL), which is operated by Triad National Security, LLC for the | ||
U.S. Department of Energy/National Nuclear Security Administration. All rights | ||
in the program are reserved by Triad National Security, LLC, and the U.S. | ||
Department of Energy/National Nuclear Security Administration. The Government | ||
is granted for itself and others acting on its behalf a nonexclusive, paid-up, | ||
irrevocable worldwide license in this material to reproduce, prepare derivative | ||
works, distribute copies to the public, perform publicly and display publicly, | ||
and to permit others to do so. | ||
|
||
Copyright (c) 2019 Lawrence Livermore National Security, LLC. This work was | ||
produced under the auspices of the U.S. Department of Energy by Lawrence | ||
Livermore National Laboratory under Contract DE-AC52-07NA27344. This work was | ||
prepared as an account of work sponsored by an agency of the United States | ||
Government. Neither the United States Government nor Lawrence Livermore | ||
National Security, LLC, nor any of their employees makes any warranty, | ||
expressed or implied, or assumes any legal liability or responsibility for the | ||
accuracy, completeness, or usefulness of any information, apparatus, product, | ||
or process disclosed, or represents that its use would not infringe privately | ||
owned rights. Reference herein to any specific commercial product, process, or | ||
service by trade name, trademark, manufacturer, or otherwise does not | ||
necessarily constitute or imply its endorsement, recommendation, or favoring by | ||
the United States Government or Lawrence Livermore National Security, LLC. The | ||
views and opinions of authors expressed herein do not necessarily state or | ||
reflect those of the United States Government or Lawrence Livermore National | ||
Security, LLC, and shall not be used for advertising or product endorsement | ||
purposes. | ||
|
||
Copyright 2019 UT-Battelle. LLC. This technology acquired under license from | ||
UT-Battelle, LLC, the management and operating contractor of the Oak Ridge | ||
National Laboratory acting on behalf of the U.S. Department of Energy under | ||
Contract No. DE-AC05-00OR22725. The United States Government and UT-Battelle, | ||
LLC make no representations and disclaim all warranties, both expressed and | ||
implied. There are no express or implied warranties of merchantability or | ||
fitness for a particular purpose, or that the use of the software will not | ||
infringe any patent, copyright, trademark, or other proprietary rights, or that | ||
the software will accomplish the intended results or that the software or its | ||
use will not result in injury or damage. The user assumes responsibility for | ||
all liabilities, penalties, fines, claims, causes of action, and costs and | ||
expenses, caused by, resulting from or arising out of, in whole or in part the | ||
use, storage or disposal of the software. | ||
|
||
Additionally, redistribution and use in source and binary forms, with or | ||
without modification, are permitted provided that the following conditions are | ||
met: | ||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
* Neither the name of Los Alamos National Security, LLC, Los Alamos National | ||
Laboratory, LANL, the U.S. Government, nor the names of its contributors may | ||
be used to endorse or promote products derived from this software without | ||
specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR | ||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT | ||
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY | ||
OF SUCH DAMAGE. |
This file contains 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 |
---|---|---|
@@ -1 +1,83 @@ | ||
# pyremap | ||
# pyremap | ||
[![Documentation Status](http://readthedocs.org/projects/pyremap/badge/?version=latest)](http://pyremap.readthedocs.io/en/latest/?badge=latest) | ||
|
||
Python remapping tools for climate and earth system models. | ||
|
||
## Documentation | ||
|
||
[http://pyremap.readthedocs.io](http://pyremap.readthedocs.io) | ||
|
||
## Installation | ||
|
||
To use the latest version for developers, you will need to set up a conda | ||
environment with the following packages: | ||
|
||
* python >= 3.6 | ||
* numpy | ||
* scipy | ||
* netcdf4 | ||
* xarray >= 0.10.0 | ||
* dask | ||
* nco >= 4.8.1 | ||
* pyproj | ||
|
||
These can be installed via the conda command: | ||
``` | ||
conda config --add channels conda-forge | ||
conda config --set channel_priority strict | ||
conda create -n pyremap python=3.7 numpy scipy netcdf4 "xarray>=0.10.0" dask \ | ||
"nco>=4.8.1" pyproj | ||
conda activate pyremap | ||
``` | ||
|
||
Then, get the code from: | ||
[https://github.com/xylar/pyremap](https://github.com/xylar/pyremap) | ||
|
||
|
||
## Examples | ||
|
||
``` | ||
cd examples | ||
``` | ||
The simplest way to make pyremap available is: | ||
``` | ||
ln -s ../pyremap | ||
``` | ||
First, make mapping files for a lat-lon grid, and test it out by remapping | ||
temperature from the example file: | ||
``` | ||
wget https://web.lcrc.anl.gov/public/e3sm/inputdata/ocn/mpas-o/oQU240/ocean.QU.240km.151209.nc | ||
./make_mpas_to_lat_lon_mapping.py | ||
``` | ||
You should now see the mapping file: | ||
``` | ||
map_oQU240_to_0.5x0.5degree.nc | ||
``` | ||
as well as the input file (an initial condition for the MPAS-Ocean model) and | ||
an example of temperature from the initial condition remapped to the new grid. | ||
``` | ||
ocean.QU.240km.151209.nc | ||
temp_0.5x0.5degree.nc | ||
``` | ||
|
||
Second, let's try the same but to an Antarctic stereographic grid: | ||
``` | ||
./make_mpas_to_Antarctic_stereo_mapping.py | ||
``` | ||
Now, there's a new mapping file and example output file: | ||
``` | ||
map_oQU240_to_6000.0x6000.0km_10.0km_Antarctic_stereo.nc | ||
temp_6000.0x6000.0km_10.0km_Antarctic_stereo.nc | ||
``` | ||
|
||
Finally, let's remap the temperature on the Antarctic grid to a lower | ||
resolution Antarctic grid: | ||
``` | ||
./remap_stereographic.py -i temp_6000.0x6000.0km_10.0km_Antarctic_stereo.nc \ | ||
-o temp_6000.0x6000.0km_20.0km_Antarctic_stereo.nc -r 20 | ||
``` | ||
This created another mapping file and an output file: | ||
``` | ||
map_6000x6000km_10km_Antarctic_stereo_to_6000x6000km_20.0km_Antarctic_stereo.nc | ||
temp_6000.0x6000.0km_20.0km_Antarctic_stereo.nc | ||
``` |
This file contains 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,24 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line. | ||
SPHINXOPTS = | ||
SPHINXBUILD = sphinx-build | ||
SPHINXPROJ = pyremap | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
clean: | ||
rm -rf generated | ||
@$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains 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,47 @@ | ||
############# | ||
API reference | ||
############# | ||
|
||
This page provides an auto-generated summary of the pyremap API. | ||
|
||
Mesh Descriptors | ||
================ | ||
|
||
.. currentmodule:: pyremap.descriptor | ||
|
||
.. autosummary:: | ||
:toctree: generated/ | ||
|
||
get_lat_lon_descriptor | ||
MpasMeshDescriptor | ||
LatLonGridDescriptor | ||
LatLon2DGridDescriptor | ||
ProjectionGridDescriptor | ||
PointCollectionDescriptor | ||
|
||
Remapping | ||
========= | ||
|
||
.. currentmodule:: pyremap.remapper | ||
|
||
.. autosummary:: | ||
:toctree: generated/ | ||
|
||
Remapper | ||
|
||
|
||
Polar projections | ||
================= | ||
|
||
.. currentmodule:: pyremap.polar | ||
|
||
.. autosummary:: | ||
:toctree: generated/ | ||
|
||
get_arctic_stereographic_projection | ||
get_antarctic_stereographic_projection | ||
get_polar_descriptor_from_file | ||
get_polar_descriptor | ||
to_polar | ||
from_polar | ||
|
Oops, something went wrong.