Closed Vandoo closed 3 years ago
It's expected that geometrical functions like to_field_aligned aren't available if you load with geometry=None
. I think the main issue is that if you:
1) load using open_boutdataset
with geometry=None
(or no geometry
argument)
2) save the Dataset to a netCDF file
3) open that netCDF file using open_boutdataset()
then even if you pass geometry="toroidal"
in step (3), you won't get toroidal geometry applied because when reloading an xBOUT-saved dataset, open_boutdataset
short-cuts because it assumes that the coordinates, etc. have already been created and saved. The current workaround for this would be to call the apply_geometry()
function after opening the Dataset [editing the title now to reflect this explanation]
Options for resolving this:
i) if a geometry
argument is passed in step (3), print a warning that it's being ignored and suggest using apply_geometry()
.
ii) if a geometry
argument is passed in (3) then call apply_geometry()
within open_boutdataset()
- it should always be OK to do this, because apply_geometry()
has been designed to work correctly when applied several times (as this was needed for re-creating regions at various points).
I think option (ii) is probably the way to go. Anyone else have an opinion?
open_boutdadaset() requires the option geometry="toroidal", etc. to put zShift array in the coordinates. Otherwise it prevents other manipulations on the data, such as bout.to_field_aligned().