Created
March 22, 2018 20:23
-
-
Save ironhouzi/0c6caa0d4ec42b6e8cea84de89ec0ef3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [41]: lon[250][145] | |
Out[41]: 34.34894069196243 | |
In [42]: mlon = np.full(lon.shape, lon[250][145], dtype=np.float64) | |
In [43]: lat[250][145] | |
Out[43]: 49.475985060839555 | |
In [44]: mlat = np.full(lat.shape, lat[250][145], dtype=np.float64) | |
In [45]: idx = (lon == mlon) & (lat == mlat) | |
In [46]: idx | |
Out[46]: | |
masked_array( | |
data=[[--, --, --, ..., --, --, --], | |
[--, --, --, ..., --, --, --], | |
[--, --, --, ..., --, --, --], | |
..., | |
[False, False, False, ..., False, False, False], | |
[False, False, False, ..., False, False, False], | |
[False, False, False, ..., False, False, False]], | |
mask=[[ True, True, True, ..., True, True, True], | |
[ True, True, True, ..., True, True, True], | |
[ True, True, True, ..., True, True, True], | |
..., | |
[False, False, False, ..., False, False, False], | |
[False, False, False, ..., False, False, False], | |
[False, False, False, ..., False, False, False]], | |
fill_value=9999.0) | |
In [47]: np.any(idx) | |
Out[47]: True | |
In [48]: lonres = lon[mlon] | |
--------------------------------------------------------------------------- | |
IndexError Traceback (most recent call last) | |
<ipython-input-48-fccd77f0e7ac> in <module>() | |
----> 1 lonres = lon[mlon] | |
~/code/scene_extractor/venv/lib/python3.6/site-packages/numpy/ma/core.py in __getitem__(self, indx) | |
3195 # mask of being reshaped if it hasn't been set up properly yet | |
3196 # So it's easier to stick to the current version | |
-> 3197 dout = self.data[indx] | |
3198 _mask = self._mask | |
3199 | |
IndexError: arrays used as indices must be of integer (or boolean) type |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment