Skip to content

Commit

Permalink
gh-actions/python format using ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
nkarasiak authored and github-actions[bot] committed Nov 21, 2023
1 parent 313812b commit 3eabe4e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions earthdaily/earthdatastore/cube_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import rioxarray as rxr
import xarray as xr


def _match_xy_dims(src, dst, resampling=Resampling.nearest):
if src.dims != dst.dims:
src = src.rio.reproject_match(dst, resampling=resampling)
Expand Down Expand Up @@ -156,7 +157,7 @@ def datacube(
intersects = _bbox_to_intersects(bbox)
if intersects is not None:
intersects = GeometryManager(intersects).to_geopandas()

if isinstance(intersects, gpd.GeoDataFrame):
# itrscts = intersects.to_crs(ds.rio.crs).iloc[[0]]
# optimize by perclipping using bbox
Expand All @@ -180,7 +181,11 @@ def datacube(


def rescale_assets_with_items(
items_collection, ds, assets=None, boa_offset_applied_control=True, boa_offset_applied_force_by_date=True,
items_collection,
ds,
assets=None,
boa_offset_applied_control=True,
boa_offset_applied_force_by_date=True,
):
logging.info("rescale dataset")
scales = dict()
Expand Down Expand Up @@ -212,15 +217,14 @@ def rescale_assets_with_items(
current_item.collection_id == "sentinel-2-l2a"
and boa_offset_applied_control
):

boa_offset_applied = items_collection[idx].properties.get(
"earthsearch:boa_offset_applied", False
)
if boa_offset_applied_force_by_date:
yyyymmdd = np.datetime_as_string(time)[:10].replace('-','')
if yyyymmdd >= '20220228':
yyyymmdd = np.datetime_as_string(time)[:10].replace("-", "")
if yyyymmdd >= "20220228":
boa_offset_applied = True

if assets is None:
assets = list(ds.data_vars.keys())
for ds_asset in assets:
Expand Down

0 comments on commit 3eabe4e

Please sign in to comment.