added tiff filetype to OPENER_MAP in xarray_zarr.py
MODIFY
.pre-commit-config.yaml
.pre-commit-config.yaml
@@ -12,7 +12,7 @@ repos:
args: ["--autofix", "--indent=2", "--no-sort-keys"]
- repo: https://github.com/ambv/black
- rev: 22.3.0
+ rev: 19.10b0
hooks:
- id: black
args: ["--line-length", "100"]
@@ -26,20 +26,17 @@ repos:
rev: v2.2.0
hooks:
- id: seed-isort-config
-
-- repo: https://github.com/pre-commit/mirrors-mypy
- rev: 'v0.931'
+- repo: https://github.com/pre-commit/mirrors-isort
+ rev: v5.2.0
hooks:
- - id: mypy
- exclude: tests
+ - id: isort
-- repo: https://github.com/pycqa/isort
- rev: 5.5.4
+- repo: https://github.com/deathbeds/prenotebook
+ rev: f5bdb72a400f1a56fe88109936c83aa12cc349fa
hooks:
- - id: isort
- args: ["--profile", "black"]
+ - id: prenotebook
- repo: https://github.com/myint/rstcheck
- rev: 3f92957478422df87bd730abde66f089cc1ee19b
+ rev: master
hooks:
- id: rstcheck

MODIFY
pangeo_forge_recipes/recipes/xarray_zarr.py
pangeo_forge_recipes/recipes/xarray_zarr.py
@@ -39,6 +39,7 @@ MAX_MEMORY = (
OPENER_MAP = {
FileType.netcdf3: dict(engine="scipy"),
FileType.netcdf4: dict(engine="h5netcdf"),
+ FileType.tiff: dict(engine="rasterio"),
}
logger = logging.getLogger(__name__)
@@ -430,10 +431,7 @@ def open_chunk(chunk_key: ChunkKey, *, config: XarrayZarrRecipe) -> xr.Dataset:
yield ds
-def get_input_meta(
- metadata_cache: Optional[MetadataTarget],
- file_pattern: FilePattern,
-) -> Dict:
+def get_input_meta(metadata_cache: Optional[MetadataTarget], file_pattern: FilePattern,) -> Dict:
# getitems should be async; much faster than serial calls
if metadata_cache is None:
raise ValueError("metadata_cache is not set.")
@@ -561,9 +559,7 @@ def prepare_target(*, config: XarrayZarrRecipe) -> None:
# Regardless of whether there is an existing dataset or we are creating a new one,
# we need to expand the concat_dim to hold the entire expected size of the data
input_sequence_lens = calculate_sequence_lens(
- config.nitems_per_input,
- config.file_pattern,
- config.storage_config.metadata,
+ config.nitems_per_input, config.file_pattern, config.storage_config.metadata,
)
n_sequence = sum(input_sequence_lens)
logger.info(f"Expanding target concat dim '{config.concat_dim}' to size {n_sequence}")

added tiff filetype to OPENER_MAP in xarray_zarr.py