Skip to content

Commit

Permalink
Revert "update QUEST and GenQuery classes for argo integration (#441)"
Browse files Browse the repository at this point in the history
This reverts commit 938262f.
  • Loading branch information
JessicaS11 authored Jan 5, 2024
1 parent 3d78fe5 commit 4a9e16d
Show file tree
Hide file tree
Showing 7 changed files with 232 additions and 424 deletions.
25 changes: 0 additions & 25 deletions doc/source/contributing/quest-available-datasets.rst

This file was deleted.

345 changes: 172 additions & 173 deletions icepyx/core/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
import icepyx.core.APIformatting as apifmt
from icepyx.core.auth import EarthdataAuthMixin
import icepyx.core.granules as granules
# QUESTION: why doesn't from granules import Granules work, since granules=icepyx.core.granules?
from icepyx.core.granules import Granules
from icepyx.core.granules import Granules as Granules
import icepyx.core.is2ref as is2ref

# QUESTION: why doesn't from granules import Granules as Granules work, since granules=icepyx.core.granules?
# from icepyx.core.granules import Granules
import icepyx.core.spatial as spat
import icepyx.core.temporal as tp
import icepyx.core.validate_inputs as val
Expand Down Expand Up @@ -146,177 +148,6 @@ def __str__(self):
)
return str

# ----------------------------------------------------------------------
# Properties

@property
def temporal(self):
"""
Return the Temporal object containing date/time range information for the query object.
See Also
--------
temporal.Temporal.start
temporal.Temporal.end
temporal.Temporal
Examples
--------
>>> reg_a = GenQuery([-55, 68, -48, 71],['2019-02-20','2019-02-28'])
>>> print(reg_a.temporal)
Start date and time: 2019-02-20 00:00:00
End date and time: 2019-02-28 23:59:59
>>> reg_a = GenQuery([-55, 68, -48, 71],cycles=['03','04','05','06','07'], tracks=['0849','0902'])
>>> print(reg_a.temporal)
['No temporal parameters set']
"""

if hasattr(self, "_temporal"):
return self._temporal
else:
return ["No temporal parameters set"]

@property
def spatial(self):
"""
Return the spatial object, which provides the underlying functionality for validating
and formatting geospatial objects. The spatial object has several properties to enable
user access to the stored spatial extent in multiple formats.
See Also
--------
spatial.Spatial.spatial_extent
spatial.Spatial.extent_type
spatial.Spatial.extent_file
spatial.Spatial
Examples
--------
>>> reg_a = ipx.GenQuery([-55, 68, -48, 71],['2019-02-20','2019-02-28'])
>>> reg_a.spatial # doctest: +SKIP
<icepyx.core.spatial.Spatial at [location]>
>>> print(reg_a.spatial)
Extent type: bounding_box
Coordinates: [-55.0, 68.0, -48.0, 71.0]
"""
return self._spatial

@property
def spatial_extent(self):
"""
Return an array showing the spatial extent of the query object.
Spatial extent is returned as an input type (which depends on how
you initially entered your spatial data) followed by the geometry data.
Bounding box data is [lower-left-longitude, lower-left-latitute, upper-right-longitude, upper-right-latitude].
Polygon data is [longitude1, latitude1, longitude2, latitude2,
... longitude_n,latitude_n, longitude1,latitude1].
Returns
-------
tuple of length 2
First tuple element is the spatial type ("bounding box" or "polygon").
Second tuple element is the spatial extent as a list of coordinates.
Examples
--------
# Note: coordinates returned as float, not int
>>> reg_a = GenQuery([-55, 68, -48, 71],['2019-02-20','2019-02-28'])
>>> reg_a.spatial_extent
('bounding_box', [-55.0, 68.0, -48.0, 71.0])
>>> reg_a = GenQuery([(-55, 68), (-55, 71), (-48, 71), (-48, 68), (-55, 68)],['2019-02-20','2019-02-28'])
>>> reg_a.spatial_extent
('polygon', [-55.0, 68.0, -55.0, 71.0, -48.0, 71.0, -48.0, 68.0, -55.0, 68.0])
# NOTE Is this where we wanted to put the file-based test/example?
# The test file path is: examples/supporting_files/simple_test_poly.gpkg
See Also
--------
Spatial.extent
Spatial.extent_type
Spatial.extent_as_gdf
"""

return (self._spatial._ext_type, self._spatial._spatial_ext)

@property
def dates(self):
"""
Return an array showing the date range of the query object.
Dates are returned as an array containing the start and end datetime objects, inclusive, in that order.
Examples
--------
>>> reg_a = ipx.GenQuery([-55, 68, -48, 71],['2019-02-20','2019-02-28'])
>>> reg_a.dates
['2019-02-20', '2019-02-28']
>>> reg_a = GenQuery([-55, 68, -48, 71])
>>> reg_a.dates
['No temporal parameters set']
"""
if not hasattr(self, "_temporal"):
return ["No temporal parameters set"]
else:
return [
self._temporal._start.strftime("%Y-%m-%d"),
self._temporal._end.strftime("%Y-%m-%d"),
] # could also use self._start.date()

@property
def start_time(self):
"""
Return the start time specified for the start date.
Examples
--------
>>> reg_a = ipx.GenQuery([-55, 68, -48, 71],['2019-02-20','2019-02-28'])
>>> reg_a.start_time
'00:00:00'
>>> reg_a = ipx.GenQuery([-55, 68, -48, 71],['2019-02-20','2019-02-28'], start_time='12:30:30')
>>> reg_a.start_time
'12:30:30'
>>> reg_a = GenQuery([-55, 68, -48, 71])
>>> reg_a.start_time
['No temporal parameters set']
"""
if not hasattr(self, "_temporal"):
return ["No temporal parameters set"]
else:
return self._temporal._start.strftime("%H:%M:%S")

@property
def end_time(self):
"""
Return the end time specified for the end date.
Examples
--------
>>> reg_a = ipx.GenQuery([-55, 68, -48, 71],['2019-02-20','2019-02-28'])
>>> reg_a.end_time
'23:59:59'
>>> reg_a = ipx.GenQuery([-55, 68, -48, 71],['2019-02-20','2019-02-28'], end_time='10:20:20')
>>> reg_a.end_time
'10:20:20'
>>> reg_a = GenQuery([-55, 68, -48, 71])
>>> reg_a.end_time
['No temporal parameters set']
"""
if not hasattr(self, "_temporal"):
return ["No temporal parameters set"]
else:
return self._temporal._end.strftime("%H:%M:%S")


