@@ -141,63 +141,6 @@ def is_dim_consistent(self):
141141 else :
142142 return True
143143
144- def search_time_in_vars (self ):
145- """Check all vars for specific time variables associated with them"""
146- tvars = set ()
147- for v in self .variables :
148- try :
149- tvars .add (self .variables [v ]['attributes' ]['time' ]['value' ])
150- except KeyError :
151- pass
152-
153- isnone = tvars == set ()
154- if isnone :
155- return None
156- else :
157- return tvars
158-
159- def change_time (self , var , timevar ):
160- """Change the time dimension associated with variable :var:
161- :var: a list or str
162- Ex: 'zeta'
163- ['zeta','u']
164- ['u','v']
165- ['Ptracer1','Ptracer2']
166- :timevar: a list or str
167- Ex: 'bry_time'
168- ['zeta_time','uv_time']
169- ['uv_time']
170- ['ptime1','ptime2']
171- """
172-
173- if var .__class__ is str :
174- var = [var ]
175- if timevar .__class__ is str :
176- timevar = [timevar ]
177-
178- if len (var ) == 1 and len (timevar ) > 1 :
179- raise ValueError ('Invalid input' )
180- elif len (var ) > 1 and len (timevar ) == 1 :
181- timevar = [timevar for x in range (len (var ))]
182-
183- for v , t in zip (var , timevar ):
184- vargroup = set (self .variables .keys ())
185- dimgroup = set (self .dimensions .keys ())
186- v_included = v in vargroup
187- t_included = t in vargroup and t in dimgroup
188-
189- # varname should match dimname for time info
190- if not t_included :
191- raise ValueError ('Time variable:' , t , 'not present!' )
192- if not v_included :
193- for k in self .variables .keys ():
194- if v in k :
195- self .variables [k ]['dimensions' ][0 ] = t
196- self .variables [k ]['attributes' ]['time' ]['value' ] = t
197- else :
198- self .variables [v ]['dimensions' ][0 ] = t
199- self .variables [v ]['attributes' ]['time' ]['value' ] = t
200-
201144 @classmethod
202145 def check_var (cls , vardict , name = None ):
203146 """ Check if the dictionary have all the required fields
0 commit comments