def main(): args = sys.argv[1:] if len(args) == 0: print '\n\tError - no station name given\n' return lo_stations = args[0] try: lo_stations = lo_stations.split(',') lo_stations = [i.upper() for i in lo_stations] except: print 'Error - station name list could not be read!' print '(Must be comma-separated list...no whitespaces)\n' outfile = op.abspath(op.join(os.curdir, 'dummy_survey.cfg')) outfile = MTfh.make_unique_filename(outfile) survey_dict = {} for st in lo_stations: tmp_dict = {} for idx_r, req in enumerate(MTcf.list_of_required_keywords): tmp_dict[req] = MTcf.list_of_keyword_defaults_general[idx_r] for idx_e, efield in enumerate(MTcf.list_of_efield_keywords): tmp_dict[efield] = MTcf.list_of_keyword_defaults_efield[idx_e] for idx_b, bfield in enumerate(MTcf.list_of_bfield_keywords): tmp_dict[bfield] = MTcf.list_of_keyword_defaults_bfield[idx_b] survey_dict[st] = tmp_dict MTcf.write_dict_to_configfile(survey_dict, outfile)
def main(): args = sys.argv[1:] if len(args) == 0 : print '\n\tError - no station name given\n' return lo_stations = args[0] try: lo_stations = lo_stations.split(',') lo_stations = [i.upper() for i in lo_stations] except: print 'Error - station name list could not be read!' print '(Must be comma-separated list...no whitespaces)\n' outfile = op.abspath(op.join(os.curdir,'dummy_survey.cfg')) outfile = MTfh.make_unique_filename(outfile) survey_dict = {} for st in lo_stations: tmp_dict = {} for idx_r, req in enumerate(MTcf.list_of_required_keywords): tmp_dict[req] = MTcf.list_of_keyword_defaults_general[idx_r] for idx_e, efield in enumerate(MTcf.list_of_efield_keywords): tmp_dict[efield] = MTcf.list_of_keyword_defaults_efield[idx_e] for idx_b,bfield in enumerate(MTcf.list_of_bfield_keywords): tmp_dict[bfield] = MTcf.list_of_keyword_defaults_bfield[idx_b] survey_dict[st] = tmp_dict MTcf.write_dict_to_configfile(survey_dict, outfile)
def write_config_file(self, save_fn): """ write a config file for birrp parameters """ cfg_fn = mtfh.make_unique_filename( '{0}_birrp_params.cfg'.format(save_fn)) birrp_dict = self._get_parameters() mtcfg.write_dict_to_configfile(birrp_dict, cfg_fn) print('Wrote BIRRP config file for edi file to {0}'.format(cfg_fn))
def write_config_file(self, save_fn): """ write a config file for birrp parameters """ cfg_fn = mtfh.make_unique_filename( '{0}_birrp_params.cfg'.format(save_fn)) station = os.path.basename(save_fn) birrp_dict = self.to_dict() mtcfg.write_dict_to_configfile({station: birrp_dict}, cfg_fn) print( 'INFO: Wrote BIRRP config file for edi file to {0}'.format(cfg_fn))
def write_config_file(self, save_dir=None, config_fn_basename='ModEM_inv.cfg'): """ write a config file based on provided information """ if save_dir is None: save_dir = os.getcwd() cfg_fn = os.path.join(save_dir, config_fn_basename) if self.cfg_dict is not None: mtcfg.write_dict_to_configfile(self.cfg_dict, cfg_fn)