From 7d7cf6815be96ab6635fe502b3620c5de0516239 Mon Sep 17 00:00:00 2001 From: Andreas Hilboll Date: Wed, 13 Sep 2017 23:17:38 +0200 Subject: [PATCH] MAINT: model WPS data as coordinate-less DataArray fixes #35 --- docs/install.rst | 13 +++++++++++++ emiprep/regrid/cdo.py | 16 +++++----------- setup.py | 2 +- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/docs/install.rst b/docs/install.rst index 52d8688..555cd3a 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -2,6 +2,19 @@ Installing emiprep ================== +Required dependencies +--------------------- + +* Python 2.7, 3.4, 3.5, or 3.6 +* `numpy `__ (1.7 or later) +* `pandas `__ (0.15.0 or later) +* `xarray `__ (0.9.0 or later) +* `netcdf4-python `__ (1.2.1 or later) + + +Instructions +------------ + The recommended way to install emiprep is using the Anaconda_ platform. If you don't have Anaconda installed on your system yet, you can use the minimal miniconda_ installation. diff --git a/emiprep/regrid/cdo.py b/emiprep/regrid/cdo.py index f8cd637..e0997d9 100644 --- a/emiprep/regrid/cdo.py +++ b/emiprep/regrid/cdo.py @@ -65,17 +65,13 @@ def _metgrid_to_cdo_grid_info_extraction(fn_metgrid): lat_corner = xr.DataArray( np.zeros((lat_center.shape[0], lat_center.shape[1], 4), dtype=np.float32), - {'grid_ysize': lat_center['grid_ysize'], - 'grid_xsize': lat_center['grid_xsize'], - 'grid_corners': np.arange(1, 5)}, - ['grid_ysize', 'grid_xsize', 'grid_corners'], name='grid_corner_lat') + dims=['grid_ysize', 'grid_xsize', 'grid_corners'], + name='grid_corner_lat') lon_corner = xr.DataArray( np.zeros((lat_center.shape[0], lat_center.shape[1], 4), dtype=np.float32), - {'grid_ysize': lat_center['grid_ysize'], - 'grid_xsize': lat_center['grid_xsize'], - 'grid_corners': np.arange(1, 5)}, - ['grid_ysize', 'grid_xsize', 'grid_corners'], name='grid_corner_lon') + dims=['grid_ysize', 'grid_xsize', 'grid_corners'], + name='grid_corner_lon') for ii, jj in product(range(lat_center.shape[0]), range(lat_center.shape[1])): @@ -87,9 +83,7 @@ def _metgrid_to_cdo_grid_info_extraction(fn_metgrid): # need to include data variable in nc file, else CDO will complain dummy = xr.DataArray( np.zeros((lat_center.shape[0], lat_center.shape[1]), dtype=np.float32), - {'grid_ysize': lat_center['grid_ysize'], - 'grid_xsize': lat_center['grid_xsize']}, - ['grid_ysize', 'grid_xsize'], name='dummydata') + dims=['grid_ysize', 'grid_xsize'], name='dummydata') dummy.attrs['coordinates'] = 'grid_center_lon grid_center_lat' # fix metadata diff --git a/setup.py b/setup.py index 363cd8f..6ac347c 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ def _check_requirements(): try: import xarray except ImportError: - requirements += ['xarray>=0.8'] + requirements += ['xarray>=0.9'] try: import netCDF4