Skip to content

Commit 52e302e

Browse files
committed
fixes for linting
1 parent af0a393 commit 52e302e

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

scripts/worldcover/run.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
YORIGIN = 50.0
3838
XORIGIN = -125.0
3939
PXSIZE = 8.333333333333333e-05
40+
SUCCESS_CODE = 200
4041

4142
RASTER_X_SIZE = (E_W_INDEX_END - E_W_INDEX_START) * TILE_SIZE
4243
RASTER_Y_SIZE = (N_S_INDEX_END - N_S_INDEX_START) * TILE_SIZE
@@ -145,7 +146,7 @@ def download_image(url):
145146
# Download an image from a URL
146147
response = requests.get(url)
147148
# Check if the request was successful
148-
if response.status_code == 200:
149+
if response.status_code == SUCCESS_CODE:
149150
return response.content # Return the image content
150151
else:
151152
raise Exception("Failed to download the image")
@@ -244,7 +245,7 @@ def get_pixels(result):
244245
if NODATA in data:
245246
return
246247
pixels.append(data)
247-
transform = src.window_transform(win)
248+
# transform = src.window_transform(win)
248249

249250
if len(pixels) == 1:
250251
pixels = pixels[0]
@@ -365,11 +366,6 @@ def get_pixels(result):
365366
]
366367

367368
data = {
368-
# "source_url": batch["source_url"][0],
369-
# "date": pd.to_datetime(arg=date, format="%Y-%m-%d").astype(
370-
# dtype="date32[day][pyarrow]"
371-
# ),
372-
# "date": pd.to_datetime(date, format="%Y-%m-%d", dtype="date32[day][pyarrow]"),
373369
"date": pd.to_datetime(batch["date"], format="%Y-%m-%d"),
374370
"embeddings": [numpy.ascontiguousarray(embeddings_output_patch)],
375371
}
@@ -397,7 +393,9 @@ def get_pixels(result):
397393
# print(gdf)
398394

399395
gdf.to_parquet(
400-
path=outpath, compression="ZSTD", schema_version="1.0.0"
396+
path=outpath,
397+
compression="ZSTD",
398+
schema_version="1.0.0"
401399
)
402400

403401
s3_client = boto3.client("s3")

scripts/worldcover/run_msi_sar.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
YORIGIN = 50.0
3737
XORIGIN = -125.0
3838
PXSIZE = 8.333333333333333e-05
39+
SUCCESS_CODE = 200
3940

4041
RASTER_X_SIZE = (E_W_INDEX_END - E_W_INDEX_START) * TILE_SIZE
4142
RASTER_Y_SIZE = (N_S_INDEX_END - N_S_INDEX_START) * TILE_SIZE
@@ -191,7 +192,7 @@ def download_image(url):
191192
# Download the image from the URL
192193
response = requests.get(url)
193194
# Check if the request was successful
194-
if response.status_code == 200:
195+
if response.status_code == SUCCESS_CODE:
195196
return response.content # Return the image content
196197
else:
197198
raise Exception("Failed to download the image")
@@ -394,11 +395,6 @@ def make_batch(result):
394395
]
395396

396397
data = {
397-
# "source_url": batch["source_url"][0],
398-
# "date": pd.to_datetime(arg=date, format="%Y-%m-%d").astype(
399-
# dtype="date32[day][pyarrow]"
400-
# ),
401-
# "date": pd.to_datetime(date, format="%Y-%m-%d", dtype="date32[day][pyarrow]"),
402398
"date": pd.to_datetime(batch["date"], format="%Y-%m-%d"),
403399
"embeddings": [numpy.ascontiguousarray(embeddings_output_patch)],
404400
}
@@ -426,7 +422,9 @@ def make_batch(result):
426422
# print(gdf)
427423

428424
gdf.to_parquet(
429-
path=outpath, compression="ZSTD", schema_version="1.0.0"
425+
path=outpath,
426+
compression="ZSTD",
427+
schema_version="1.0.0"
430428
)
431429

432430
s3_client = boto3.client("s3")

0 commit comments

Comments
 (0)