-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove unnecessary encoding line * Remove unncecessary encoding line * Change imports to be compatible with the current version of GDAL * Add NoneType checks for scale and offset * Add zr relation parameters to metadata * Set unit to dBZ instead of None returned by GetUnitType * Set transform to dB * Update FMI PGM directory * Update black in pre-commit to latest version * Remove unused offset and scale lines * Add section for FMI GeoTIFF files * Add tests for the FMI GeoTIFF importer * Add gdal to requirements * Skip test if GDAL is missing * Install GDAL to test geotiff importer * Remove gdal from requirements * Add gdal as optional dependency in user guide Co-authored-by: Daniele Nerini <daniele.nerini@gmail.com>
- Loading branch information
Showing
7 changed files
with
66 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 21.7b0 | ||
rev: 22.3.0 | ||
hooks: | ||
- id: black | ||
language_version: python3 | ||
language_version: python3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ dependencies: | |
- pandas | ||
- scikit-image | ||
- rasterio | ||
- gdal | ||
# Test dependencies | ||
- pytest | ||
- pytest-cov | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import os | ||
|
||
import pytest | ||
|
||
import pysteps | ||
from pysteps.tests.helpers import smart_assert | ||
|
||
pytest.importorskip("pyproj") | ||
pytest.importorskip("osgeo") | ||
|
||
root_path = pysteps.rcparams.data_sources["fmi_geotiff"]["root_path"] | ||
filename = os.path.join( | ||
root_path, | ||
"20160928", | ||
"201609281600_FINUTM.tif", | ||
) | ||
precip, _, metadata = pysteps.io.import_fmi_geotiff(filename) | ||
|
||
|
||
def test_io_import_fmi_geotiff_shape(): | ||
"""Test the shape of the read file.""" | ||
assert precip.shape == (7316, 4963) | ||
|
||
|
||
expected_proj = ( | ||
"+proj=utm +zone=35 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs" | ||
) | ||
|
||
# test_geodata: list of (variable,expected,tolerance) tuples | ||
test_geodata = [ | ||
("projection", expected_proj, None), | ||
("x1", -196593.0043142295908183, 1e-10), | ||
("x2", 1044176.9413554778, 1e-10), | ||
("y1", 6255329.6988206729292870, 1e-10), | ||
("y2", 8084432.005259146, 1e-10), | ||
("xpixelsize", 250.0040188736061566, 1e-6), | ||
("ypixelsize", 250.0139839309011904, 1e-6), | ||
("cartesian_unit", "m", None), | ||
("yorigin", "upper", None), | ||
] | ||
|
||
|
||
@pytest.mark.parametrize("variable, expected, tolerance", test_geodata) | ||
def test_io_import_fmi_pgm_geodata(variable, expected, tolerance): | ||
"""Test the GeoTIFF and metadata reading.""" | ||
smart_assert(metadata[variable], expected, tolerance) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import os | ||
|
||
import pytest | ||
|