|
37 | 37 | YORIGIN = 50.0 |
38 | 38 | XORIGIN = -125.0 |
39 | 39 | PXSIZE = 8.333333333333333e-05 |
| 40 | +SUCCESS_CODE = 200 |
40 | 41 |
|
41 | 42 | RASTER_X_SIZE = (E_W_INDEX_END - E_W_INDEX_START) * TILE_SIZE |
42 | 43 | RASTER_Y_SIZE = (N_S_INDEX_END - N_S_INDEX_START) * TILE_SIZE |
@@ -145,7 +146,7 @@ def download_image(url): |
145 | 146 | # Download an image from a URL |
146 | 147 | response = requests.get(url) |
147 | 148 | # Check if the request was successful |
148 | | - if response.status_code == 200: |
| 149 | + if response.status_code == SUCCESS_CODE: |
149 | 150 | return response.content # Return the image content |
150 | 151 | else: |
151 | 152 | raise Exception("Failed to download the image") |
@@ -244,7 +245,7 @@ def get_pixels(result): |
244 | 245 | if NODATA in data: |
245 | 246 | return |
246 | 247 | pixels.append(data) |
247 | | - transform = src.window_transform(win) |
| 248 | + # transform = src.window_transform(win) |
248 | 249 |
|
249 | 250 | if len(pixels) == 1: |
250 | 251 | pixels = pixels[0] |
@@ -365,11 +366,6 @@ def get_pixels(result): |
365 | 366 | ] |
366 | 367 |
|
367 | 368 | 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]"), |
373 | 369 | "date": pd.to_datetime(batch["date"], format="%Y-%m-%d"), |
374 | 370 | "embeddings": [numpy.ascontiguousarray(embeddings_output_patch)], |
375 | 371 | } |
@@ -397,7 +393,9 @@ def get_pixels(result): |
397 | 393 | # print(gdf) |
398 | 394 |
|
399 | 395 | 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" |
401 | 399 | ) |
402 | 400 |
|
403 | 401 | s3_client = boto3.client("s3") |
|
0 commit comments