Skip to content

Commit

Permalink
Merge branch 'gl35_coordinateless' into 'develop'
Browse files Browse the repository at this point in the history
MAINT: model WPS data as coordinate-less DataArray

Closes #35

See merge request !35
  • Loading branch information
andreas-h committed Sep 13, 2017
2 parents ba6e8a1 + 7d7cf68 commit f1ced46
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
13 changes: 13 additions & 0 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
Installing emiprep
==================

Required dependencies
---------------------

* Python 2.7, 3.4, 3.5, or 3.6
* `numpy <http://www.numpy.org/>`__ (1.7 or later)
* `pandas <http://pandas.pydata.org/>`__ (0.15.0 or later)
* `xarray <http://xarray.pydata.org/>`__ (0.9.0 or later)
* `netcdf4-python <https://unidata.github.io/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.
Expand Down
16 changes: 5 additions & 11 deletions emiprep/regrid/cdo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])):
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _check_requirements():
try:
import xarray
except ImportError:
requirements += ['xarray>=0.8']
requirements += ['xarray>=0.9']

try:
import netCDF4
Expand Down

0 comments on commit f1ced46

Please sign in to comment.