Skip to content

Commit

Permalink
Convert to MKArray when loading from files
Browse files Browse the repository at this point in the history
  • Loading branch information
johnomotani committed Jan 27, 2025
1 parent 435733a commit f98f074
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions moment_kinetics/ext/file_io_netcdf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ function load_variable(file_or_group::NCDataset, name::String)
if isa(var, Char)
var = (var == Char(true))
end
return var
return MKArray(var)
catch
println("An error occured while loading $name")
rethrow()
Expand All @@ -273,7 +273,7 @@ function load_slice(file_or_group::NCDataset, name::String, slices_or_indices...
# file or a group).
try
var = file_or_group[name].var[slices_or_indices...]
return var
return MKArray(var)
catch
println("An error occured while loading $name")
rethrow()
Expand Down
6 changes: 3 additions & 3 deletions moment_kinetics/src/load_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function load_variable(file_or_group::HDF5.H5DataStore, name::String)
# This overload deals with cases where fid is an HDF5 `File` or `Group` (`H5DataStore`
# is the abstract super-type for both
try
return read(file_or_group[name])
return MKArray(read(file_or_group[name]))
catch
println("An error occured while loading $name")
rethrow()
Expand All @@ -183,7 +183,7 @@ function load_slice(file_or_group::HDF5.H5DataStore, name::String, slices_or_ind
# This overload deals with cases where fid is an HDF5 `File` or `Group` (`H5DataStore`
# is the abstract super-type for both
try
return file_or_group[name][slices_or_indices...]
return MKArray(file_or_group[name][slices_or_indices...])
catch
println("An error occured while loading $name")
rethrow()
Expand Down Expand Up @@ -414,7 +414,7 @@ function load_time_data(fid; printout=false)

group = get_group(first(fid), "dynamic_data")
time = load_variable(group, "time")
restarts_nt = [length(time)]
restarts_nt = MKArray([length(time)])
for f fid[2:end]
group = get_group(f, "dynamic_data")
# Skip first point as this is a duplicate of the last point of the previous
Expand Down

0 comments on commit f98f074

Please sign in to comment.