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

Typecheck spatial module #605

Open
wants to merge 25 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
86345a5
Typecheck spatial module
mfisher87 Sep 10, 2024
bfa9562
Fix doctest I broke
mfisher87 Sep 18, 2024
153c307
add datetime import to query.py for typechecking
JessicaS11 Oct 24, 2024
e0ef967
make types in abc order
JessicaS11 Oct 24, 2024
635e31c
add shapely.Polygon accepted input to docstring
JessicaS11 Oct 29, 2024
130160b
change to ExhaustiveTypeGuardException error type
JessicaS11 Oct 29, 2024
830f471
change to ExhaustiveTypeGuardException error type
JessicaS11 Oct 29, 2024
0ca4485
Reorder `Spatial` private properties in alpha order
trey-stafford Oct 30, 2024
b035695
Remove typing allowing list of coordinates as strings
trey-stafford Oct 30, 2024
1c1c490
Support shapely.Polygon for `spatial.geodataframe` `spatial_extent`
trey-stafford Oct 30, 2024
cbc761c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 30, 2024
52037e9
`spatial.geodataframe` supports a list of tuples for `spatial_extent`
trey-stafford Oct 30, 2024
7c64991
Test code branch indicated as a "dev goal" in comment
trey-stafford Oct 30, 2024
2adc38d
Fixup test to indicate that we want to read a bbox from file
trey-stafford Oct 30, 2024
9df3ec7
Add test for unlikely error case
trey-stafford Oct 30, 2024
6f771d8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 30, 2024
3f923a6
Add unit test for unlikely error in `fmt_for_EGI`
trey-stafford Oct 30, 2024
27de548
Fixup typeerror message and add test covering check in geodataframe
trey-stafford Oct 30, 2024
191181e
Add test for code branch that performes a dateline-crossing adjustment
trey-stafford Oct 30, 2024
9aa54dc
import icepyx as ipx in test_spatial
trey-stafford Oct 31, 2024
207be53
Merge branch 'development' into typecheck-spatial
JessicaS11 Nov 4, 2024
c89df21
Refactor `geodataframe` to more clearly show where a list of floats i…
trey-stafford Nov 11, 2024
b632617
Convert `spatial_extent` to `list[float]` for most functions
trey-stafford Nov 11, 2024
7675584
Update unit tests: spatial extent must be floats - not ints
trey-stafford Nov 11, 2024
7bd668c
Remove OBE TODO
trey-stafford Nov 14, 2024
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
14 changes: 8 additions & 6 deletions icepyx/core/query.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import datetime as dt
import pprint
from typing import Optional, Union, cast

Expand Down Expand Up @@ -126,14 +127,15 @@ class GenQuery:
Quest
"""

_spatial: spat.Spatial
_temporal: tp.Temporal

def __init__(
self,
spatial_extent=None,
date_range=None,
start_time=None,
end_time=None,
spatial_extent: Union[str, list[float], None] = None,
date_range: Union[list, dict, None] = None,
start_time: Union[str, dt.time, None] = None,
end_time: Union[str, dt.time, None] = None,
**kwargs,
):
# validate & init spatial extent
Expand Down Expand Up @@ -187,7 +189,7 @@ def temporal(self) -> Union[tp.Temporal, list[str]]:
return ["No temporal parameters set"]

@property
def spatial(self):
def spatial(self) -> spat.Spatial:
"""
Return the spatial object, which provides the underlying functionality for validating
and formatting geospatial objects. The spatial object has several properties to enable
Expand All @@ -214,7 +216,7 @@ def spatial(self):
return self._spatial

@property
def spatial_extent(self):
def spatial_extent(self) -> tuple[spat.ExtentType, list[float]]:
"""
Return an array showing the spatial extent of the query object.
Spatial extent is returned as an input type (which depends on how
Expand Down
Loading