Changeset 21648
- Timestamp:
- 03/30/17 08:35:47 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/contrib/defleurian/netCDF/export_netCDF.m
r21647 r21648 73 73 listsize=length(Var); 74 74 subgroupID=netcdf.defGrp(groupID,groupfields{j}); 75 netcdf.putAtt(subgroupID,netcdf.getConstant('NC_GLOBAL'),'classtype',class( md.(groups{i}).(groupfields{j})));75 netcdf.putAtt(subgroupID,netcdf.getConstant('NC_GLOBAL'),'classtype',class(Var)); 76 76 for l=1:listsize 77 77 if isprop(Var{l},'name') … … 89 89 [DimSize,DimValue]=DefCreateVar(ncid,Var{l}.(subfields{m}),listgroupID,subfields{m},DimSize,DimValue); 90 90 end 91 end 92 end 93 end 94 elseif isa(Var,'struct') && ~strcmp(groupfields{j},'bamg') 95 classtype=class(md.(groups{i})); 96 if strcmp(classtype,'struct') 97 classtype=groups{i}; 98 end 99 netcdf.putAtt(groupID,netcdf.getConstant('NC_GLOBAL'),'classtype',classtype); 100 if length(Var)>1 101 listsize=length(Var); 102 subgroupID=netcdf.defGrp(groupID,groupfields{j}); 103 classtype=class(Var); 104 if strcmp(classtype,'struct') 105 classtype=groups{i}; 106 end 107 netcdf.putAtt(subgroupID,netcdf.getConstant('NC_GLOBAL'),'classtype',classtype); 108 for l=1:listsize 109 if isfield(Var(l),'step') 110 lname=[int2str(Var(l).step)]; 111 else 112 lname=[class(Var(l)) int2str(l)]; 113 end 114 classtype=class(Var(l)); 115 if strcmp(classtype,'struct') 116 classtype=groups{i}; 117 end 118 listgroupID=netcdf.defGrp(subgroupID,lname); 119 netcdf.putAtt(listgroupID,netcdf.getConstant('NC_GLOBAL'),'classtype',classtype); 120 subfields=fields(Var(l)); 121 for m=1:length(subfields) 122 if ~strcmp(subfields{m},'outlog') 123 [DimSize,DimValue]=DefCreateVar(ncid,Var(l).(subfields{m}),listgroupID,subfields{m},DimSize,DimValue); 124 end 125 end 126 end 127 else 128 subgroupID=netcdf.defGrp(groupID,groupfields{j}); 129 classtype=class(Var); 130 if strcmp(classtype,'struct') 131 classtype=groups{i}; 132 end 133 netcdf.putAtt(subgroupID,netcdf.getConstant('NC_GLOBAL'),'classtype',classtype); 134 subfields=fields(Var); 135 for m=1:length(subfields) 136 if ~strcmp(subfields{m},'outlog') 137 [DimSize,DimValue]=DefCreateVar(ncid,Var.(subfields{m}),subgroupID,subfields{m},DimSize,DimValue); 91 138 end 92 139 end
Note:
See TracChangeset
for help on using the changeset viewer.