goesgcp 2.1.0__tar.gz → 2.1.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: goesgcp
3
- Version: 2.1.0
3
+ Version: 2.1.1
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
@@ -280,20 +280,20 @@ def crop_reproject(args):
280
280
  def remap_file(args):
281
281
  """ Remap the download file based on the input file. """
282
282
 
283
- base_file, target_file, var_name, save_format, output = args
283
+ base_file, target_file, var_name, save_format, output, method = args
284
284
 
285
285
  # Open the files
286
286
  base_ds = xr.open_dataset(base_file, engine="netcdf4")
287
287
 
288
288
  if save_format == 'by_date':
289
- file_datetime = datetime.strptime(ds.time_coverage_start,
289
+ file_datetime = datetime.strptime(base_ds.time_coverage_start,
290
290
  "%Y-%m-%dT%H:%M:%S.%fZ")
291
291
  year = file_datetime.strftime("%Y")
292
292
  month = file_datetime.strftime("%m")
293
293
  day = file_datetime.strftime("%d")
294
294
  output_directory = f"{output}{year}/{month}/{day}/"
295
295
  elif save_format == 'julian':
296
- file_datetime = datetime.strptime(ds.time_coverage_start,
296
+ file_datetime = datetime.strptime(base_ds.time_coverage_start,
297
297
  "%Y-%m-%dT%H:%M:%S.%fZ")
298
298
  year = file_datetime.strftime("%Y")
299
299
  julian_day = file_datetime.timetuple().tm_yday
@@ -311,7 +311,7 @@ def remap_file(args):
311
311
 
312
312
  # Run the cdo command
313
313
  cdo_command = [
314
- "cdo", "remapnn," + base_file, target_file, output_file
314
+ "cdo", method+"," + base_file, target_file, output_file
315
315
  ]
316
316
 
317
317
  try:
@@ -336,7 +336,7 @@ def process_file(args):
336
336
  """
337
337
 
338
338
  bucket_name, blob_name, local_path, output_path, var_name, lat_min, lat_max, lon_min, lon_max, resolution, \
339
- save_format, retries, remap = args
339
+ save_format, retries, remap, met = args
340
340
 
341
341
  attempt = 0
342
342
  while attempt < retries:
@@ -364,7 +364,7 @@ def process_file(args):
364
364
  # Remap the file
365
365
  if remap is not None:
366
366
  # Remap the file
367
- remap_file((remap, output_file, var_name, save_format, output_path))
367
+ remap_file((remap, output_file, var_name, save_format, output_path, met))
368
368
 
369
369
  # Remove the local file
370
370
  pathlib.Path(local_path).unlink()
@@ -434,11 +434,13 @@ def main():
434
434
  parser.add_argument('--lat_max', type=float, default=81.3282, help='Maximum latitude of the bounding box')
435
435
  parser.add_argument('--lon_min', type=float, default=-156.2995, help='Minimum longitude of the bounding box')
436
436
  parser.add_argument('--lon_max', type=float, default=6.2995, help='Maximum longitude of the bounding box')
437
- parser.add_argument('--resolution', type=float, default=0.03208, help='Resolution of the output file')
437
+ parser.add_argument('--resolution', type=float, default=0.01, help='Resolution of the output file')
438
438
  parser.add_argument('--output', type=str, default='output/', help='Path for saving output files')
439
439
 
440
440
  # Remap
441
441
  parser.add_argument('--remap', type=str, default=None, help='Give a input file to remap the output')
442
+ parser.add_argument('--method', type=str, default='remapnn', help='Remap method to use (e.g., remapnn)')
443
+
442
444
 
443
445
  # Other settings
444
446
  parser.add_argument('--parallel', type=lambda x: bool(strtobool(x)), default=True, help='Use parallel processing')
@@ -477,6 +479,7 @@ def main():
477
479
  bt_min = args.bt_min
478
480
  save_format = args.save_format
479
481
  remap = args.remap
482
+ method = args.method
480
483
 
481
484
 
482
485
  # Check mandatory arguments
@@ -510,8 +513,8 @@ def main():
510
513
  # Check operational mode if is recent or specific date
511
514
  if start and end:
512
515
  files_list = get_files_period(storage_client, bucket_name,
513
- product, pattern, start, end,
514
- bt_hour, bt_min, freq)
516
+ product, pattern, start, end,
517
+ bt_hour, bt_min, freq)
515
518
  else:
516
519
  # Get recent files
517
520
  files_list = get_recent_files(storage_client, bucket_name, product, pattern, recent)
@@ -534,7 +537,7 @@ def main():
534
537
  # Create a list of tasks
535
538
  tasks = [(bucket_name, file, f"tmp/{file.split('/')[-1]}", output_path, var_name,
536
539
  lat_min, lat_max, lon_min, lon_max, resolution,
537
- save_format, max_attempts, remap) for file in files_list]
540
+ save_format, max_attempts, remap, method) for file in files_list]
538
541
 
539
542
  # Download files in parallel
540
543
  with Pool(processes=args.processes) as pool:
@@ -546,7 +549,7 @@ def main():
546
549
  local_path = f"tmp/{file.split('/')[-1]}"
547
550
  process_file((bucket_name, file, local_path, output_path, var_name,
548
551
  lat_min, lat_max, lon_min, lon_max, resolution,
549
- save_format, max_attempts, remap))
552
+ save_format, max_attempts, remap, method))
550
553
  loading_bar.update(1)
551
554
  loading_bar.close()
552
555
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: goesgcp
3
- Version: 2.1.0
3
+ Version: 2.1.1
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
@@ -18,7 +18,7 @@ else:
18
18
 
19
19
  setup(
20
20
  name="goesgcp",
21
- version="2.1.0",
21
+ version="2.1.1",
22
22
  author="Helvecio B. L. Neto",
23
23
  author_email="helvecioblneto@gmail.com",
24
24
  description="A package to download and process GOES-16/17 data",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes