@@ -293,7 +293,7 @@ def __init__(
293
293
self .interpolators = dict ()
294
294
if centered is None :
295
295
logger .warning (
296
- "We assume the position of grid is the center corner for %s" , filename ,
296
+ "We assume pixel position of grid is center for %s" , filename ,
297
297
)
298
298
if not unset :
299
299
self .load_general_features ()
@@ -1062,6 +1062,7 @@ def _low_filter(self, grid_name, w_cut, factor=8.0):
1062
1062
self .coordinates [0 ]: x_array [:- 1 ],
1063
1063
self .coordinates [1 ]: y_array [:- 1 ],
1064
1064
},
1065
+ centered = False ,
1065
1066
)
1066
1067
regular_grid .bessel_low_filter (grid_name , w_cut , order = 1 )
1067
1068
z_filtered = regular_grid .grid (grid_name )
@@ -1113,13 +1114,26 @@ def setup_coordinates(self):
1113
1114
self ._y_step = (self .y_c [1 :] - self .y_c [:- 1 ]).mean ()
1114
1115
1115
1116
@classmethod
1116
- def with_array (cls , coordinates , datas ):
1117
+ def with_array (cls , coordinates , datas , variables_description = None , ** kwargs ):
1117
1118
x_name , y_name = coordinates [0 ], coordinates [1 ]
1118
- obj = cls ("array" , x_name , y_name , unset = True , centered = False )
1119
+ obj = cls ("array" , x_name , y_name , unset = True , ** kwargs )
1119
1120
obj .x_dim = (x_name ,)
1120
1121
obj .y_dim = (y_name ,)
1122
+ obj .variables_description = dict ()
1123
+ obj .dimensions = {i : v .shape [0 ] for i , v in datas .items () if i in coordinates }
1121
1124
for k , v in datas .items ():
1122
1125
obj .vars [k ] = v
1126
+ obj .variables_description [k ] = dict (
1127
+ attrs = variables_description .get (k , dict ()),
1128
+ args = (k , v .dtype ),
1129
+ kwargs = dict (
1130
+ dimensions = coordinates if k not in coordinates else (k ,),
1131
+ complevel = 1 ,
1132
+ zlib = True ,
1133
+ ),
1134
+ infos = dict (),
1135
+ )
1136
+ obj .global_attrs = dict (history = "Grid setup with an array" )
1123
1137
obj .setup_coordinates ()
1124
1138
return obj
1125
1139
0 commit comments