Skip to content

Commit

Permalink
Update zarr function
Browse files Browse the repository at this point in the history
  • Loading branch information
spestana committed Mar 18, 2024
1 parent dc516da commit 032bdae
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions goes_ortho/get_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def build_zarr(downloadRequest_filepath):

# add time dimension, fix CRS, build zarr file
for variable in variables:
new_image_path_list = add_datetime_crs(new_image_path_list, variable)
new_image_path_list, datetimes_list = add_datetime_crs(new_image_path_list, variable)

# start Dask cluster
client = dask_start_cluster(
Expand All @@ -46,10 +46,11 @@ def build_zarr(downloadRequest_filepath):
)

print(new_image_path_list)
nc_files = sorted(
new_image_path_list,
key=get_start_date_from_abi_filename
)
#nc_files = sorted(
# new_image_path_list,
# key=datetimes_list
#)
nc_files = [img_path for img_dt, img_path in sorted(zip(datetimes_list, new_image_path_list))]
print(nc_files)
# Open all the raster files as a single dataset (combining them together)
# Why did we choose chunks = 500? 100MB?
Expand Down Expand Up @@ -162,7 +163,7 @@ def add_datetime_crs(files, variable, crs='EPSG:4326'):
except Exception as err:
print(f"Failed on {file}")
print(f"Error: {err}")
return new_files
return new_files, datetimes

def parse_json(downloadRequest_filepath):

Expand Down

0 comments on commit 032bdae

Please sign in to comment.