Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python3 compatible identity checking in getDefaultValuesForXsect (is None, instead of == None) #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions hapi/hapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def open_(*args,**argv):
'ADDED PARLISTS FOR LINE MIXING (VOIGT AND SDVOIGT) (ver. 1.1.0.9.7)',
'ADDED SUPPORT FOR ROSENKRANZ LM PARAMETERS TO PCQSDHC AND LORENTZ (ver. 1.1.1.0)',
'FIXED THE TYPEERROR IN ARANGE (ver. 1.1.2.0)',
]
]

# version header
print('HAPI version: %s' % HAPI_VERSION)
Expand Down Expand Up @@ -144,7 +144,7 @@ def open_(*args,**argv):
VARIABLES['PROXY'] = {}
# EXAMPLE OF PROXY:
# VARIABLES['PROXY'] = {'http': '127.0.0.1:80'}

# make it changeable
VARIABLES['GLOBAL_HOST'] = GLOBAL_HOST

Expand Down Expand Up @@ -1144,8 +1144,8 @@ def arange_(lower,upper,step):
},
"eta_HT_air" : {
"default_fmt" : "%9.6f",
},
"gamma_H2O" : {
},
"gamma_H2O" : {
"default_fmt" : "%6.4f",
},
"n_H2O" : {
Expand Down Expand Up @@ -1424,7 +1424,7 @@ def storage2cache(TableName,cast=True,ext=None,nlines=None,pos=None):
LOCAL_TABLE_CACHE[TableName]['filehandler'] is not None:
InfileData = LOCAL_TABLE_CACHE[TableName]['filehandler']
else:
InfileData = open_(fullpath_data,'r')
InfileData = open_(fullpath_data,'r')
InfileHeader = open(fullpath_header,'r')
#try:
header_text = InfileHeader.read()
Expand All @@ -1437,7 +1437,7 @@ def storage2cache(TableName,cast=True,ext=None,nlines=None,pos=None):
#print 'Header:'+str(Header)
LOCAL_TABLE_CACHE[TableName] = {}
LOCAL_TABLE_CACHE[TableName]['header'] = Header
LOCAL_TABLE_CACHE[TableName]['data'] = {}
LOCAL_TABLE_CACHE[TableName]['data'] = {}
LOCAL_TABLE_CACHE[TableName]['filehandler'] = InfileData
# Check if Header['order'] and Header['extra'] contain
# parameters with same names, raise exception if true.
Expand Down Expand Up @@ -1569,7 +1569,7 @@ def cfunc(line, dtype=dtype, start=start, end=end, qnt=qnt):
LOCAL_TABLE_CACHE[TableName]['filehandler'] = None
InfileHeader.close()
print(' Lines parsed: %d' % line_count)
return flag_EOF
return flag_EOF

## old version based on regular expressions
#def storage2cache(TableName):
Expand Down Expand Up @@ -18228,7 +18228,7 @@ def getDefaultValuesForXsect(Components,SourceTables,Environment,OmegaRange,
OmegaStep,OmegaWing,IntensityThreshold,Format):
if SourceTables[0] == None:
SourceTables = ['__BUFFER__',]
if Environment == None:
if Environment is None:
Environment = {'T':296., 'p':1.}
if Components == [None]:
CompDict = {}
Expand All @@ -18245,7 +18245,7 @@ def getDefaultValuesForXsect(Components,SourceTables,Environment,OmegaRange,
for mol_id,iso_id in MI_zip:
CompDict[(mol_id,iso_id)] = None
Components = CompDict.keys()
if OmegaRange == None:
if OmegaRange is None:
omega_min = float('inf')
omega_max = float('-inf')
for TableName in SourceTables:
Expand All @@ -18257,9 +18257,9 @@ def getDefaultValuesForXsect(Components,SourceTables,Environment,OmegaRange,
if omega_max < numax:
omega_max = numax
OmegaRange = (omega_min,omega_max)
if OmegaStep == None:
if OmegaStep is None:
OmegaStep = 0.01 # cm-1
if OmegaWing == None:
if OmegaWing is None:
OmegaWing = 0.0 # cm-1
if not Format:
"""
Expand Down Expand Up @@ -19598,7 +19598,7 @@ def absorptionCrossSection(profile='HT',**argv):
def absorptionCoefficient(profile='HT',**argv):
argv['HITRAN_units'] = False
return PROFILE_MAP[profile](**argv)

# ---------------------------------------------------------------------------
# SHORTCUTS AND ALIASES FOR ABSORPTION COEFFICIENTS
# ---------------------------------------------------------------------------
Expand Down