Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"DATE": date,
"CHILD": edgename[0],
"PARENT": edgename[1],
"KEYWORD": value,
}
if edgename[0] in grupnet_df.index:
rec_dict.update(grupnet_df.loc[edgename[0]])
gruptreerecords.append(rec_dict)
found_gruptree = False
found_welspecs = False
found_grupnet = False
# Done dumping the data for the previous date, parse the fresh
# date:
if kword.name == "DATES" or kword.name == "START":
for rec in kword:
date = parse_opmio_date_rec(rec)
logging.info("Parsing at date %s", str(date))
elif kword.name == "TSTEP":
for rec in kword:
steplist = parse_opmio_tstep_rec(rec)
# Assuming not LAB units, then the unit is days.
days = sum(steplist)
if days <= 0:
logger.critical("Invalid TSTEP, summed to %s days", str(days))
return pd.DataFrame()
date += datetime.timedelta(days=days)
logger.info(
"Advancing %s days to %s through TSTEP", str(days), str(date)
)
else:
logger.critical("BUG: Should not get here")
return pd.DataFrame()
deck (opm.io Deck) or EclFiles object
Return:
pd.DataFrame
"""
if isinstance(deck, EclFiles):
deck = deck.get_ecldeck()
wconrecords = [] # List of dicts of every line in input file
date = None # DATE columns will always be there, but can contain NaN
for kword in deck:
if kword.name == "DATES" or kword.name == "START":
for rec in kword:
logger.info("Parsing at date %s", str(date))
date = parse_opmio_date_rec(rec)
elif kword.name == "TSTEP":
if not date:
logger.critical("Can't use TSTEP when there is no start_date")
return pd.DataFrame()
for rec in kword:
steplist = rec[0].get_raw_data_list()
# Assuming not LAB units, then the unit is days.
days = sum(steplist)
date += datetime.timedelta(days=days)
logger.info(
"Advancing %s days to %s through TSTEP", str(days), str(date)
)
elif kword.name in WCONKEYS:
for rec in kword: # Loop over the lines inside WCON* record
rec_data = ad_hoc_wconparser(str(rec), kword.name)
rec_data["DATE"] = date
events where the DATE or START keyword is not found in advance.
Default: None
unroll (bool): Whether to unroll rows that cover a range,
like K1 and K2 in COMPDAT and in WELSEGS. Defaults to True.
Returns:
Dictionary with 3 dataframes, named COMPDAT, COMPSEGS and WELSEGS.
"""
compdatrecords = [] # List of dicts of every line in input file
compsegsrecords = []
welsegsrecords = []
date = start_date # DATE column will always be there, but can contain NaN/None
for kword in deck:
if kword.name == "DATES" or kword.name == "START":
for rec in kword:
date = parse_opmio_date_rec(rec)
logger.info("Parsing at date %s", str(date))
elif kword.name == "TSTEP":
if not date:
logger.critical("Can't use TSTEP when there is no start_date")
return {}
for rec in kword:
steplist = parse_opmio_tstep_rec(rec)
# Assuming not LAB units, then the unit is days.
days = sum(steplist)
date += datetime.timedelta(days=days)
logger.info(
"Advancing %s days to %s through TSTEP", str(days), str(date)
)
elif kword.name == "COMPDAT":
for rec in kword: # Loop over the lines inside COMPDAT record
rec_data = parse_opmio_deckrecord(