def save(self, group): grp = get_subgroup(group, self.range()) ds1 = save_object_as_dset(grp, 'begin', data=self.begin()) # dtype='double' ds2 = save_object_as_dset(grp, 'end', data=self.end()) # dtype='double' ds3 = save_object_as_dset(grp, 'range', data=self.range()) # dtype='str' ds4 = save_object_as_dset(grp, 'versdef', data=self._vnum_def) # dtype='int' msg = '=== save(), group %s object for %s' % (grp.name, self.range()) log.debug(msg, self._name) #print 'ZZZ: self.versions()', self.versions() # save/delete objects in/from hdf5 file for k, v in self._dicvers.iteritems(): if k in self._lst_del_keys: delete_object(grp, version_int_to_str(k)) else: v.save(grp) # deletes items from dictionary for k in self._lst_del_keys: del self._dicvers[k] self._lst_del_keys = [] self.save_base(grp)
def _save_pars_dict(self, grp): """Saves _dicpars in the h5py group""" if not self._dicpars: return # skip empty dictionary #grpdic = grp.create_group(self._grp_pars_name) grpdic = get_subgroup(grp, self._grp_pars_name) for k, v in self._dicpars.items(): ds = save_object_as_dset(grpdic, name=k, data=v)
def _save_hystory_dict(self, grp): """Saves _dichist in the h5py group""" if not self._dichist: return # skip empty dictionary #grpdic = grp.create_group(self._grp_history_name) grpdic = get_subgroup(grp, self._grp_history_name) for k, v in self._dichist.items(): #tstamp = str(self.tsec_to_tstr(k)) tstamp = str('%.6f' % k) #print 'XXX:', tstamp, v ds = save_object_as_dset(grpdic, tstamp, data=v)
def save(self, group): grp = get_subgroup(group, self.str_vnum()) # (str) ds1 = save_object_as_dset(grp, 'version', data=self.vnum()) # dtype='int' ds2 = save_object_as_dset(grp, 'tsprod', data=self.tsprod()) # dtype='double' ds3 = save_object_as_dset( grp, 'data', data=self.data()) # dtype='str' or 'np.array' msg = '==== save(), group %s object for version %d' % (grp.name, self.vnum()) log.debug(msg, self._name) self.save_base(grp)
def save(self, group): grp = get_subgroup(group, self.ctype()) ds1 = save_object_as_dset(grp, 'ctype', data=self.ctype()) # dtype='str' msg = '== save(), group %s object for %s' % (grp.name, self.ctype()) log.debug(msg, self._name) # save/delete objects in/from hdf5 file for k, v in self._dicranges.iteritems(): if k in self._lst_del_keys: delete_object(grp, k) else: v.save(grp) # deletes items from dictionary for k in self._lst_del_keys: del self._dicranges[k] self._lst_del_keys = [] self.save_base(grp)