Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion python/ctsm/crop_calendars/generate_gdd20_baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,9 @@ def generate_gdd20_baseline(input_files, output_file, author, variable, year_arg
ds_out[var_out] = grid_one_variable(ds_out, var_out)

# Save
ds_out.to_netcdf(output_file, format="NETCDF3_CLASSIC", encoding=encoding_dict)
output_dir = os.path.dirname(output_file)
os.makedirs(output_dir, exist_ok=True)
ds_out.to_netcdf(output_file, format="NETCDF4_CLASSIC", encoding=encoding_dict)

print("Done!")

Expand Down
4 changes: 2 additions & 2 deletions python/ctsm/crop_calendars/generate_gdds.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def save_gdds(sdates_file, hdates_file, outfile, gdd_maps_ds, sdates_rx):
for var in template_ds:
if "sdate" in var:
template_ds = template_ds.drop(var)
template_ds.to_netcdf(path=outfile, format="NETCDF3_CLASSIC")
template_ds.to_netcdf(path=outfile, format="NETCDF4_CLASSIC")
template_ds.close()

# Add global attributes
Expand All @@ -332,7 +332,7 @@ def save_gdds(sdates_file, hdates_file, outfile, gdd_maps_ds, sdates_rx):
gdd_maps_ds["time_bounds"] = sdates_rx.time_bounds

# Save cultivar GDDs
gdd_maps_ds.to_netcdf(outfile, mode="w", format="NETCDF3_CLASSIC")
gdd_maps_ds.to_netcdf(outfile, mode="w", format="NETCDF4_CLASSIC")

save_gdds(sdates_file, hdates_file, outfile, gdd_maps_ds, sdates_rx)

Expand Down
2 changes: 1 addition & 1 deletion python/ctsm/crop_calendars/interpolate_gdds.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

logger = logging.getLogger(__name__)

OUTPUT_FORMAT = "NETCDF3_CLASSIC"
OUTPUT_FORMAT = "NETCDF4_CLASSIC"


def _file_missing(filepath, descriptor):
Expand Down
2 changes: 1 addition & 1 deletion python/ctsm/crop_calendars/process_ggcmi_shdates.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ def process_ggcmi_shdates(

# Save
logger.info(" Saving %s...", varname_ggcmi)
thisvar_da.to_netcdf(file_clm, mode="a", format="NETCDF3_CLASSIC")
thisvar_da.to_netcdf(file_clm, mode="a", format="NETCDF4_CLASSIC")

cropcal_ds.close()

Expand Down
2 changes: 1 addition & 1 deletion python/ctsm/modify_input_files/modify_fsurdat.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def write_output(self, fsurdat_in, fsurdat_out):
abort(errmsg)

# mode 'w' overwrites file if it exists
self.file.to_netcdf(path=fsurdat_out, mode="w", format="NETCDF3_64BIT")
self.file.to_netcdf(path=fsurdat_out, mode="w", format="NETCDF4_CLASSIC")
logger.info("Successfully created fsurdat_out: %s", fsurdat_out)
self.file.close()

Expand Down
2 changes: 1 addition & 1 deletion python/ctsm/site_and_regional/base_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def write_to_netcdf(self, xr_ds, nc_fname):
"""
if not os.path.exists(nc_fname) or self.overwrite:
# mode 'w' overwrites file
xr_ds.to_netcdf(path=nc_fname, mode="w", format="NETCDF3_64BIT")
xr_ds.to_netcdf(path=nc_fname, mode="w", format="NETCDF4_CLASSIC")
else:
err_msg = (
"File "
Expand Down
2 changes: 1 addition & 1 deletion python/ctsm/site_and_regional/modify_singlept_site_neon.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,6 @@ def main():
f_2 = update_metadata(f_2, surf_file, neon_file, zb_flag)

print(f_2.attrs)
f_2.to_netcdf(path=wfile, mode="w", format="NETCDF3_64BIT")
f_2.to_netcdf(path=wfile, mode="w", format="NETCDF4_CLASSIC")

print("Successfully updated surface data file for neon site(" + site_name + "):\n - " + wfile)
2 changes: 1 addition & 1 deletion python/ctsm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def write_output(file, file_in, file_out, file_type):
)

# mode 'w' overwrites file if it exists
file.to_netcdf(path=file_out, mode="w", format="NETCDF3_64BIT")
file.to_netcdf(path=file_out, mode="w", format="NETCDF4_CLASSIC")
logger.info("Successfully created: %s", file_out)
file.close()

Expand Down
Loading