We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d962b01 commit fdc7dfeCopy full SHA for fdc7dfe
isimip_files_api/netcdf.py
@@ -2,6 +2,7 @@
2
3
from .settings import RESOLUTIONS
4
5
+
6
def open_dataset(path):
7
return Dataset(path)
8
@@ -21,11 +22,7 @@ def get_index(path, point):
21
22
dx = ds.variables['lon'][1] - ds.variables['lon'][0]
23
dy = ds.variables['lat'][1] - ds.variables['lat'][0]
24
- ix = int((lon - ds.variables['lon'][0]) / dx)
25
-
26
- if dy > 0:
27
- iy = int((lat - ds.variables['lat'][0]) / dy)
28
- else:
29
- iy = int((ds.variables['lat'][0] - lat) / -dy)
+ ix = round((lon - ds.variables['lon'][0]) / dx)
+ iy = round((lat - ds.variables['lat'][0]) / dy)
30
31
return ix, iy
0 commit comments