Skip to content

Commit

Permalink
fix nc write bug
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanLaserGit committed Oct 1, 2024
1 parent cc52725 commit 0feac09
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion forcingprocessor/src/forcingprocessor/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def write_data(
bandwidth_Mbps = rate * file_size_MB * ntasked * bytes2bits
estimate_total_time = nfiles * ntasked / rate
report_usage()
msg = f"\n{(j+1)*ntasked} files written out of {nfiles*ntasked}\n"
msg = f"\n{(j+1)*ntasked} dataframes converted out of {nfiles*ntasked}\n"
msg += f"rate {rate:.2f} files/s\n"
msg += f"df conversion {t_df:.2f}s\n"
if storage_type == "s3": msg += f"buff {t_buff:.2f}s\n"
Expand Down Expand Up @@ -584,6 +584,7 @@ def write_netcdf(data, vpu, t_ax, catchments):

if storage_type == 's3':
bucket, key = convert_url2key(nc_filename,s3_client)
key = key[:-1]
with tempfile.NamedTemporaryFile(suffix='.nc') as tmpfile:
with nc.Dataset(tmpfile, 'w', format='NETCDF4') as ds:
catchment_dim = ds.createDimension('catchment-id', len(catchments))
Expand Down

0 comments on commit 0feac09

Please sign in to comment.