Skip to content

Commit

Permalink
Revert "Add CITATION.cff file"
Browse files Browse the repository at this point in the history
This reverts commit 78864ce.
  • Loading branch information
ks905383 committed Oct 1, 2024
1 parent 842d061 commit da075aa
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 61 deletions.
13 changes: 0 additions & 13 deletions CITATION.cff

This file was deleted.

23 changes: 0 additions & 23 deletions tests/test_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,26 +140,3 @@ def test_pixel_overlaps_silent_false(mock_stdout):

# Check that nothing was printed
assert mock_stdout.getvalue() != ''

##### pixel_overlaps() CRS tests #####
def test_pixel_overlaps_altcrs():
# Test to make sure pixel_overlaps standardizes crs'es before
# calling `create_raster_polygons` and `get_pixel_overlaps`
ds = xr.Dataset({'test':(['lon','lat','time'],np.reshape(np.arange(1,28),(3,3,3))),
'lat_bnds':(['lat','bnds'],np.array([[-1.5,-0.5],[-0.5,0.5],[0.5,1.5]])),
'lon_bnds':(['lon','bnds'],np.array([[-1.5,-0.5],[-0.5,0.5],[0.5,1.5]]))},
coords={'lat':(['lat'],np.array([-1,0,1])),
'lon':(['lon'],np.array([-1,0,1])),
'bnds':(['bnds'],np.array([0,1])),
'time':(['time'],pd.date_range('2019-01-01','2019-01-03'))})


# Create polygon covering multiple pixels
gdf = {'name':['test'],
'geometry':[Polygon([(0,0),(0,1),(1,1),(1,0),(0,0)])]}
gdf = gpd.GeoDataFrame(gdf,crs="EPSG:4326")

try:
pix_agg = pixel_overlaps(ds,gdf.to_crs('EPSG:26916'))
except Exception as e:
pytest.fail(f"Exception raised: {e}")
2 changes: 0 additions & 2 deletions xagg/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,6 @@ def create_raster_polygons(ds,
# Subset by shapefile bounding box, if desired
if subset_bbox is not None:
if type(subset_bbox) == gpd.geodataframe.GeoDataFrame:
# Change to 4326 first, which is implicitly what ds is in
subset_bbox = subset_bbox.to_crs('EPSG:4326')
# Using the biggest difference in lat/lon to make sure that the pixels are subset
# in a way that the bounding box is fully filled out
# bbox_thresh = np.max([ds.lat.diff('lat').max(),ds.lon.diff('lon').max()])+0.1
Expand Down
23 changes: 0 additions & 23 deletions xagg/wrappers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import warnings
import xarray as xr
import numpy as np
import copy

from . core import (create_raster_polygons,get_pixel_overlaps)
Expand Down Expand Up @@ -76,24 +75,6 @@ def pixel_overlaps(ds,gdf_in,
# get modified
gdf_in = copy.deepcopy(gdf_in)

# Choose a common crs for both, just to minimize the chance
# of geographic shenanigans
# (using the EASE grid https://nsidc.org/data/ease)
if np.all(gdf_in.total_bounds[[1,3]]>0):
# If min/max lat are both in NH, use North grid
#epsg_set = {'init':'EPSG:6931'} (change to below bc of depreciation of {'init':...} format in geopandas)
epsg_set = 'EPSG:6931'
elif np.all(gdf_in.total_bounds[[1,3]]<0):
# If min/max lat are both in SH, use South grid
#epsg_set = {'init':'EPSG:6932'}
epsg_set = 'EPSG:6932'
else:
# Otherwise, use the global/temperate grid
#epsg_set = {'init':'EPSG:6933'}
epsg_set = 'EPSG:6933'
# Set CRS
gdf_in = gdf_in.to_crs(epsg_set)

# Turn into dataset if dataarray
if type(ds)==xr.core.dataarray.DataArray:
if ds.name is None:
Expand All @@ -111,10 +92,6 @@ def pixel_overlaps(ds,gdf_in,
warnings.warning('Bounding box around polygon(s) from `gdf_in` includes no grid cells in `ds`...')
else:
pix_agg = create_raster_polygons(ds,subset_bbox=None,weights=weights,silent=silent)


# Ensure pix_agg is also set to the default CRS
pix_agg['gdf_pixels'] = pix_agg['gdf_pixels'].to_crs(epsg_set)

# Get overlaps between these pixel polygons and the gdf_in polygons
if not silent:
Expand Down

0 comments on commit da075aa

Please sign in to comment.