Skip to content
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
15 changes: 3 additions & 12 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
[flake8]
max_line_length = 88
ignore =
# line too long - let black handle that
E501
# Unnecessary dict/list/tuple call - rewrite as a literal
C408
# whitespace before ':' - doesn't work well with black
E203
# missing whitespace around operator - let black worry about that
E225
# line break occurred before a binary operator - let black worry about that
W503
# line break occurred adter a binary operator - let black worry about that
W504
# code formatting - let black handle that
E
W
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ default_language_version:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v6.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
rev: 26.10.1
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.13.2
rev: 9.0.2
hooks:
- id: isort
args: [rioxarray/, test/, docs/]
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
rev: 1.20.0
hooks:
- id: blacken-docs
args: [--skip-errors]
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
rev: 7.4.1
hooks:
- id: flake8
1 change: 1 addition & 0 deletions rioxarray/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Top-level package for rioxarray."""

__author__ = """rioxarray Contributors"""
import importlib.metadata

Expand Down
1 change: 1 addition & 0 deletions rioxarray/_convention/cf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
This module provides functions for reading and writing geospatial metadata according to
the CF conventions: https://github.com/cf-convention/cf-conventions
"""

from typing import Optional, Tuple, Union

import numpy
Expand Down
1 change: 1 addition & 0 deletions rioxarray/_convention/zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Zarr spatial convention: https://github.com/zarr-conventions/spatial
- Zarr geo-proj convention: https://github.com/zarr-conventions/geo-proj
"""

from typing import Optional, Union

import rasterio.crs
Expand Down
1 change: 1 addition & 0 deletions rioxarray/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
This file was adopted from: https://github.com/pydata/xarray # noqa
Source file: https://github.com/pydata/xarray/blob/1d7bcbdc75b6d556c04e2c7d7a042e4379e15303/xarray/backends/rasterio_.py # noqa
"""

# pylint: disable=too-many-lines
import contextlib
import importlib.metadata
Expand Down
1 change: 1 addition & 0 deletions rioxarray/_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
This file was adopted from: https://github.com/pydata/xarray # noqa
Source file: https://github.com/pydata/xarray/blob/2ab0666c1fcc493b1e0ebc7db14500c427f8804e/xarray/core/options.py # noqa
"""

from typing import Any, Optional

from rioxarray.enum import Convention
Expand Down
1 change: 1 addition & 0 deletions rioxarray/_show_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
adapted from :func:`sklearn.utils._show_versions`
which was adapted from :func:`pandas.show_versions`
"""

# pylint: disable=import-outside-toplevel
import importlib.metadata
import os
Expand Down
1 change: 1 addition & 0 deletions rioxarray/_spatial_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Helper functions for determining spatial attributes.
"""

import copy
import math
import warnings
Expand Down
1 change: 1 addition & 0 deletions rioxarray/crs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module contains helper methods for rasterio.crs.CRS.
"""

from typing import Any

import rasterio
Expand Down
1 change: 1 addition & 0 deletions rioxarray/enum.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Enums for rioxarray."""

from enum import Enum


Expand Down
6 changes: 3 additions & 3 deletions rioxarray/raster_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ def __init__(self, xarray_obj: xarray.DataArray):
self._obj: xarray.DataArray
# properties
self._nodata: Optional[float] = None
self._manager: Optional[
FileManager
] = None # https://github.com/vylor/rioxarray/issues/254
self._manager: Optional[FileManager] = (
None # https://github.com/vylor/rioxarray/issues/254
)

def set_nodata(
self, input_nodata: Optional[float], *, inplace: bool = True
Expand Down
1 change: 1 addition & 0 deletions rioxarray/raster_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- https://github.com/dymaxionlabs/dask-rasterio/blob/8dd7fdece7ad094a41908c0ae6b4fe6ca49cf5e1/dask_rasterio/write.py # noqa: E501

"""

import numpy
import rasterio
import xarray
Expand Down
1 change: 1 addition & 0 deletions rioxarray/xarray_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This module allows for open_rasterio to be used with the xarray open methods
through a backend entrypoint.
"""

# pylint: disable=arguments-differ
import os.path

Expand Down
2 changes: 1 addition & 1 deletion test/integration/test_integration__io_uri_manager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Tests based on: https://github.com/pydata/xarray/blob/071da2a900702d65c47d265192bc7e424bb57932/xarray/tests/test_backends_file_manager.py
"""

import concurrent.futures
import gc
import pickle
Expand Down Expand Up @@ -32,7 +33,6 @@ def test_uri_manager_mock_write__threaded():
manager = URIManager(opener, "filename")

def write(iter):
nonlocal manager
fh = manager.acquire()
fh.write("contents")
manager._local.thread_manager = None
Expand Down
14 changes: 8 additions & 6 deletions test/integration/test_integration_rioxarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -3367,9 +3367,10 @@ def test_non_rectilinear__reproject(rename, open_rasterio):
def test_to_rasterio_dataset():
in_rpc_path = os.path.join(TEST_INPUT_DATA_DIR, "cog.tif")
in_rpc = rioxarray.open_rasterio(in_rpc_path)
with in_rpc.rio.to_rasterio_dataset() as riox_ds, rasterio.open(
in_rpc_path
) as rio_ds:
with (
in_rpc.rio.to_rasterio_dataset() as riox_ds,
rasterio.open(in_rpc_path) as rio_ds,
):
# object type
assert isinstance(riox_ds, DatasetReader), "Error in object type"

Expand All @@ -3395,9 +3396,10 @@ def test_to_rasterio_dataset():
def test_to_rasterio_dataset_rpcs():
in_rpc_path = os.path.join(TEST_INPUT_DATA_DIR, "test_rpcs.tif")
in_rpc = rioxarray.open_rasterio(in_rpc_path)
with in_rpc.rio.to_rasterio_dataset() as riox_ds, rasterio.open(
in_rpc_path
) as rio_ds:
with (
in_rpc.rio.to_rasterio_dataset() as riox_ds,
rasterio.open(in_rpc_path) as rio_ds,
):
# object type
assert isinstance(riox_ds, DatasetReader), "Error in object type"

Expand Down
1 change: 1 addition & 0 deletions test/integration/test_integration_zarr_conventions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Integration tests for reading Zarr conventions."""

import numpy as np
import pyproj
import xarray as xr
Expand Down
1 change: 1 addition & 0 deletions test/unit/test_convention_cf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit tests for the CF convention module."""

import numpy
import xarray
from affine import Affine
Expand Down
1 change: 1 addition & 0 deletions test/unit/test_convention_zarr.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit tests for the Zarr convention module."""

import numpy as np
import xarray as xr
from affine import Affine
Expand Down
Loading