Open RichardScottOZ opened 2 days ago
subbing the North America file in gets this...
KeyError Traceback (most recent call last)
File ~/miniconda3/envs/sdm/lib/python3.12/site-packages/pandas/core/indexes/base.py:3805, in Index.get_loc(self, key)
3804 try:
-> 3805 return self._engine.get_loc(casted_key)
3806 except KeyError as err:
File index.pyx:167, in pandas._libs.index.IndexEngine.get_loc()
File index.pyx:196, in pandas._libs.index.IndexEngine.get_loc()
File pandas/_libs/hashtable_class_helper.pxi:7081, in pandas._libs.hashtable.PyObjectHashTable.get_item()
File pandas/_libs/hashtable_class_helper.pxi:7089, in pandas._libs.hashtable.PyObjectHashTable.get_item()
KeyError: 'present_lon'
The above exception was the direct cause of the following exception:
KeyError Traceback (most recent call last)
Cell In[14], line 7
2 ylims = (13, 73)
4 time_windows = ((60, 80), (40, 60))
6 df_clipped = df[
----> 7 (df["present_lon"] >= xlims[0])
8 & (df["present_lon"] <= xlims[1])
9 & (df["present_lat"] >= ylims[0])
10 & (df["present_lat"] <= ylims[1])
11 ].copy()
13 df_clipped = gpd.GeoDataFrame(
14 df_clipped,
15 geometry=gpd.points_from_xy(
(...)
19 crs=coastlines.crs,
20 )
21 df_clipped = gpd.clip(df_clipped, coastlines)
File ~/miniconda3/envs/sdm/lib/python3.12/site-packages/pandas/core/frame.py:4102, in DataFrame.__getitem__(self, key)
4100 if self.columns.nlevels > 1:
4101 return self._getitem_multilevel(key)
-> 4102 indexer = self.columns.get_loc(key)
4103 if is_integer(indexer):
4104 indexer = [indexer]
File ~/miniconda3/envs/sdm/lib/python3.12/site-packages/pandas/core/indexes/base.py:3812, in Index.get_loc(self, key)
3807 if isinstance(casted_key, slice) or (
3808 isinstance(casted_key, abc.Iterable)
3809 and any(isinstance(x, slice) for x in casted_key)
3810 ):
3811 raise InvalidIndexError(key)
-> 3812 raise KeyError(key) from err
3813 except TypeError:
3814 # If we have a listlike key, _check_indexing_error will raise
3815 # InvalidIndexError. Otherwise we fall through and re-raise
3816 # the TypeError.
3817 self._check_indexing_error(key)
KeyError: 'present_lon'
This looks like a case - given the zip reference
of lifting one the outputs from a deeper file path in the previous runs to use - the Americas version?