Skip to content

Commit

Permalink
Merge pull request #28 from csdms/mdpiper/de-lint
Browse files Browse the repository at this point in the history
De-lint project files
  • Loading branch information
mdpiper authored Aug 17, 2024
2 parents b932729 + 82d2784 commit 3ef7911
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 1,793 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Start a Python session and import the `GeoTiff` class:
```

For convenience,
let's use a test image from the [rasterio](https://rasterio.readthedocs.io) project:
let's use a test image from the [rasterio](https://rasterio.readthedocs.io) project:
```python
>>> url = "https://github.com/rasterio/rasterio/raw/main/tests/data/RGB.byte.tif"
```
Expand Down
16 changes: 7 additions & 9 deletions bmi_geotiff/bmi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
from collections import namedtuple
from typing import Tuple

import numpy
import yaml
Expand Down Expand Up @@ -375,7 +373,7 @@ def get_input_item_count(self) -> int:
"""
return len(self._input_var_names)

def get_input_var_names(self) -> Tuple[str]:
def get_input_var_names(self) -> tuple[str]:
"""List of a model's input variables.
Input variable names must be CSDMS Standard Names, also known
Expand Down Expand Up @@ -407,7 +405,7 @@ def get_output_item_count(self) -> int:
"""
return len(self._output_var_names)

def get_output_var_names(self) -> Tuple[str]:
def get_output_var_names(self) -> tuple[str]:
"""List of a model's output variables.
Output variable names must be CSDMS Standard Names, also known
Expand Down Expand Up @@ -484,7 +482,7 @@ def get_value(self, name: str, dest: numpy.ndarray) -> numpy.ndarray:
elif name == self._output_var_names[2]:
dest[:] = self._da.rio.transform()
else:
raise ValueError("get_value not available for %s." % (name,))
raise ValueError(f"get_value not available for {name}.")

return dest

Expand All @@ -511,7 +509,7 @@ def get_value_at_indices(
dest[:] = self.get_value_ptr(name).reshape(-1)[inds]
return dest
else:
raise ValueError("get_value_at_indices not available for %s." % (name,))
raise ValueError(f"get_value_at_indices not available for {name}.")

def get_value_ptr(self, name: str) -> numpy.ndarray:
"""Get a reference to values of the given variable.
Expand All @@ -533,7 +531,7 @@ def get_value_ptr(self, name: str) -> numpy.ndarray:
if name == self._output_var_names[0]:
return self._da.values
else:
raise ValueError("get_value_ptr not available for %s." % (name,))
raise ValueError(f"get_value_ptr not available for {name}.")

def get_var_grid(self, name: str) -> int:
"""Get grid identifier for the given variable.
Expand Down Expand Up @@ -682,7 +680,7 @@ def initialize(self, config_file: str) -> None:
with placeholder values is used by the BMI.
"""
if config_file:
with open(config_file, "r") as fp:
with open(config_file) as fp:
self._config = yaml.safe_load(fp).get("bmi-geotiff", {})
else:
self._config = {"filename": None}
Expand Down Expand Up @@ -713,7 +711,7 @@ def initialize(self, config_file: str) -> None:
grid=0,
),
self._output_var_names[1]: BmiVar(
dtype="U{}".format(len(self._da.spatial_ref.crs_wkt)),
dtype=f"U{len(self._da.spatial_ref.crs_wkt)}",
itemsize=len(self._da.spatial_ref.crs_wkt) * SIZEOF_FLOAT,
nbytes=len(self._da.spatial_ref.crs_wkt) * SIZEOF_FLOAT,
location="none",
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
version = pkg_resources.get_distribution("bmi_geotiff").version
release = version
this_year = datetime.date.today().year
copyright = "%s, %s" % (this_year, author)
copyright = "{}, {}".format(this_year, author)


# -- General configuration ---------------------------------------------------
Expand Down
Loading

0 comments on commit 3ef7911

Please sign in to comment.