Skip to content

Commit

Permalink
Revert deletion of file_import
Browse files Browse the repository at this point in the history
  • Loading branch information
dschwoerer committed Oct 8, 2024
1 parent ebd75c1 commit f108164
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/boututils/file_import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""Import an entire BOUT++ DataFile into memory
"""

from boututils.datafile import DataFile


def file_import(name):
"""Read all variables from file into a dictionary
Parameters
----------
name : str
Name of file to read
Returns
-------
dict
Dictionary containing all the variables in the file
"""
f = DataFile(name) # Open file
varlist = f.list() # Get list of all variables in file
data = {} # Create empty dictionary
for v in varlist:
data[v] = f.read(v)
f.close()
return data

0 comments on commit f108164

Please sign in to comment.