Skip to content

Commit 3437b23

Browse files
committed
Docstyle updated to Numpy
1 parent c3c317a commit 3437b23

File tree

1 file changed

+57
-34
lines changed

1 file changed

+57
-34
lines changed

src/worldcereal/job.py

Lines changed: 57 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -89,23 +89,35 @@ def generate_map(
8989
output_path: Optional[Union[Path, str]],
9090
product_type: WorldCerealProduct = WorldCerealProduct.CROPLAND,
9191
out_format: str = "GTiff",
92-
):
92+
) -> InferenceResults:
9393
"""Main function to generate a WorldCereal product.
9494
95-
Args:
96-
spatial_extent (BoundingBoxExtent): spatial extent of the map
97-
temporal_extent (TemporalContext): temporal range to consider
98-
backend_context (BackendContext): backend to run the job on
99-
output_path (Union[Path, str]): output path to download the product to
100-
product (str, optional): product describer. Defaults to "cropland".
101-
format (str, optional): Output format. Defaults to "GTiff".
102-
103-
Raises:
104-
ValueError: if the product is not supported
105-
ValueError: if the out_format is not supported
106-
ValueError: if a cropland mask is applied on a cropland workflow
107-
108-
95+
Parameters
96+
----------
97+
spatial_extent : BoundingBoxExtent
98+
spatial extent of the map
99+
temporal_extent : TemporalContext
100+
temporal range to consider
101+
backend_context : BackendContext
102+
backend to run the job on
103+
output_path : Optional[Union[Path, str]]
104+
output path to download the product to
105+
product_type : WorldCerealProduct, optional
106+
product describer, by default WorldCerealProduct.CROPLAND
107+
out_format : str, optional
108+
Output format, by default "GTiff"
109+
110+
Returns
111+
-------
112+
InferenceResults
113+
Results of the finished WorldCereal job.
114+
115+
Raises
116+
------
117+
ValueError
118+
if the product is not supported
119+
ValueError
120+
if the out_format is not supported
109121
"""
110122

111123
if product_type not in PRODUCT_SETTINGS.keys():
@@ -172,18 +184,20 @@ def collect_inputs(
172184
temporal_extent: TemporalContext,
173185
backend_context: BackendContext,
174186
output_path: Union[Path, str],
175-
) -> DataCube:
187+
):
176188
"""Function to retrieve preprocessed inputs that are being
177189
used in the generation of WorldCereal products.
178190
179-
Args:
180-
spatial_extent (BoundingBoxExtent): spatial extent of the map
181-
temporal_extent (TemporalContext): temporal range to consider
182-
backend_context (BackendContext): backend to run the job on
183-
output_path (Union[Path, str]): output path to download the product to
184-
185-
Raises:
186-
ValueError: if the product is not supported
191+
Parameters
192+
----------
193+
spatial_extent : BoundingBoxExtent
194+
spatial extent of the map
195+
temporal_extent : TemporalContext
196+
temporal range to consider
197+
backend_context : BackendContext
198+
backend to run the job on
199+
output_path : Union[Path, str]
200+
output path to download the product to
187201
188202
"""
189203

@@ -211,11 +225,15 @@ def _cropland_map(inputs: DataCube) -> DataCube:
211225
"""Method to produce cropland map from preprocessed inputs, using
212226
a Presto feature extractor and a CatBoost classifier.
213227
214-
Args:
215-
inputs (DataCube): preprocessed input cube
228+
Parameters
229+
----------
230+
inputs : DataCube
231+
preprocessed input cube
216232
217-
Returns:
218-
DataCube: binary labels and probability
233+
Returns
234+
-------
235+
DataCube
236+
binary labels and probability
219237
"""
220238

221239
# Run feature computer
@@ -267,12 +285,17 @@ def _croptype_map(inputs: DataCube, cropland_mask: DataCube = None) -> DataCube:
267285
"""Method to produce croptype map from preprocessed inputs, using
268286
a Presto feature extractor and a CatBoost classifier.
269287
270-
Args:
271-
inputs (DataCube): preprocessed input cube
272-
cropland_mask (DataCube): optional cropland mask
273-
274-
Returns:
275-
DataCube: croptype labels and probability
288+
Parameters
289+
----------
290+
inputs : DataCube
291+
preprocessed input cube
292+
cropland_mask : DataCube, optional
293+
optional cropland mask, by default None
294+
295+
Returns
296+
-------
297+
DataCube
298+
croptype labels and probability
276299
"""
277300

278301
# Run feature computer

0 commit comments

Comments
 (0)