goesgcp 2.0.6__tar.gz → 2.0.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- goesgcp-2.0.8/MANIFEST.in +7 -0
- {goesgcp-2.0.6 → goesgcp-2.0.8}/PKG-INFO +5 -4
- {goesgcp-2.0.6 → goesgcp-2.0.8}/README.md +2 -0
- {goesgcp-2.0.6 → goesgcp-2.0.8}/goesgcp/main.py +72 -4
- {goesgcp-2.0.6 → goesgcp-2.0.8}/goesgcp.egg-info/PKG-INFO +5 -4
- {goesgcp-2.0.6 → goesgcp-2.0.8}/goesgcp.egg-info/SOURCES.txt +3 -1
- goesgcp-2.0.8/pyproject.toml +3 -0
- goesgcp-2.0.8/requirements.txt +5 -0
- {goesgcp-2.0.6 → goesgcp-2.0.8}/setup.py +5 -10
- goesgcp-2.0.6/goesgcp.egg-info/entry_points.txt +0 -2
- {goesgcp-2.0.6 → goesgcp-2.0.8}/LICENSE +0 -0
- {goesgcp-2.0.6 → goesgcp-2.0.8}/goesgcp/__init__.py +0 -0
- {goesgcp-2.0.6 → goesgcp-2.0.8}/goesgcp.egg-info/dependency_links.txt +0 -0
- {goesgcp-2.0.6 → goesgcp-2.0.8}/goesgcp.egg-info/requires.txt +0 -0
- {goesgcp-2.0.6 → goesgcp-2.0.8}/goesgcp.egg-info/top_level.txt +0 -0
- {goesgcp-2.0.6 → goesgcp-2.0.8}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: goesgcp
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.8
|
|
4
4
|
Summary: A package to download and process GOES-16/17 data
|
|
5
5
|
Home-page: https://github.com/helvecioneto/goesgcp
|
|
6
6
|
Author: Helvecio B. L. Neto
|
|
@@ -12,9 +12,8 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
-
Classifier: Topic :: Scientific/Engineering
|
|
16
|
-
Classifier: Topic ::
|
|
17
|
-
Classifier: Topic :: Utilities
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
18
17
|
Description-Content-Type: text/markdown
|
|
19
18
|
License-File: LICENSE
|
|
20
19
|
Requires-Dist: google-cloud-storage
|
|
@@ -36,6 +35,7 @@ Dynamic: summary
|
|
|
36
35
|
<!-- badges: start -->
|
|
37
36
|
[](https://pypi.python.org/pypi/goesgcp)
|
|
38
37
|
[](https://pypi.python.org/pypi/goesgcp)
|
|
38
|
+
[](https://github.com/helvecioneto/goesgcp/actions/workflows/python-publish.yml)
|
|
39
39
|
[](https://github.com/helvecioneto/goesgcp/graphs/contributors)
|
|
40
40
|
[](https://github.com/helvecioneto/goesgcp/blob/main/LICENSE)
|
|
41
41
|
<!-- badges: end -->
|
|
@@ -87,6 +87,7 @@ goesgcp [OPTIONS]
|
|
|
87
87
|
| `--bt_hour` | Hour of the day to download data (default: [0, 1, ..., 23]). |
|
|
88
88
|
| `--bt_minute` | Minute of the hour to download data (default: [0, 15, 30, 45]). |
|
|
89
89
|
| `--save_format` | Format for saving output files (default: `by_date`). |
|
|
90
|
+
| `--remap` | Remap the data based on file (This function are in development). |
|
|
90
91
|
|
|
91
92
|
#### Available GOES Products
|
|
92
93
|
A comprehensive list of available GOES products can be found at the following link: [https://console.cloud.google.com/storage/browser/gcp-public-data-goes-16](https://console.cloud.google.com/storage/browser/gcp-public-data-goes-16)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<!-- badges: start -->
|
|
3
3
|
[](https://pypi.python.org/pypi/goesgcp)
|
|
4
4
|
[](https://pypi.python.org/pypi/goesgcp)
|
|
5
|
+
[](https://github.com/helvecioneto/goesgcp/actions/workflows/python-publish.yml)
|
|
5
6
|
[](https://github.com/helvecioneto/goesgcp/graphs/contributors)
|
|
6
7
|
[](https://github.com/helvecioneto/goesgcp/blob/main/LICENSE)
|
|
7
8
|
<!-- badges: end -->
|
|
@@ -53,6 +54,7 @@ goesgcp [OPTIONS]
|
|
|
53
54
|
| `--bt_hour` | Hour of the day to download data (default: [0, 1, ..., 23]). |
|
|
54
55
|
| `--bt_minute` | Minute of the hour to download data (default: [0, 15, 30, 45]). |
|
|
55
56
|
| `--save_format` | Format for saving output files (default: `by_date`). |
|
|
57
|
+
| `--remap` | Remap the data based on file (This function are in development). |
|
|
56
58
|
|
|
57
59
|
#### Available GOES Products
|
|
58
60
|
A comprehensive list of available GOES products can be found at the following link: [https://console.cloud.google.com/storage/browser/gcp-public-data-goes-16](https://console.cloud.google.com/storage/browser/gcp-public-data-goes-16)
|
|
@@ -2,6 +2,7 @@ import pathlib
|
|
|
2
2
|
import shutil
|
|
3
3
|
import time
|
|
4
4
|
import xarray as xr
|
|
5
|
+
import subprocess
|
|
5
6
|
import argparse
|
|
6
7
|
import sys
|
|
7
8
|
import tqdm
|
|
@@ -269,8 +270,65 @@ def crop_reproject(args):
|
|
|
269
270
|
output_file = f"{output_directory}{file.split('/')[-1]}"
|
|
270
271
|
ds.to_netcdf(output_file, mode='w')
|
|
271
272
|
|
|
273
|
+
# Close the file
|
|
272
274
|
ds.close()
|
|
273
275
|
|
|
276
|
+
return output_file
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def remap_file(args):
|
|
281
|
+
""" Remap the download file based on the input file. """
|
|
282
|
+
|
|
283
|
+
base_file, target_file, var_name, save_format, output = args
|
|
284
|
+
|
|
285
|
+
# Open the files
|
|
286
|
+
base_ds = xr.open_dataset(base_file, engine="netcdf4")
|
|
287
|
+
|
|
288
|
+
if save_format == 'by_date':
|
|
289
|
+
file_datetime = datetime.strptime(ds.time_coverage_start,
|
|
290
|
+
"%Y-%m-%dT%H:%M:%S.%fZ")
|
|
291
|
+
year = file_datetime.strftime("%Y")
|
|
292
|
+
month = file_datetime.strftime("%m")
|
|
293
|
+
day = file_datetime.strftime("%d")
|
|
294
|
+
output_directory = f"{output}{year}/{month}/{day}/"
|
|
295
|
+
elif save_format == 'julian':
|
|
296
|
+
file_datetime = datetime.strptime(ds.time_coverage_start,
|
|
297
|
+
"%Y-%m-%dT%H:%M:%S.%fZ")
|
|
298
|
+
year = file_datetime.strftime("%Y")
|
|
299
|
+
julian_day = file_datetime.timetuple().tm_yday
|
|
300
|
+
output_directory = f"{output}{year}/{julian_day}/"
|
|
301
|
+
else:
|
|
302
|
+
output_directory = output
|
|
303
|
+
|
|
304
|
+
# Create the output directory
|
|
305
|
+
pathlib.Path(output_directory).mkdir(parents=True, exist_ok=True)
|
|
306
|
+
|
|
307
|
+
output_file = f"{output_directory}{target_file.split('/')[-1]}"
|
|
308
|
+
|
|
309
|
+
# Add _ into output_file to prevent overwrite
|
|
310
|
+
output_file = output_file.replace(".nc", "_remap.nc")
|
|
311
|
+
|
|
312
|
+
# Run the cdo command
|
|
313
|
+
cdo_command = [
|
|
314
|
+
"cdo", "remapnn," + base_file, target_file, output_file
|
|
315
|
+
]
|
|
316
|
+
|
|
317
|
+
try:
|
|
318
|
+
subprocess.run(cdo_command, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
319
|
+
except subprocess.CalledProcessError as e:
|
|
320
|
+
print(f"Error remapping file {target_file}: {e}")
|
|
321
|
+
pass
|
|
322
|
+
|
|
323
|
+
# Close the files
|
|
324
|
+
base_ds.close()
|
|
325
|
+
|
|
326
|
+
# Delete the target file
|
|
327
|
+
pathlib.Path(target_file).unlink()
|
|
328
|
+
|
|
329
|
+
# Rename the output file
|
|
330
|
+
pathlib.Path(output_file).rename(target_file)
|
|
331
|
+
|
|
274
332
|
|
|
275
333
|
def process_file(args):
|
|
276
334
|
"""
|
|
@@ -278,7 +336,7 @@ def process_file(args):
|
|
|
278
336
|
"""
|
|
279
337
|
|
|
280
338
|
bucket_name, blob_name, local_path, output_path, var_name, lat_min, lat_max, lon_min, lon_max, resolution, \
|
|
281
|
-
save_format, retries = args
|
|
339
|
+
save_format, retries, remap = args
|
|
282
340
|
|
|
283
341
|
attempt = 0
|
|
284
342
|
while attempt < retries:
|
|
@@ -300,7 +358,13 @@ def process_file(args):
|
|
|
300
358
|
log_file.write(f"Failed to download {blob_name} after {retries} attempts. Error: {e}\n")
|
|
301
359
|
|
|
302
360
|
# Crop the file
|
|
303
|
-
crop_reproject((local_path, output_path, var_name,
|
|
361
|
+
output_file = crop_reproject((local_path, output_path, var_name,
|
|
362
|
+
lat_min, lat_max, lon_min, lon_max, resolution, save_format))
|
|
363
|
+
|
|
364
|
+
# Remap the file
|
|
365
|
+
if remap is not None:
|
|
366
|
+
# Remap the file
|
|
367
|
+
remap_file((remap, output_file, var_name, save_format, output_path))
|
|
304
368
|
|
|
305
369
|
# Remove the local file
|
|
306
370
|
pathlib.Path(local_path).unlink()
|
|
@@ -373,6 +437,9 @@ def main():
|
|
|
373
437
|
parser.add_argument('--resolution', type=float, default=0.03208, help='Resolution of the output file')
|
|
374
438
|
parser.add_argument('--output', type=str, default='output/', help='Path for saving output files')
|
|
375
439
|
|
|
440
|
+
# Remap
|
|
441
|
+
parser.add_argument('--remap', type=str, default=None, help='Give a input file to remap the output')
|
|
442
|
+
|
|
376
443
|
# Other settings
|
|
377
444
|
parser.add_argument('--parallel', type=lambda x: bool(strtobool(x)), default=True, help='Use parallel processing')
|
|
378
445
|
parser.add_argument('--processes', type=int, default=4, help='Number of processes for parallel execution')
|
|
@@ -409,6 +476,7 @@ def main():
|
|
|
409
476
|
bt_hour = args.bt_hour
|
|
410
477
|
bt_min = args.bt_min
|
|
411
478
|
save_format = args.save_format
|
|
479
|
+
remap = args.remap
|
|
412
480
|
|
|
413
481
|
|
|
414
482
|
# Check mandatory arguments
|
|
@@ -466,7 +534,7 @@ def main():
|
|
|
466
534
|
# Create a list of tasks
|
|
467
535
|
tasks = [(bucket_name, file, f"tmp/{file.split('/')[-1]}", output_path, var_name,
|
|
468
536
|
lat_min, lat_max, lon_min, lon_max, resolution,
|
|
469
|
-
save_format, max_attempts) for file in files_list]
|
|
537
|
+
save_format, max_attempts, remap) for file in files_list]
|
|
470
538
|
|
|
471
539
|
# Download files in parallel
|
|
472
540
|
with Pool(processes=args.processes) as pool:
|
|
@@ -478,7 +546,7 @@ def main():
|
|
|
478
546
|
local_path = f"tmp/{file.split('/')[-1]}"
|
|
479
547
|
process_file((bucket_name, file, local_path, output_path, var_name,
|
|
480
548
|
lat_min, lat_max, lon_min, lon_max, resolution,
|
|
481
|
-
save_format, max_attempts))
|
|
549
|
+
save_format, max_attempts, remap))
|
|
482
550
|
loading_bar.update(1)
|
|
483
551
|
loading_bar.close()
|
|
484
552
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: goesgcp
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.8
|
|
4
4
|
Summary: A package to download and process GOES-16/17 data
|
|
5
5
|
Home-page: https://github.com/helvecioneto/goesgcp
|
|
6
6
|
Author: Helvecio B. L. Neto
|
|
@@ -12,9 +12,8 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
-
Classifier: Topic :: Scientific/Engineering
|
|
16
|
-
Classifier: Topic ::
|
|
17
|
-
Classifier: Topic :: Utilities
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
18
17
|
Description-Content-Type: text/markdown
|
|
19
18
|
License-File: LICENSE
|
|
20
19
|
Requires-Dist: google-cloud-storage
|
|
@@ -36,6 +35,7 @@ Dynamic: summary
|
|
|
36
35
|
<!-- badges: start -->
|
|
37
36
|
[](https://pypi.python.org/pypi/goesgcp)
|
|
38
37
|
[](https://pypi.python.org/pypi/goesgcp)
|
|
38
|
+
[](https://github.com/helvecioneto/goesgcp/actions/workflows/python-publish.yml)
|
|
39
39
|
[](https://github.com/helvecioneto/goesgcp/graphs/contributors)
|
|
40
40
|
[](https://github.com/helvecioneto/goesgcp/blob/main/LICENSE)
|
|
41
41
|
<!-- badges: end -->
|
|
@@ -87,6 +87,7 @@ goesgcp [OPTIONS]
|
|
|
87
87
|
| `--bt_hour` | Hour of the day to download data (default: [0, 1, ..., 23]). |
|
|
88
88
|
| `--bt_minute` | Minute of the hour to download data (default: [0, 15, 30, 45]). |
|
|
89
89
|
| `--save_format` | Format for saving output files (default: `by_date`). |
|
|
90
|
+
| `--remap` | Remap the data based on file (This function are in development). |
|
|
90
91
|
|
|
91
92
|
#### Available GOES Products
|
|
92
93
|
A comprehensive list of available GOES products can be found at the following link: [https://console.cloud.google.com/storage/browser/gcp-public-data-goes-16](https://console.cloud.google.com/storage/browser/gcp-public-data-goes-16)
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
2
3
|
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
requirements.txt
|
|
3
6
|
setup.py
|
|
4
7
|
goesgcp/__init__.py
|
|
5
8
|
goesgcp/main.py
|
|
6
9
|
goesgcp.egg-info/PKG-INFO
|
|
7
10
|
goesgcp.egg-info/SOURCES.txt
|
|
8
11
|
goesgcp.egg-info/dependency_links.txt
|
|
9
|
-
goesgcp.egg-info/entry_points.txt
|
|
10
12
|
goesgcp.egg-info/requires.txt
|
|
11
13
|
goesgcp.egg-info/top_level.txt
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
import os
|
|
2
3
|
|
|
3
4
|
try:
|
|
@@ -17,7 +18,7 @@ else:
|
|
|
17
18
|
|
|
18
19
|
setup(
|
|
19
20
|
name="goesgcp",
|
|
20
|
-
version=
|
|
21
|
+
version="2.0.8",
|
|
21
22
|
author="Helvecio B. L. Neto",
|
|
22
23
|
author_email="helvecioblneto@gmail.com",
|
|
23
24
|
description="A package to download and process GOES-16/17 data",
|
|
@@ -34,13 +35,7 @@ setup(
|
|
|
34
35
|
"Programming Language :: Python :: 3.10",
|
|
35
36
|
"Programming Language :: Python :: 3.11",
|
|
36
37
|
"Programming Language :: Python :: 3.12",
|
|
37
|
-
|
|
38
|
-
"Topic ::
|
|
39
|
-
|
|
40
|
-
],
|
|
41
|
-
entry_points={
|
|
42
|
-
'console_scripts': [
|
|
43
|
-
'goesgcp=goesgcp.main:main',
|
|
44
|
-
],
|
|
45
|
-
},
|
|
38
|
+
"Topic :: Scientific/Engineering :: Atmospheric Science",
|
|
39
|
+
"Topic :: Scientific/Engineering :: GIS"
|
|
40
|
+
]
|
|
46
41
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|