With the new (minor) release of scipy (from 1.10 to 1.11), the following line in subsample.mooring_array fails:
ds.xoak.set_index(["XC", "YC"], 'scipy_kdtree')
whenever the coordinates XC and YC have NANs. This happens in the ECCO (and LLC4320) datasets after transforming a subdomain via cutout, whenever the latitudes (YRange) has values above 70N. oceanspy always calls subsample.cutout before extracting a mooring_array, and in the case ECCO and LLC4320 cutout (via llc_rearrange) it is also a necessary (intermediate) step for removing 'face' as a dimension.
scipy_kdtree is just one of many options within the xoak.index_Registry, but other options also have trouble handling nan-ed coordinates.
For versions of scipy < 1.11, (scipy version 1.11 was released June 25 2023) there is no issue with the problem described above.
Minimal example:
The following is part of oceanspy's testing.
import oceanspy as ospy
# open ECCO locally
ECCO_url = "catalog_ECCO.yaml" # local yaml file that points to ECCO dataset
od = ospy.open_oceandataset.from_catalog("LLC", ECCO_url)
# end points of mooring array
Xmoor = [-80, 0]
Ymoor = [35, 35]
# cutout arguments
args = {
"XRange": None,
"YRange": None,
"add_Hbdr": True,
}
cut_od = od.subsample.cutout(**args)
# visualize cutout
cut_od.plot.horizontal_section(varName='Depth', use_coords=False);
Note that the way XRange and YRange are defined, the entire dataset is transformed before computing the mooring array). The last line plots the variable Depth in index space, seen below
Lastly, the following line errors with scipy version > 1.10.x
pin scipy version to < 1.11. That will allow the PR #377 to go through.
General Fix:
Re-write subsample.mooring_array so that it is optional to call cutout before extracting the mooring, whether or not face is a dimension of the dataset. This approach should be the default when face is a dimension of the dataset. This approach will prevent nan-ed values in the coordinates that result from cutout that incorporates near Arctic data.
Luckily I have already been working on this approach (on a separate branch), and such development/enhancement is in its final stage. I will open a new issue describing this new approach that will be the default when face is a dimension of the dataset.
problem:
With the new (minor) release of scipy (from 1.10 to 1.11), the following line in
subsample.mooring_array
fails:whenever the coordinates
XC
andYC
have NANs. This happens in the ECCO (and LLC4320) datasets aftertransforming
a subdomain via cutout, whenever the latitudes (YRange) has values above 70N. oceanspy always callssubsample.cutout
before extracting amooring_array
, and in the case ECCO and LLC4320 cutout (via llc_rearrange) it is also a necessary (intermediate) step for removing 'face' as a dimension.scipy_kdtree
is just one of many options within thexoak.index_Registry
, but other options also have trouble handling nan-ed coordinates.For versions of
scipy < 1.11
, (scipy version 1.11 was released June 25 2023) there is no issue with the problem described above.Minimal example:
The following is part of oceanspy's testing.
Note that the way XRange and YRange are defined, the entire dataset is transformed before computing the mooring array). The last line plots the variable Depth in index space, seen below
Lastly, the following line errors with
scipy version > 1.10.x
The traceback is:
With
scipy version < 1.11
installed (e.g. version1.10.1
), there is no error and indeed you get the following mooring arrayQuick Fix:
pin scipy version to
< 1.11
. That will allow the PR #377 to go through.General Fix:
Re-write
subsample.mooring_array
so that it is optional to callcutout
before extracting themooring
, whether or notface
is a dimension of the dataset. This approach should be the default whenface
is a dimension of the dataset. This approach will prevent nan-ed values in the coordinates that result from cutout that incorporates near Arctic data.Luckily I have already been working on this approach (on a separate branch), and such development/enhancement is in its final stage. I will open a new issue describing this new approach that will be the default when
face
is a dimension of the dataset.