https://github.com/mitgcm/xmitgcm
Read MITgcm mds binary files into xarray
https://github.com/mitgcm/xmitgcm
dask ocean-modelling oceanography xarray
Last synced: 3 months ago
JSON representation
Read MITgcm mds binary files into xarray
- Host: GitHub
- URL: https://github.com/mitgcm/xmitgcm
- Owner: MITgcm
- License: mit
- Created: 2016-10-12T01:22:04.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-08-08T08:53:54.000Z (5 months ago)
- Last Synced: 2025-10-21T20:48:52.150Z (3 months ago)
- Topics: dask, ocean-modelling, oceanography, xarray
- Language: Python
- Homepage: http://xmitgcm.readthedocs.io
- Size: 117 MB
- Stars: 66
- Watchers: 15
- Forks: 68
- Open Issues: 92
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
xmitgcm: Read MITgcm mds binary files into xarray
=================================================
|pypi| |Build Status| |codecov| |docs| |DOI|
xmitgcm is a python package for reading MITgcm_ binary MDS files into
xarray_ data structures. By storing data in dask_ arrays, xmitgcm enables
parallel, out-of-core_ analysis of MITgcm output data.
Links
-----
- HTML documentation: https://xmitgcm.readthedocs.org
- Issue tracker: https://github.com/MITgcm/xmitgcm/issues
- Source code: https://github.com/MITgcm/xmitgcm
Installation
------------
Requirements
^^^^^^^^^^^^
xmitgcm is compatible with python >=3.7. It requires xarray_
(>= version 0.14.1) and dask_ (>= version 1.0).
These packages are most reliably installed via the
`conda `_ environment management
system, which is part of the Anaconda_ python distribution. Assuming you have
conda available on your system, the dependencies can be installed with the
command::
conda install xarray dask
If you are using earlier versions of these packages, you should update before
installing xmitgcm.
Installation via pip
^^^^^^^^^^^^^^^^^^^^
If you just want to use xmitgcm, the easiest way is to install via pip::
pip install xmitgcm
This will automatically install the latest release from
`pypi `_.
Installation from github
^^^^^^^^^^^^^^^^^^^^^^^^
xmitgcm is under active development. To obtain the latest development version,
you may clone the `source repository `_
and install it::
git clone https://github.com/MITgcm/xmitgcm.git
cd xmitgcm
python setup.py install
Users are encouraged to `fork `_
xmitgcm and submit issues_ and `pull requests`_.
Quick Start
-----------
First make sure you understand what an xarray_ Dataset object is. Then find
some MITgcm MDS data. If you don't have any data of your own, you can download
the xmitgcm
`test repositories `_
To download the some test data, run the shell commands::
$ curl -L -J -O https://ndownloader.figshare.com/files/6494718
$ tar -xvzf global_oce_latlon.tar.gz
This will create a directory called ``global_oce_latlon`` which we will use
for the rest of these examples. If you have your own data, replace this with
the path to your mitgcm files.
To open MITgcm MDS data as an xarray.Dataset, do the following in python::
from xmitgcm import open_mdsdataset
data_dir = './global_oce_latlon'
ds = open_mdsdataset(data_dir)
``data_dir``, should be the path (absolute or relative) to an
MITgcm run directory. xmitgcm will automatically scan this directory and
try to determine the file prefixes and iteration numbers to read. In some
configurations, the ``open_mdsdataset`` function may work without further
keyword arguments. In most cases, you will have to specify further details.
Consult the `online documentation `_ for
more details.
.. |DOI| image:: https://zenodo.org/badge/70649781.svg
:target: https://zenodo.org/badge/latestdoi/70649781
.. |Build Status| image:: https://travis-ci.org/MITgcm/xmitgcm.svg?branch=master
:target: https://travis-ci.org/MITgcm/xmitgcm
:alt: travis-ci build status
.. |codecov| image:: https://codecov.io/github/MITgcm/xmitgcm/coverage.svg?branch=master
:target: https://codecov.io/github/MITgcm/xmitgcm?branch=master
:alt: code coverage
.. |pypi| image:: https://badge.fury.io/py/xmitgcm.svg
:target: https://badge.fury.io/py/xmitgcm
:alt: pypi package
.. |docs| image:: https://readthedocs.org/projects/xmitgcm/badge/?version=stable
:target: https://xmitgcm.readthedocs.org/en/stable/?badge=stable
:alt: documentation status
.. _dask: https://dask.pydata.org
.. _xarray: https://xarray.pydata.org
.. _Comodo: https://pycomodo.forge.imag.fr/norm.html
.. _issues: https://github.com/MITgcm/xmitgcm/issues
.. _`pull requests`: https://github.com/MITgcm/xmitgcm/pulls
.. _MITgcm: http://mitgcm.org/public/r2_manual/latest/online_documents/node277.html
.. _out-of-core: https://en.wikipedia.org/wiki/Out-of-core_algorithm
.. _Anaconda: https://www.continuum.io/downloads