Skip to content

Commit

Permalink
Some minor fixes for showing more errors in case of linefunc errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
griatch committed Nov 5, 2012
1 parent 216ebe9 commit 8818601
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
21 changes: 10 additions & 11 deletions imptools/linefuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def charrange(linedata, start, end):
try:
return linedata[start:end].strip()
except Exception, e:
#print "charrange skipping '%s': %s (%s)" % (linedata, e)
pass
print "charrange skipping '%s': %s (%s)" % (linedata, e)
raise

def charrange2int(linedata, start, end):
"""
Expand All @@ -56,15 +56,15 @@ def charrange2int(linedata, start, end):
try:
return int(round(float(linedata[start:end].strip())))
except Exception, e:
#print "ERROR: charrange2int: %s: %s" % (linedata, e)
pass
print "ERROR: charrange2int: %s: %s" % (linedata, e)
raise

def bySepNr(linedata, number, sep=','):
try:
return string.split(linedata,sep)[number].strip()
except Exception, e:
pass
#print "ERROR: bySepNr skipping line '%s': %s" % (linedata, e)
print "ERROR: bySepNr skipping line '%s': %s" % (linedata, e)
raise

def bySepNr2(linedata, number, sep=','):
"""
Expand All @@ -81,8 +81,8 @@ def bySepNr2(linedata, number, sep=','):
try:
return linedata.split(sep)[number].strip()
except Exception, e:
pass
#print "ERROR: bySepNr skipping line '%s': %s" % (linedata, e)
print "ERROR: bySepNr skipping line '%s': %s" % (linedata, e)
raise

def bySepNr2int(linedata, number, sep=','):
"""
Expand All @@ -97,7 +97,7 @@ def bySepNr2int(linedata, number, sep=','):
return int(round(float(linedata.split(sep)[number].strip())))
except Exception, e:
print "ERROR: bySepNr2int skipping line '%s':%s" %(linedata, e)
pass
raise

def lineSplit(linedata, splitsep=','):
"""
Expand All @@ -115,8 +115,7 @@ def lineSplit(linedata, splitsep=','):
return [string.strip() for string in linedata.split(splitsep)]
except Exception, e:
#print "ERROR: linesplit %s: %s" % (linedata, e)
pass

raise

#
# VALD-specific examples below
Expand Down
3 changes: 1 addition & 2 deletions imptools/rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ def get_value(linedata, column_dict):
log_trace(e, "error processing line/block '%s' - in %s%s: " % (linedata, colfunc, args))
TOTAL_ERRS += 1
raise
if not dat or (column_dict.has_key('cnull') \
and dat == column_dict['cnull']):
if not dat or (column_dict.has_key('cnull') and dat == column_dict['cnull']):
return None

return QUOTE+str(dat)+QUOTE
Expand Down
11 changes: 10 additions & 1 deletion nodes/vald/mapping_vald3.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
species_list_file = base + 'VALD_list_of_species.csv'
vald_cfg_file = base + 'VALD3.cfg'
vald_file = base + 'vald3_atoms_all.dat' #.gz # change to vald3_molec.dat.gz for molecules
terms_file = base + 'terms_atoms_all.dat' #.gz'
terms_file = base + 'term_atoms_all.dat.gz'
#vald_file = base + 'vald3_atoms_2000.dat' # change to vald3_molec.dat.gz for molecules
#terms_file = base + 'terms_atoms_3000.dat'
ref_file = base + "VALD3_ref.bib"
Expand Down Expand Up @@ -640,10 +640,19 @@ def unique_state_id(linedata, processid, *ranges):

]

# indices:
# 0 - species
# 1 - lowstates
# 2 - upstates
# 3 - transitions
# 4 - references
# 5 - linelists

# short-cutting the mapping for testing
#mapping = [mapping[0]] + mapping[2:]
#mapping = [mapping[1]]
#mapping = [mapping[-2]]
#mapping = [mapping[1], mapping[2]]

# Stand-alone scripts (cannot depend on tables created above, these
# are run first!)
Expand Down

0 comments on commit 8818601

Please sign in to comment.