@@ -27,7 +27,6 @@ def __init__(self,
2727 dimensions = None ,
2828 variables = None ,
2929 global_attributes = None ,
30- title = 'NetCDFGroupDict' ,
3130 ** kwargs ):
3231 """ A dictionary to hold netCDF groups
3332 It consist of a generic class holding 3 different dictionaries:
@@ -59,33 +58,21 @@ def __init__(self,
5958 self ._variables = None
6059 self ._global_attributes = None
6160
62- self .title = title
6361 self .dimensions = dimensions or OrderedDict ()
6462 self .variables = variables or OrderedDict ()
6563 self .global_attributes = global_attributes or OrderedDict ()
6664
67- if self .is_dim_consistent :
68- self .rdimensions = dict ((x , True ) if y is - 1 else (x , False )
69- for x , y in zip (self .dimensions .keys (),
70- self .dimensions .values ()))
71- else :
65+ if not self .is_dim_consistent ():
7266 raise TypeError ("Correct the dimensions." )
7367
74- notstr = self .title .__class__ is not str
75- if notstr :
76- raise TypeError ("Title is not a str object" )
77-
78- self .check_dims (self .dimensions )
7968 self .check_var (self .variables )
80- self .check_global_attributes (self .global_attributes )
8169 self .check_consistency (self .dimensions , self .variables )
8270
8371 def __add__ (self , other ):
8472 self_copy = deepcopy (self )
8573 self_copy .dimensions .update (other .dimensions )
8674 self_copy .variables .update (other .variables )
8775 self_copy .global_attributes .update (other .global_attributes )
88- self_copy .title = "{t1} + {t2}" .format (t1 = self .title , t2 = other .title )
8976 return self_copy
9077
9178 @property
@@ -161,7 +148,7 @@ def search_time_in_vars(self):
161148 try :
162149 tvars .add (self .variables [v ]['attributes' ]['time' ]['value' ])
163150 except KeyError :
164- None
151+ pass
165152
166153 isnone = tvars == set ()
167154 if isnone :
@@ -212,16 +199,8 @@ def change_time(self, var, timevar):
212199 self .variables [v ]['attributes' ]['time' ]['value' ] = t
213200
214201 @classmethod
215- def check_dims (self , dimdict ):
216- """ Check the dictionary """
217- for d in dimdict :
218- notint = dimdict [d ].__class__ is not int
219- if notint :
220- ValueError ("Dimension %s is not an integer object" % d )
221-
222- @classmethod
223- def check_var (self , vardict , name = None ):
224- """ Check if the dictionary have all the reuqired fields
202+ def check_var (cls , vardict , name = None ):
203+ """ Check if the dictionary have all the required fields
225204 to be defined as variable"""
226205 if name is None :
227206 name = 'input'
@@ -235,7 +214,7 @@ def check_var(self, vardict, name=None):
235214
236215 if have_none :
237216 for k in vkeys :
238- self .check_var (vardict [k ], name = k )
217+ cls .check_var (vardict [k ], name = k )
239218
240219 if have_dims :
241220 notnone = vardict ['dimensions' ] is not None
@@ -257,14 +236,6 @@ def check_var(self, vardict, name=None):
257236 ValueError (
258237 "Type for %s should be a string or type object" % name )
259238
260- @classmethod
261- def check_global_attributes (self , gadict ):
262- """ Check the dictionary """
263- for g in gadict :
264- notstr = gadict [g ].__class__ is not str
265- if notstr :
266- ValueError ("Global Attr %s is not an integer object" % g )
267-
268239 @classmethod
269240 def check_consistency (self , dimdict , vdict ):
270241 """ Check the dictionary """
0 commit comments