@@ -125,6 +125,14 @@ def from_file(
125125 if fformat == WellFileFormat .CSV :
126126 return cls .from_csv (filepath , ** kwargs )
127127
128+ if fformat == WellFileFormat .HDF5 :
129+ if kwargs :
130+ raise TypeError (
131+ f"from_hdf5() does not accept keyword arguments, "
132+ f"got: { ', ' .join (kwargs .keys ())} "
133+ )
134+ return cls .from_hdf5 (filepath )
135+
128136 raise NotImplementedError (f"File format { fformat } not supported yet." )
129137
130138 def to_file (
@@ -142,6 +150,10 @@ def to_file(
142150 self .to_csv (filepath , ** kwargs )
143151 return
144152
153+ if fformat == WellFileFormat .HDF5 :
154+ self .to_hdf5 (filepath , ** kwargs )
155+ return
156+
145157 raise NotImplementedError (f"File format { fformat } not supported yet." )
146158
147159 @classmethod
@@ -154,7 +166,6 @@ def from_rms_ascii(cls, filepath: FileLike) -> BlockedWellData:
154166 def to_rms_ascii (
155167 self ,
156168 filepath : FileLike ,
157- * ,
158169 precision : int = 4 ,
159170 ) -> None :
160171 """Write blocked well data to RMS ASCII file."""
@@ -186,3 +197,36 @@ def to_csv(
186197 filepath = filepath ,
187198 ** kwargs ,
188199 )
200+
201+ @classmethod
202+ def from_hdf5 (cls , filepath : FileLike ) -> BlockedWellData :
203+ """Read blocked well data from HDF5 file.
204+
205+ Args:
206+ filepath: Path to HDF5 file
207+
208+ Returns:
209+ BlockedWellData object
210+ """
211+ from xtgeo .io ._welldata ._fformats ._hdf5_xtgeo import read_hdf5_blockedwell
212+
213+ return read_hdf5_blockedwell (filepath = filepath )
214+
215+ def to_hdf5 (
216+ self ,
217+ filepath : FileLike ,
218+ compression : str | None = "lzf" ,
219+ ) -> None :
220+ """Write blocked well data to HDF5 file.
221+
222+ Args:
223+ filepath: Output HDF5 file path
224+ compression: Compression method ("lzf", "blosc", or None)
225+ """
226+ from xtgeo .io ._welldata ._fformats ._hdf5_xtgeo import write_hdf5_blockedwell
227+
228+ write_hdf5_blockedwell (
229+ blocked_well = self ,
230+ filepath = filepath ,
231+ compression = compression ,
232+ )
0 commit comments