generic.py

changeset 21
406eb996a9cd
parent 19
4dfa28236785
child 22
a2355e871b23
equal deleted inserted replaced
20:18a77f8065c1 21:406eb996a9cd
234 234
235 input_values = dict(self.dimensions, **self.variables) 235 input_values = dict(self.dimensions, **self.variables)
236 236
237 # Add some mandatory global attributes 237 # Add some mandatory global attributes
238 input_values['Measurement_ID'] = self.info['Measurement_ID'] 238 input_values['Measurement_ID'] = self.info['Measurement_ID']
239 input_values['RawData_Start_Date'] = '\'%s\'' % self.info['start_time'].strftime('%Y%m%d') 239 input_values['RawData_Start_Date'] = self.info['start_time'].strftime('%Y%m%d')
240 input_values['RawData_Start_Time_UT'] = '\'%s\'' % self.info['start_time'].strftime('%H%M%S') 240 input_values['RawData_Start_Time_UT'] = self.info['start_time'].strftime('%H%M%S')
241 input_values['RawData_Stop_Time_UT'] = '\'%s\'' % self.info['stop_time'].strftime('%H%M%S') 241 input_values['RawData_Stop_Time_UT'] = self.info['stop_time'].strftime('%H%M%S')
242 242
243 # Add some optional global attributes 243 # Add some optional global attributes
244 input_values['System'] = params.general_parameters['System'] 244 input_values['System'] = params.general_parameters['System']
245 input_values['Latitude_degrees_north'] = params.general_parameters['Latitude_degrees_north'] 245 input_values['Latitude_degrees_north'] = params.general_parameters['Latitude_degrees_north']
246 input_values['Longitude_degrees_east'] = params.general_parameters['Longitude_degrees_east'] 246 input_values['Longitude_degrees_east'] = params.general_parameters['Longitude_degrees_east']
256 256
257 # Create global attributes 257 # Create global attributes
258 for (attrib,value) in global_att.iteritems(): 258 for (attrib,value) in global_att.iteritems():
259 val = input_values.pop(attrib,value) 259 val = input_values.pop(attrib,value)
260 if val: 260 if val:
261 exec('f.%s = %s' % (attrib,val)) 261 setattr(f, attrib, val)
262 262
263 """ Variables """ 263 """ Variables """
264 # Write the values of fixes channel parameters 264 # Write the values of fixes channel parameters
265 for (var,t) in channel_variables.iteritems(): 265 for (var,t) in channel_variables.iteritems():
266 temp_v = f.createVariable(var,t[1],t[0]) 266 temp_v = f.createVariable(var,t[1],t[0])

mercurial