Skip to content

Commit

Permalink
note for jordan
Browse files Browse the repository at this point in the history
  • Loading branch information
mmann1123 committed Jul 19, 2024
1 parent 41a2e40 commit 5561072
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 22 deletions.
17 changes: 15 additions & 2 deletions src/geowombat/backends/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
from .dask_ import Cluster
from .xarray_ import concat, mosaic, transform_crs, warp_open
from .xarray_ import (
concat,
mosaic,
transform_crs,
warp_open,
_check_config_globals,
)

__all__ = ['Cluster', 'concat', 'mosaic', 'warp_open', 'transform_crs']
__all__ = [
"Cluster",
"concat",
"mosaic",
"warp_open",
"transform_crs",
"_check_config_globals",
]
57 changes: 37 additions & 20 deletions src/geowombat/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

from ..backends import concat as gw_concat
from ..backends import mosaic as gw_mosaic
from ..backends import warp_open
from ..backends import warp_open, _check_config_globals
from ..backends.rasterio_ import check_src_crs
from ..config import _set_defaults, config
from ..handler import add_handler
Expand Down Expand Up @@ -513,6 +513,18 @@ def __init__(
w = src.block_window(1, 0, 0)
kwargs["chunks"] = (band_chunks, w.height, w.width)

# kw = {
# "crs": None,
# "res": None,
# }

# kw = _check_config_globals(filename, "reference", kw)

# if all(value is not None for value in kw.values()):
# logger.exception(
# """ Changes to the reference image, CRS, or resolution are not allowed when opening multiple images.\nPlease write changes to disk before opening multiple images."""
# )

if mosaic:
# Mosaic images over space
self.data = gw_mosaic(
Expand Down Expand Up @@ -770,12 +782,12 @@ def load(
with open(
image_list[0],
time_names=time_names[0],
band_names=band_names
if not str(image_list[0]).endswith(".nc")
else None,
netcdf_vars=band_names
if str(image_list[0]).endswith(".nc")
else None,
band_names=(
band_names if not str(image_list[0]).endswith(".nc") else None
),
netcdf_vars=(
band_names if str(image_list[0]).endswith(".nc") else None
),
chunks=chunks,
) as src:
pass
Expand Down Expand Up @@ -1230,19 +1242,24 @@ def apply(
with pool(num_workers) as executor:
data_gen = (
(
w,
self.read(
bands, window=w[1], gain=gain, offset=offset
),
self.band_dict,
)
if self.padding
else (
w,
self.read(
bands, window=w, gain=gain, offset=offset
),
self.band_dict,
(
w,
self.read(
bands,
window=w[1],
gain=gain,
offset=offset,
),
self.band_dict,
)
if self.padding
else (
w,
self.read(
bands, window=w, gain=gain, offset=offset
),
self.band_dict,
)
)
for w in self.windows_
)
Expand Down

0 comments on commit 5561072

Please sign in to comment.