@@ -1076,9 +1076,9 @@ def from_obs_dict(
10761076 ) -> list [Self ]:
10771077 """Create seismic observations from an observation dictionary.
10781078
1079- File containing seismic observations (CSV) and file containing the polygon
1080- limiting observations used in the match step (BOUNDARY) are specified relative
1081- to the directory of the observation config.
1079+ File containing seismic observations (CSV or Parquet ) and file containing the
1080+ polygon limiting observations used in the match step (BOUNDARY) are specified
1081+ relative to the directory of the observation config.
10821082
10831083 Args:
10841084 directory: Directory where observation config is located.
@@ -1088,6 +1088,13 @@ def from_obs_dict(
10881088 name = ""
10891089 filepath : str | Path | None = None
10901090 boundary_filepath : str | Path | None = None
1091+
1092+ if "CSV" in observation_dict and "OBS_FILE" in observation_dict :
1093+ raise ObservationConfigError .with_context (
1094+ "SEISMIC_OBSERVATION cannot contain both 'CSV' and 'OBS_FILE'." ,
1095+ observation_dict .context ,
1096+ )
1097+
10911098 for key , value in observation_dict .items ():
10921099 match key :
10931100 case "type" :
@@ -1097,7 +1104,8 @@ def from_obs_dict(
10971104 case "CSV" :
10981105 ConfigWarning .warn (
10991106 "CSV key is deprecated for seismic observations. "
1100- "Use OBS_FILE instead. "
1107+ "Use OBS_FILE instead." ,
1108+ observation_dict .context ,
11011109 )
11021110 filepath = value
11031111 case "OBS_FILE" :
@@ -1107,19 +1115,13 @@ def from_obs_dict(
11071115 case _:
11081116 raise _unknown_key_error (str (key ), observation_dict .context )
11091117
1110- if "CSV" in observation_dict and "OBS_FILE" in observation_dict :
1111- raise ObservationConfigError .with_context (
1112- "SEISMIC_OBSERVATION cannot contain both 'CSV' and 'OBS_FILE'." ,
1113- observation_dict .context ,
1114- )
1115-
11161118 if filepath is None :
11171119 raise _missing_value_error (observation_dict .context , "OBS_FILE" )
11181120
11191121 filepath = Path (directory ) / filepath
11201122 if not filepath .exists ():
11211123 raise ObservationConfigError .with_context (
1122- f"The CSV file ({ filepath .absolute ()} ) "
1124+ f"The seismic observations file ({ filepath .absolute ()} ) "
11231125 "does not exist or is not accessible." ,
11241126 filepath ,
11251127 )
0 commit comments