Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add in main updates #74

Merged
merged 4 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ Installation
The easiest and recommended way to install :py:mod:`xagg` is through ``conda`` or ``mamba``::

# Mamba
mamba install -c conda-forge xagg==0.3.2.0
mamba install -c conda-forge xagg==0.3.2.1

# Conda
conda install -c conda-forge xagg==0.3.2.0
conda install -c conda-forge xagg==0.3.2.1


``xagg`` can also be installed through ``pip``::
Expand Down
9 changes: 4 additions & 5 deletions tests/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,10 @@ def test_to_netcdf(agg=agg):
coords = {'poly_idx':(('poly_idx'),[0]),
'run':(('run'),[0,1])})

# Load
ds_out = xr.open_dataset('test.nc')

# Test
xr.testing.assert_allclose(ds_ref,ds_out)
# Load and Test
with xr.open_dataset('test.nc') as ds_out:
xr.testing.assert_allclose(ds_ref,ds_out)

finally:
# Remove test export file
os.remove('test.nc')
Expand Down
10 changes: 8 additions & 2 deletions xagg/diag.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,15 @@ def diag_fig(wm,poly_id,pix_overlap_info,
raise TypeError('If using list polygon ids, all list members must be integers corresponding to polygon idxs in `wm.agg`.')
poly_idx = poly_id

# Turn into dataset if dataarray
if type(pix_overlap_info)==xr.core.dataarray.DataArray:
if pix_overlap_info.name is None:
pix_overlap_info = pix_overlap_info.to_dataset(name='var')
else:
pix_overlap_info = pix_overlap_info.to_dataset()

# Get pixel polygons/overlaps, if necessary
if ((type(pix_overlap_info) == xr.core.dataset.Dataset)
or (type(pix_overlap_info) == xr.core.dataarray.DataArray)):
if ((type(pix_overlap_info) == xr.core.dataset.Dataset):
pix_polys = create_raster_polygons(pix_overlap_info)
else:
pix_polys = pix_overlap_info
Expand Down
Loading