Skip to content

Commit

Permalink
test update
Browse files Browse the repository at this point in the history
  • Loading branch information
sambles committed Jan 31, 2025
1 parent 445c394 commit 6d36719
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions src/model_execution_worker/distributed_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,30 @@ def load_location_data(loc_filepath, oed_schema_info=None):
""" Returns location file as DataFrame
Returns a DataFrame of Loaction data with 'loc_id' row assgined
has a fallback to support both 1.26 and 1.27 versions of oasislmf
"""
try:
# oasislmf == 1.26.x or 1.23.x
from oasislmf.utils.data import get_location_df
return get_location_df(loc_filepath)
except ImportError:
# oasislmf == 1.27.x or greater
from oasislmf.utils.data import prepare_location_df
from ods_tools.oed.exposure import OedExposure

exposure = OedExposure(
location=pathlib.Path(os.path.abspath(loc_filepath)),
oed_schema_info=oed_schema_info,
)
from oasislmf.utils.data import prepare_oed_exposure
from ods_tools.oed.exposure import OedExposure

exposure = OedExposure(
location=pathlib.Path(os.path.abspath(loc_filepath)),
oed_schema_info=oed_schema_info,
)
prepare_oed_exposure(exposure)
return exposure.location.dataframe

#try:
# # oasislmf == 1.26.x or 1.23.x
# from oasislmf.utils.data import get_location_df
# return get_location_df(loc_filepath)
#except ImportError:
# # oasislmf == 1.27.x or greater
# from oasislmf.utils.data import prepare_location_df
# from ods_tools.oed.exposure import OedExposure

# exposure = OedExposure(
# location=pathlib.Path(os.path.abspath(loc_filepath)),
# oed_schema_info=oed_schema_info,
# )
exposure.location.dataframe = prepare_location_df(exposure.location.dataframe)
return exposure.location.dataframe

Expand Down

0 comments on commit 6d36719

Please sign in to comment.