Commit ef258b3d authored by PIOLLE's avatar PIOLLE
Browse files

Initial commit

parents
MIT licence
\ No newline at end of file
Welcome to this contrib for ocean model data.
Installation
============
Requires:
* cerbere
* zarr
Examples
========
MITgcm in Zarr format
---------------------
>>> from cerbere.dataset.mitgcmzarrdataset import MITGCMZarrDataset
>>> dst = MITGCMZarrDataset(
... '/home/datawork-lops-osi/equinox/mit4320/zarr/',
... face=10, parameters=['Eta', 'SST']
... )
>>> cube = GridTimeSeries(dst)
__import__('pkg_resources').declare_namespace(__name__)
__import__('pkg_resources').declare_namespace(__name__)
# -*- coding: utf-8 -*-
"""
Dataset class for MITgcm LL4320 files in zarr format
"""
import logging
from typing import List
import xarray as xr
from cerbere.dataset.dataset import Dataset, OpenMode
class MITGCMZarrDataset(Dataset):
"""Dataset class for MITgcm LL4320 files in zarr format"""
def _open_dataset(self,
face: int,
fields: List[str],
**kwargs) -> 'xr.Dataset':
"""
Args:
face: face number (corresponding to an area) to open
"""
if self._mode != OpenMode.READ_ONLY:
raise NotImplementedError
logging.debug("opening {} in mode : {}".format(self._url, self._mode))
grid = xr.open_zarr(self.url + 'grid.zarr').sel(face=face)
ds = xr.merge(
[xr.open_zarr(self.url + v + '.zarr').sel(face=face)
for v in fields],
join='inner')
ds = ds.assign_coords(**grid.variables)
# rename coordinates
self._std_dataset = self.ds.rename(
{'XC': 'lon', 'YC': 'lat'}
# Use official repository
-i https://pypi.python.org/simple/
-e .
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
long_desc = '''
This package contains the Cerbere extension for ocean models datasets.
'''
requires = [
'cerbere>=2.0.0',
'zarr'
]
setup(
name='cerberecontrib-oceanmodel',
version='1.0',
url='',
download_url='',
license='GPLv3',
authors='Jean-François Piollé',
author_email='jfpiolle@ifremer.fr',
description='Cerbere extension for ocean models',
long_description=long_desc,
zip_safe=False,
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: GPLv3 License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Documentation',
'Topic :: Utilities',
],
platforms='any',
packages=find_packages(),
include_package_data=True,
package_data = {'cerbere': ['utils/safes3/*.xml']},
install_requires=requires,
namespace_packages=['cerbere'],
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment