Skip to content

Commit 42d0062

Browse files
committed
Minor doc updates on output format guessing in VectorCube #401/#449
1 parent ac6dce6 commit 42d0062

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

openeo/rest/datacube.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1933,7 +1933,8 @@ def download(
19331933
options: Optional[dict] = None,
19341934
) -> Union[None, bytes]:
19351935
"""
1936-
Download the raster data cube, e.g. as GeoTIFF.
1936+
Execute synchronously and download the raster data cube, e.g. as GeoTIFF.
1937+
19371938
If outputfile is provided, the result is stored on disk locally, otherwise, a bytes object is returned.
19381939
The bytes object can be passed on to a suitable decoder for decoding.
19391940

openeo/rest/vectorcube.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,27 @@ def execute(self) -> dict:
136136
"""Executes the process graph of the imagery."""
137137
return self._connection.execute(self.flat_graph())
138138

139-
def download(self, outputfile: Union[str, pathlib.Path], format: Optional[str] = None, options: dict = None):
139+
def download(
140+
self,
141+
outputfile: Optional[Union[str, pathlib.Path]] = None,
142+
format: Optional[str] = None,
143+
options: Optional[dict] = None,
144+
) -> Union[None, bytes]:
145+
"""
146+
Execute synchronously and download the vector cube.
147+
148+
The result will be stored to the output path, when specified.
149+
If no output path (or ``None``) is given, the raw download content will be returned as ``bytes`` object.
150+
151+
:param outputfile: (optional) output file to store the result to
152+
:param format: (optional) output format to use.
153+
:param options: (optional) additional output format options.
154+
:return:
155+
156+
.. versionchanged:: 0.21.0
157+
When not specified explicitly, output format is guessed from output file extension.
158+
159+
"""
140160
# TODO #401 make outputfile optional (See DataCube.download)
141161
# TODO #401/#449 don't guess/override format if there is already a save_result with format?
142162
if format is None and outputfile:
@@ -163,8 +183,11 @@ def execute_batch(
163183
164184
:param job_options:
165185
:param outputfile: The path of a file to which a result can be written
166-
:param out_format: (optional) Format of the job result.
167-
:param format_options: String Parameters for the job result format
186+
:param out_format: (optional) output format to use.
187+
:param format_options: (optional) additional output format options
188+
189+
.. versionchanged:: 0.21.0
190+
When not specified explicitly, output format is guessed from output file extension.
168191
"""
169192
if out_format is None and outputfile:
170193
# TODO #401/#449 don't guess/override format if there is already a save_result with format?

0 commit comments

Comments
 (0)