Skip to content
Merged
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion parcels/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ def from_netcdf(
kwargs["data_full_zdim"] = data_full_zdim

if len(data_filenames) > 1 and "time" not in dimensions and timestamps is None:
raise RuntimeError("Multiple files given but no time dimension specified")
warnings.warn("Multiple files given but no time dimension specified", FieldSetWarning, stacklevel=2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
warnings.warn("Multiple files given but no time dimension specified", FieldSetWarning, stacklevel=2)
warnings.warn("Multiple files given but no time dimension specified. See https://github.com/OceanParcels/Parcels/issues/1831 for more info.", FieldSetWarning, stacklevel=2)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, on second thought, perhaps linkint to the issue would be confusing - I'm not sure in which scenarios people would be expected to see the error message ....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm not sure linking to the issue is necessary here. Prior to the implementation of the CROCO model support, which relies on parameters like Cs_w and H that don't change in time and was the original source of issues, the error would have caught someone using multiple velocity files (perhaps each intended to each be a different time), but without a time dimension in the files themselves, which does seems like it would be a rare edge case.

A potential alternative that would leave that error in place would be to add on to the if statement a condition that excludes only the fields names (self.name?) used by the CROCO advection (H, Cs_w, and zeta). But I thought just keeping it simple and swapping to a warning is also fine, since this is all an admittedly niche use case.


if grid is None:
# Concatenate time variable to determine overall dimension
Expand Down
Loading