source: issm/oecreview/Archive/21337-21723/ISSM-21647-21648.diff@ 21726

Last change on this file since 21726 was 21726, checked in by Mathieu Morlighem, 8 years ago

CHG added Archive/21337-21723

File size: 2.6 KB
RevLine 
[21726]1Index: ../trunk-jpl/src/m/contrib/defleurian/netCDF/export_netCDF.m
2===================================================================
3--- ../trunk-jpl/src/m/contrib/defleurian/netCDF/export_netCDF.m (revision 21647)
4+++ ../trunk-jpl/src/m/contrib/defleurian/netCDF/export_netCDF.m (revision 21648)
5@@ -72,7 +72,7 @@
6 else
7 listsize=length(Var);
8 subgroupID=netcdf.defGrp(groupID,groupfields{j});
9- netcdf.putAtt(subgroupID,netcdf.getConstant('NC_GLOBAL'),'classtype',class(md.(groups{i}).(groupfields{j})));
10+ netcdf.putAtt(subgroupID,netcdf.getConstant('NC_GLOBAL'),'classtype',class(Var));
11 for l=1:listsize
12 if isprop(Var{l},'name')
13 lname=Var{l}.name;
14@@ -91,6 +91,53 @@
15 end
16 end
17 end
18+ elseif isa(Var,'struct') && ~strcmp(groupfields{j},'bamg')
19+ classtype=class(md.(groups{i}));
20+ if strcmp(classtype,'struct')
21+ classtype=groups{i};
22+ end
23+ netcdf.putAtt(groupID,netcdf.getConstant('NC_GLOBAL'),'classtype',classtype);
24+ if length(Var)>1
25+ listsize=length(Var);
26+ subgroupID=netcdf.defGrp(groupID,groupfields{j});
27+ classtype=class(Var);
28+ if strcmp(classtype,'struct')
29+ classtype=groups{i};
30+ end
31+ netcdf.putAtt(subgroupID,netcdf.getConstant('NC_GLOBAL'),'classtype',classtype);
32+ for l=1:listsize
33+ if isfield(Var(l),'step')
34+ lname=[int2str(Var(l).step)];
35+ else
36+ lname=[class(Var(l)) int2str(l)];
37+ end
38+ classtype=class(Var(l));
39+ if strcmp(classtype,'struct')
40+ classtype=groups{i};
41+ end
42+ listgroupID=netcdf.defGrp(subgroupID,lname);
43+ netcdf.putAtt(listgroupID,netcdf.getConstant('NC_GLOBAL'),'classtype',classtype);
44+ subfields=fields(Var(l));
45+ for m=1:length(subfields)
46+ if ~strcmp(subfields{m},'outlog')
47+ [DimSize,DimValue]=DefCreateVar(ncid,Var(l).(subfields{m}),listgroupID,subfields{m},DimSize,DimValue);
48+ end
49+ end
50+ end
51+ else
52+ subgroupID=netcdf.defGrp(groupID,groupfields{j});
53+ classtype=class(Var);
54+ if strcmp(classtype,'struct')
55+ classtype=groups{i};
56+ end
57+ netcdf.putAtt(subgroupID,netcdf.getConstant('NC_GLOBAL'),'classtype',classtype);
58+ subfields=fields(Var);
59+ for m=1:length(subfields)
60+ if ~strcmp(subfields{m},'outlog')
61+ [DimSize,DimValue]=DefCreateVar(ncid,Var.(subfields{m}),subgroupID,subfields{m},DimSize,DimValue);
62+ end
63+ end
64+ end
65 else
66 netcdf.putAtt(groupID,netcdf.getConstant('NC_GLOBAL'),'classtype',class(md.(groups{i})));
67 [DimSize,DimValue]=DefCreateVar(ncid,Var,groupID,groupfields{j},DimSize,DimValue);
Note: See TracBrowser for help on using the repository browser.