File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 27
27
28
28
# -------------------------------------------------------
29
29
class Indexing (object ):
30
- def __init__ (self , nc , vname ):
31
- ncvar = nc .variables [vname ]
32
- self .base = ncvar .base
33
- self .extent = ncvar .extent
34
- self .indices = ncvar .indices
30
+ def __init__ (self , base , extent , indices ):
31
+ self .base = np .array (base )
32
+ self .extent = np .array (extent )
33
+ self .indices = np .array (indices )
35
34
36
35
# Turn it all into Numpy arrays
37
36
if not isinstance (self .base , np .ndarray ):
@@ -86,7 +85,13 @@ def index_to_tuple(self, ix):
86
85
87
86
tpl [self .indices [self .rank - 1 ]] = ix
88
87
return tuple (tpl )
89
-
88
+ # -------------------------------------------------------
89
+ def read_nc_indexing (nc , vname ):
90
+ ncvar = nc .variables [vname ]
91
+ base = ncvar .base
92
+ extent = ncvar .extent
93
+ indices = ncvar .indices
94
+ return Indexing (base ,extent ,indices )
90
95
91
96
# -------------------------------------------------------
92
97
class Vertex (object ):
You can’t perform that action at this time.
0 commit comments