Skip to content

Commit 6d12f21

Browse files
committed
Fix from_sgrid_conventions
Avoid assuming there's a U and V field. Maybe this should be refactored later...
1 parent 4e2f815 commit 6d12f21

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/parcels/_core/fieldset.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,10 @@ def from_sgrid_conventions(
386386

387387
fieldset = FieldSet(list(fields.values()))
388388
if mesh == "spherical":
389-
fieldset.U.units = GeographicPolar()
390-
fieldset.V.units = Geographic()
389+
if "U" in fieldset.fields:
390+
fieldset.U.units = GeographicPolar()
391+
if "V" in fieldset.fields:
392+
fieldset.V.units = Geographic()
391393

392394
return fieldset
393395

0 commit comments

Comments
 (0)