Skip to content

Commit

Permalink
fixed lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
piyushingale01 committed Dec 1, 2023
1 parent 62ebb1d commit 0538cf8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions weather_mv/loader_pipeline/ee.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def convert_to_asset(self, queue: Queue, uri: str):
def get_dims_data(index: int) -> t.List[t.Any]:
"""Returns dimensions for the given flattened index."""
return [
dim[int(index / math.prod(dims_shape[i+1:])) % len(dim)] for (i, dim) in enumerate(dims_data)
dim[int(index/math.prod(dims_shape[i+1:])) % len(dim)] for (i, dim) in enumerate(dims_data)
]

# Copy CSV to gcs.
Expand All @@ -548,7 +548,9 @@ def get_dims_data(index: int) -> t.List[t.Any]:
# Write rows in batches.
for i in range(0, shape, ROWS_PER_WRITE):
writer.writerows(
[get_dims_data(i) + list(row) for row in zip(*[d[i:i + ROWS_PER_WRITE] for d in data])]
[get_dims_data(i) + list(row) for row in zip(
*[d[i:i + ROWS_PER_WRITE] for d in data]
)]
)

upload(temp.name, target_path)
Expand Down
8 changes: 4 additions & 4 deletions weather_mv/loader_pipeline/sinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ def open_dataset(uri: str,
with open_local(uri) as local_path:
_, uri_extension = os.path.splitext(uri)

xr_dataset: xr.Dataset = __open_dataset_file(local_path,
xr_datasets: xr.Dataset = __open_dataset_file(local_path,
uri_extension,
disable_grib_schema_normalization,
local_open_dataset_kwargs,
Expand All @@ -703,19 +703,19 @@ def open_dataset(uri: str,

logger.info(f'opened dataset size: {total_size_in_bytes}')
else:
xr_dataset = xr_datasets
if start_date is not None and end_date is not None:
xr_dataset = xr_dataset.sel(time=slice(start_date, end_date))
if uri_extension in ['.tif', '.tiff']:
xr_dataset = _preprocess_tif(xr_datasets,
xr_dataset = _preprocess_tif(xr_dataset,
local_path,
tif_metadata_for_start_time,
tif_metadata_for_end_time,
uri,
band_names_dict,
initialization_time_regex,
forecast_time_regex)
else:
xr_dataset = xr_datasets

xr_dataset.attrs.update({'dtype': dtype, 'crs': crs, 'transform': transform})
logger.info(f'opened dataset size: {xr_dataset.nbytes}')

Expand Down

0 comments on commit 0538cf8

Please sign in to comment.