Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.3.0 release #664

Merged
merged 15 commits into from
Jul 11, 2022
Merged
3 changes: 0 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
python-version: '3.10'
- name: Install pip dependencies
run: |
pip install --pre 'rasterio>=1.0.16'
pip install .[tests]
pip list
- name: Run pytest checks
Expand All @@ -36,7 +35,6 @@ jobs:
python-version: '3.10'
- name: Install pip dependencies
run: |
pip install --pre 'rasterio>=1.0.16'
pip install .[datasets,tests]
pip list
- name: Run integration checks
Expand All @@ -53,7 +51,6 @@ jobs:
python-version: '3.10'
- name: Install pip dependencies
run: |
pip install --pre 'rasterio>=1.0.16'
pip install .[datasets,docs,tests]
pip list
- name: Run notebook checks
Expand Down
8 changes: 2 additions & 6 deletions docs/tutorials/trainers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"outputs": [],
"source": [
"# Set this to your API key (available for free at https://mlhub.earth/)\n",
"RADIANT_EARTH_API_KEY = \"\""
"MLHUB_API_KEY = os.environ[\"MLHUB_API_KEY\"]"
]
},
{
Expand All @@ -132,11 +132,7 @@
"data_dir = os.path.join(tempfile.gettempdir(), \"cyclone_data\")\n",
"\n",
"datamodule = CycloneDataModule(\n",
" root_dir=data_dir,\n",
" seed=1337,\n",
" batch_size=64,\n",
" num_workers=6,\n",
" api_key=RADIANT_EARTH_API_KEY,\n",
" root_dir=data_dir, seed=1337, batch_size=64, num_workers=6, api_key=MLHUB_API_KEY\n",
")"
]
},
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ filterwarnings = [
# https://github.com/pytorch/pytorch/issues/72906
# https://github.com/pytorch/pytorch/pull/69823
"ignore:distutils Version classes are deprecated. Use packaging.version instead:DeprecationWarning:torch.utils.tensorboard",
"ignore:The distutils package is deprecated and slated for removal in Python 3.12:DeprecationWarning:torch.utils.tensorboard",
# https://github.com/PyTorchLightning/pytorch-lightning/issues/13256
# https://github.com/PyTorchLightning/pytorch-lightning/pull/13261
"ignore:torch.distributed._sharded_tensor will be deprecated:DeprecationWarning:torch.distributed._sharded_tensor",
Expand All @@ -78,6 +79,8 @@ filterwarnings = [
"ignore:Named tensors and all their associated APIs are an experimental feature and subject to change:UserWarning:torch.nn.functional",
# https://github.com/tensorflow/tensorboard/issues/5798
"ignore:Call to deprecated create function:DeprecationWarning:tensorboard.compat.proto",
# https://github.com/treebeardtech/nbmake/issues/68
'ignore:The \(fspath. py.path.local\) argument to NotebookFile is deprecated:pytest.PytestDeprecationWarning:nbmake.pytest_plugin',

# Expected warnings
# pytorch-lightning warns us about using num_workers=0, but it's faster on macOS
Expand Down
6 changes: 4 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,11 @@ style =
pyupgrade>=1.24,<3
tests =
# mypy 0.900+ required for pyproject.toml support
mypy>=0.900,<=0.961
mypy>=0.900,<0.962
# nbmake 0.1+ required to fix path_source bug
nbmake>=0.1,<2
# nbmake 1.2+ is buggy:
# https://github.com/treebeardtech/nbmake/issues/71
nbmake>=0.1,<1.2
# pytest 6.1.2+ required by nbmake
pytest>=6.1.2,<8
# pytest-cov 2.4+ required for pytest --cov flags
Expand Down
1 change: 1 addition & 0 deletions tests/datamodules/test_usavars.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
class TestUSAVarsDataModule:
@pytest.fixture()
def datamodule(self, request: SubRequest) -> USAVarsDataModule:
pytest.importorskip("pandas", minversion="0.23.2")
root = os.path.join("tests", "data", "usavars")
batch_size = 1
num_workers = 0
Expand Down
2 changes: 2 additions & 0 deletions tests/datasets/test_landcoverai.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class TestLandCoverAI:
def dataset(
self, monkeypatch: MonkeyPatch, tmp_path: Path, request: SubRequest
) -> LandCoverAI:
pytest.importorskip("cv2", minversion="3.4.2.17")
monkeypatch.setattr(torchgeo.datasets.landcoverai, "download_url", download_url)
md5 = "ff8998857cc8511f644d3f7d0f3688d0"
monkeypatch.setattr(LandCoverAI, "md5", md5)
Expand Down Expand Up @@ -56,6 +57,7 @@ def test_already_extracted(self, dataset: LandCoverAI) -> None:
LandCoverAI(root=dataset.root, download=True)

def test_already_downloaded(self, monkeypatch: MonkeyPatch, tmp_path: Path) -> None:
pytest.importorskip("cv2", minversion="3.4.2.17")
sha256 = "ecec8e871faf1bbd8ca525ca95ddc1c1f5213f40afb94599884bd85f990ebd6b"
monkeypatch.setattr(LandCoverAI, "sha256", sha256)
url = os.path.join("tests", "data", "landcoverai", "landcover.ai.v1.zip")
Expand Down
3 changes: 1 addition & 2 deletions tests/datasets/test_openbuildings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from typing import Any

import matplotlib.pyplot as plt
import pandas as pd
import pytest
import torch
import torch.nn as nn
Expand All @@ -24,7 +23,7 @@
UnionDataset,
)

pytest.importorskip("pandas", minversion="0.23.2")
pd = pytest.importorskip("pandas", minversion="0.23.2")


class TestOpenBuildings:
Expand Down
2 changes: 2 additions & 0 deletions tests/datasets/test_reforestree.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def download_url(url: str, root: str, *args: str) -> None:
class TestReforesTree:
@pytest.fixture
def dataset(self, monkeypatch: MonkeyPatch, tmp_path: Path) -> ReforesTree:
pytest.importorskip("pandas", minversion="0.23.2")
monkeypatch.setattr(torchgeo.datasets.utils, "download_url", download_url)
data_dir = os.path.join("tests", "data", "reforestree")

Expand Down Expand Up @@ -78,6 +79,7 @@ def test_len(self, dataset: ReforesTree) -> None:
assert len(dataset) == 2

def test_not_extracted(self, tmp_path: Path) -> None:
pytest.importorskip("pandas", minversion="0.23.2")
url = os.path.join("tests", "data", "reforestree", "reforesTree.zip")
shutil.copy(url, tmp_path)
ReforesTree(root=str(tmp_path))
Expand Down
5 changes: 5 additions & 0 deletions tests/test_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ def test_overwrite_experiment_dir(tmp_path: Path) -> None:
"program.data_dir=" + data_dir,
"program.log_dir=" + str(log_dir),
"experiment.task=cyclone",
"experiment.datamodule.root_dir=" + data_dir,
"program.overwrite=True",
"trainer.fast_dev_run=1",
"trainer.gpus=0",
]
ps = subprocess.run(args, capture_output=True, check=True)
assert re.search(
Expand Down Expand Up @@ -123,8 +125,11 @@ def test_config_file(tmp_path: Path) -> None:
experiment:
name: test
task: cyclone
datamodule:
root_dir: {data_dir}
trainer:
fast_dev_run: true
gpus: 0
"""
)
args = [sys.executable, "train.py", "config_file=" + str(config_file)]
Expand Down
2 changes: 1 addition & 1 deletion torchgeo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"""

__author__ = "Adam J. Stewart"
__version__ = "0.3.0.dev0"
__version__ = "0.3.0"
2 changes: 2 additions & 0 deletions torchgeo/datasets/eurosat.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ def __init__(
RuntimeError: if ``download=False`` and data is not found, or checksums
don't match
.. versionadded:: 0.3
The *bands* parameter.
"""
self.root = root
self.transforms = transforms
Expand Down
3 changes: 3 additions & 0 deletions torchgeo/datasets/so2sat.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ def __init__(
Raises:
AssertionError: if ``split`` argument is invalid
RuntimeError: if data is not found in ``root``, or checksums don't match
.. versionadded:: 0.3
The *bands* parameter.
"""
try:
import h5py # noqa: F401
Expand Down
3 changes: 3 additions & 0 deletions torchgeo/trainers/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ def __init__(self, **kwargs: Any) -> None:
Raises:
ValueError: if kwargs arguments are invalid
.. versionchanged:: 0.3
The *ignore_zeros* parameter was renamed to *ignore_index*.
"""
super().__init__()

Expand Down
4 changes: 4 additions & 0 deletions torchgeo/transforms/indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ class AppendSWI(AppendNormalizedDifferenceIndex):
If you use this index in your research, please cite the following paper:
* https://doi.org/10.3390/w13121647
.. versionadded:: 0.3
"""

def __init__(self, index_red: int, index_swir: int) -> None:
Expand All @@ -237,6 +239,8 @@ class AppendGNDVI(AppendNormalizedDifferenceIndex):
If you use this index in your research, please cite the following paper:
* https://doi.org/10.2134/agronj2001.933583x
.. versionadded:: 0.3
"""

def __init__(self, index_nir: int, index_green: int) -> None:
Expand Down