# DevGoal: update docs throughout to allow for polygon spatial extent
# Note: add files to docstring once implemented
Expand Down Expand Up @@ -502,6 +333,174 @@ def product_version(self):
"""
return self._version

@property
def temporal(self):
"""
Return the Temporal object containing date/time range information for the query object.
See Also
--------
temporal.Temporal.start
temporal.Temporal.end
temporal.Temporal
Examples
--------
>>> reg_a = Query('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28'])
>>> print(reg_a.temporal)
Start date and time: 2019-02-20 00:00:00
End date and time: 2019-02-28 23:59:59
>>> reg_a = Query('ATL06',[-55, 68, -48, 71],cycles=['03','04','05','06','07'], tracks=['0849','0902'])
>>> print(reg_a.temporal)
['No temporal parameters set']
"""

if hasattr(self, "_temporal"):
return self._temporal
else:
return ["No temporal parameters set"]

@property
def spatial(self):
"""
Return the spatial object, which provides the underlying functionality for validating
and formatting geospatial objects. The spatial object has several properties to enable
user access to the stored spatial extent in multiple formats.
See Also
--------
spatial.Spatial.spatial_extent
spatial.Spatial.extent_type
spatial.Spatial.extent_file
spatial.Spatial
Examples
--------
>>> reg_a = ipx.Query('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28'])
>>> reg_a.spatial # doctest: +SKIP
<icepyx.core.spatial.Spatial at [location]>
>>> print(reg_a.spatial)
Extent type: bounding_box
Coordinates: [-55.0, 68.0, -48.0, 71.0]
"""
return self._spatial

@property
def spatial_extent(self):
"""
Return an array showing the spatial extent of the query object.
Spatial extent is returned as an input type (which depends on how
you initially entered your spatial data) followed by the geometry data.
Bounding box data is [lower-left-longitude, lower-left-latitute, upper-right-longitude, upper-right-latitude].
Polygon data is [longitude1, latitude1, longitude2, latitude2,
... longitude_n,latitude_n, longitude1,latitude1].
Returns
-------
tuple of length 2
First tuple element is the spatial type ("bounding box" or "polygon").
Second tuple element is the spatial extent as a list of coordinates.
Examples
--------
# Note: coordinates returned as float, not int
>>> reg_a = Query('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28'])
>>> reg_a.spatial_extent
('bounding_box', [-55.0, 68.0, -48.0, 71.0])
>>> reg_a = Query('ATL06',[(-55, 68), (-55, 71), (-48, 71), (-48, 68), (-55, 68)],['2019-02-20','2019-02-28'])
>>> reg_a.spatial_extent
('polygon', [-55.0, 68.0, -55.0, 71.0, -48.0, 71.0, -48.0, 68.0, -55.0, 68.0])
# NOTE Is this where we wanted to put the file-based test/example?
# The test file path is: examples/supporting_files/simple_test_poly.gpkg
See Also
--------
Spatial.extent
Spatial.extent_type
Spatial.extent_as_gdf
"""

return (self._spatial._ext_type, self._spatial._spatial_ext)

@property
def dates(self):
"""
Return an array showing the date range of the query object.
Dates are returned as an array containing the start and end datetime objects, inclusive, in that order.
Examples
--------
>>> reg_a = ipx.Query('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28'])
>>> reg_a.dates
['2019-02-20', '2019-02-28']
>>> reg_a = Query('ATL06',[-55, 68, -48, 71],cycles=['03','04','05','06','07'], tracks=['0849','0902'])
>>> reg_a.dates
['No temporal parameters set']
"""
if not hasattr(self, "_temporal"):
return ["No temporal parameters set"]
else:
return [
self._temporal._start.strftime("%Y-%m-%d"),
self._temporal._end.strftime("%Y-%m-%d"),
] # could also use self._start.date()

@property
def start_time(self):
"""
Return the start time specified for the start date.
Examples
--------
>>> reg_a = ipx.Query('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28'])
>>> reg_a.start_time
'00:00:00'
>>> reg_a = ipx.Query('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28'], start_time='12:30:30')
>>> reg_a.start_time
'12:30:30'
>>> reg_a = Query('ATL06',[-55, 68, -48, 71],cycles=['03','04','05','06','07'], tracks=['0849','0902'])
>>> reg_a.start_time
['No temporal parameters set']
"""
if not hasattr(self, "_temporal"):
return ["No temporal parameters set"]
else:
return self._temporal._start.strftime("%H:%M:%S")

@property
def end_time(self):
"""
Return the end time specified for the end date.
Examples
--------
>>> reg_a = ipx.Query('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28'])
>>> reg_a.end_time
'23:59:59'
>>> reg_a = ipx.Query('ATL06',[-55, 68, -48, 71],['2019-02-20','2019-02-28'], end_time='10:20:20')
>>> reg_a.end_time
'10:20:20'
>>> reg_a = Query('ATL06',[-55, 68, -48, 71],cycles=['03','04','05','06','07'], tracks=['0849','0902'])
>>> reg_a.end_time
['No temporal parameters set']
"""
if not hasattr(self, "_temporal"):
return ["No temporal parameters set"]
else:
return self._temporal._end.strftime("%H:%M:%S")

@property
def cycles(self):
"""
Expand Down
Empty file added icepyx/quest/__init__.py
Empty file.
Loading

0 comments on commit 4a9e16d

Please sign in to comment.