-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NEW: Python > Matlab - add loadmodel_netcdf.m from "loadmodel_netcdf.…
…py".
- Loading branch information
inwoo-simba
committed
Dec 11, 2024
1 parent
a775369
commit fc6fbc7
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
%{ | ||
% Explain | ||
% load netcdf format ISSM model (~ export_netCDF). | ||
% | ||
% Usage | ||
% md = loadmodel_netcdf('Antarctica.nc'); | ||
% | ||
% Inputs | ||
% | ||
% Outputs | ||
%} | ||
function md = loadmodel_netcdf(fname) | ||
warning('WARNING: this script is under developement.'); | ||
|
||
% initialize model | ||
md = model; | ||
|
||
% get information. | ||
info = ncinfo(fname); | ||
|
||
% get groups; | ||
GroupNames = {info.Groups.Name}; | ||
|
||
for i = 1:length(GroupNames) | ||
GroupName = GroupNames{i}; | ||
posGroup = strcmpi(GroupName, GroupNames); | ||
|
||
disp(GroupName); | ||
for j = 1:length(info.Groups(posGroup).Variables) | ||
VarName = info.Groups(posGroup).Variables(j).Name; | ||
md.(GroupName).(VarName) = transpose(ncread(fname,[GroupName '/' VarName])); | ||
end | ||
break; | ||
end | ||
|
||
% figure out groups! | ||
|
||
end |