equinor / xtgeo

XTGeo Python class library for subsurface Surfaces, Cubes, Wells, Grids, Points, etc
https://xtgeo.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
109 stars 56 forks source link

Map classes to their valid `FileFormat` enum types #1164

Open mferrera opened 4 months ago

mferrera commented 4 months ago

Validating file types is quite ad-hoc for importing and exporting at the moment. Imports have generally been moved to check again the new FileFormat enum

https://github.com/equinor/xtgeo/blob/33652a2861191161470cfd4c93ad9608272040f1/src/xtgeo/io/_file.py#L48-L51

but exports have not yet so far, for practical reasons. We should map the class types to the keys of this enum where appropriate to unify file format checking for import and export. This presumes that import file types and export file types are the same, which may not be the case -- in which case they can be grouped into import and export types, respectively.

This mapping might exist inside or outside of the class itself.