parcels icon indicating copy to clipboard operation
parcels copied to clipboard

Unreliable `Field.fieldtype` constant

Open VeckoTheGecko opened this issue 5 months ago • 2 comments

In the Field constructor:

https://github.com/OceanParcels/Parcels/blob/5fff42c2ea4cc12d03df8c936dd391e251658c8f/parcels/field.py#L106-L107

However the underlying behaviour looks to be a bit different.

https://github.com/OceanParcels/Parcels/blob/5fff42c2ea4cc12d03df8c936dd391e251658c8f/parcels/field.py#L198

This leads to strange stuff like:

>>> field = Field("newfld", fieldset.U.data, lon=fieldset.U.lon, lat=fieldset.U.lat)
>>> fieldset.add_field(field)
>>> print(fieldset.newfld.fieldtype)
"newfld"

I don't think this is a bug per-se (doubt it affects interpolation), but it is worth cleaning up to be None in this case.

VeckoTheGecko avatar Sep 05 '24 13:09 VeckoTheGecko