- Timestamp:
- Jun 26, 2015, 5:14:45 PM (9 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r918 r919 1764 1764 1765 1765 1766 %% direct processing on the current Matlab session 1767 % if strcmp (RunMode,'local') 1766 %% direct processing on the current Matlab session or creation of command files 1767 filexml=cell(1,NbProcess);% initialisation of the names of the files containing the processing parameters 1768 extxml=cell(1,NbProcess); % initialisation of the set of labels used for the files documenting each process 1768 1769 for iprocess=1:NbProcess 1769 1770 if ~strcmp(get(handles.RUN,'BusyAction'),'queue')% allow for STOP action … … 1773 1774 if isempty(Param.IndexRange.NbSlice) 1774 1775 Param.IndexRange.first_i=first_i+(iprocess-1)*BlockLength*incr_i; 1775 % Param.IndexRange.first_i=ref_i(1+(iprocess-1)*BlockLength);1776 % Param.IndexRange.first_i=ref_i(1+(iprocess-1)*BlockLength); 1776 1777 if Param.IndexRange.first_i>last_i 1777 1778 NbProcess=iprocess-1;% leave the loop, we are at the end of the calculation … … 1782 1783 Param.IndexRange.last_i=min(last_i,first_i+(iprocess)*BlockLength*incr_i-1); 1783 1784 else %multislices (then incr_i is not empty) 1784 % Param.IndexRange.first_i= first_i+incr_i*(iprocess-1);1785 % Param.IndexRange.incr_i=incr_i*Param.IndexRange.NbSlice;1785 % Param.IndexRange.first_i= first_i+incr_i*(iprocess-1); 1786 % Param.IndexRange.incr_i=incr_i*Param.IndexRange.NbSlice; 1786 1787 Param.IndexRange.first_i= first_i+iprocess-1; 1787 1788 Param.IndexRange.incr_i=incr_i*Param.IndexRange.NbSlice; … … 1809 1810 extxml{iprocess}=fullfile_uvmat('','',Param.InputTable{1,3},'.xml',OutputNomType,... 1810 1811 Param.IndexRange.first_i,Param.IndexRange.last_i,first_j,last_j); 1811 filexml{iprocess}=fullfile(OutputDir,'0_XML',extxml{iprocess}) 1812 save(t, filexml{iprocess});% save the xml file containing the processing parameters 1812 filexml{iprocess}=fullfile(OutputDir,'0_XML',extxml{iprocess}); 1813 try 1814 save(t, filexml{iprocess});% save the xml file containing the processing parameters 1815 catch ME 1816 if ~strcmp (RunMode,'local') 1817 errormsg=['error writting ' filexml{iprocess} ': ' ME.message]; 1818 return 1819 end 1820 end 1813 1821 end 1814 1822 if strcmp (RunMode,'local') … … 1827 1835 end 1828 1836 end 1837 1829 1838 if ~strcmp (RunMode,'local') && ~strcmp(RunMode,'python') 1830 1839 %% processing on a different session of the same computer (background) or cluster, create executable files -
trunk/src/set_grid.m
r918 r919 194 194 YA=grid_pix_A(:,2); 195 195 unitcolumn=32*ones(size(XA)); 196 Xchar=num2str(XA, 2);196 Xchar=num2str(XA,'%1.1f');% write x coordinate in px, rounded at the first decimal 197 197 blanc=char(unitcolumn); 198 Ychar=num2str(YA, 2);198 Ychar=num2str(YA,'%1.1f');% write y coordinate in px, rounded at the first decimal 199 199 tete=['1 ' num2str(nbpointsA(1))]; 200 200 txt=[Xchar blanc Ychar]; -
trunk/src/struct2nc.m
r913 r919 49 49 return 50 50 end 51 %check the validity of the input field structure 51 52 %% check the validity of the input field structure 52 53 [errormsg,ListDimName,DimValue,VarDimIndex]=check_field_structure(Data); 53 54 if ~isempty(errormsg) … … 56 57 end 57 58 ListVarName=Data.ListVarName; 58 %nc=netcdf.create(flname,'NC_CLOBBER');%,'clobber'); %create the netcdf file with name flname 59 60 %% create the netcdf file with name flname in format NETCDF4 59 61 cmode = netcdf.getConstant('NETCDF4'); 60 62 cmode = bitor(cmode, netcdf.getConstant('CLASSIC_MODEL')); 61 63 cmode = bitor(cmode, netcdf.getConstant('CLOBBER')); 62 nc = netcdf.create(flname, cmode) 63 64 % write global constants64 nc = netcdf.create(flname, cmode); 65 66 %% write global constants 65 67 if isfield(Data,'ListGlobalAttribute') 66 68 keys=Data.ListGlobalAttribute; … … 84 86 end 85 87 end 86 %create dimensions 88 89 %% create the dimensions 87 90 dimid=zeros(1,length(ListDimName)); 88 91 for idim=1:length(ListDimName) … … 95 98 testattr=1; 96 99 end 97 varid=zeros(1,length(Data.ListVarName)); 100 101 102 %% create the variables 103 varid=nan(1,length(Data.ListVarName)); 98 104 for ivar=1:length(ListVarName) 99 varid(ivar)=netcdf.defVar(nc,ListVarName{ivar},'nc_double',dimid(VarDimIndex{ivar}));%define variable 100 end 101 %write variable attributes 105 if isfield(Data,ListVarName{ivar}) 106 VarClass=class(Data.(ListVarName{ivar})); 107 VarType=''; 108 switch VarClass 109 case {'single','double'} 110 VarType='nc_float'; % store all floating reals as single 111 case {'uint8','int16','uint16','int32','uint32','int64','uint64'} 112 VarType='nc_int'; 113 case 'logical' 114 VarType='nc_byte'; 115 end 116 if ~isempty(VarType) 117 varid(ivar)=netcdf.defVar(nc,ListVarName{ivar},VarType,dimid(VarDimIndex{ivar}));%define variable 118 end 119 end 120 end 121 122 %% write variable attributes 102 123 if testattr 103 124 for ivar=1:min(numel(VarAttribute),numel(ListVarName)) 104 if isstruct(VarAttribute{ivar}) 125 if isstruct(VarAttribute{ivar}) && ~isnan(varid(ivar)) 105 126 attr_names=fields(VarAttribute{ivar}); 106 127 for iattr=1:length(attr_names) … … 114 135 end 115 136 netcdf.endDef(nc); %put in data mode 137 138 %% fill the variables with input data 116 139 for ivar=1:length(ListVarName) 117 if isfield(Data,ListVarName{ivar})140 if ~isnan(varid(ivar)) 118 141 VarVal=Data.(ListVarName{ivar}); 119 142 %varval=values of the current variable 120 % VarDimIndex=Data.VarDimIndex{ivar}; %indices of the variable dimensions in the list of dimensions121 143 VarDimName=Data.VarDimName{ivar}; 122 144 if ischar(VarDimName) … … 126 148 testrange=(numel(VarDimName)==1 && strcmp(VarDimName{1},ListVarName{ivar}) && numel(VarVal)==2);% case of a coordinate defined on a regular mesh by the first and last values. 127 149 testline=isequal(length(siz),2) && isequal(siz(1),1)&& isequal(siz(2), DimValue(VarDimIndex{ivar}));%matlab vector 128 testcolumn=isequal(length(siz),2) && isequal(siz(1), DimValue(VarDimIndex{ivar}))&& isequal(siz(2),1);%matlab column vector 129 % if ~testrange && ~testline && ~testcolumn && ~isequal(siz,DimValue(VarDimIndex)) 130 % errormsg=['wrong dimensions declared for ' ListVarName{ivar} ' in struct2nc.m']; 131 % break 132 % end 150 %testcolumn=isequal(length(siz),2) && isequal(siz(1), DimValue(VarDimIndex{ivar}))&& isequal(siz(2),1);%matlab column vector 133 151 if testline || testrange 134 152 if testrange -
trunk/src/struct2xml.m
r908 r919 1 %'struct2xml': transform a matlab structure to a xml tree.1 %'struct2xml': transforms a matlab structure to a xml tree. 2 2 %-------------------------------------------------------------- 3 % 3 4 % each field with char string or num vector is transformed into a corresponding xml element 4 5 % each field with a matrix containing n lines is transformed into a xml element repeated n times 5 % WARNING: PROBLEM WITH HIERARCHICAL structures 6 % each substructure of the input matlab structure is translateed into a subtree in the xml object 7 % it is also possible to append a subtree to an existing xml object t 8 % 9 % t=struct2xml(Object,t,root_uid) 6 10 %%%%%%%%%%%%%%%%%%%%%%% 7 11 % OUTPUT: 8 12 % t: xmltree reproducing the structure of Object 9 13 % type 'save(t)' to visualize the xml text and save(filename,t) to save it in a file 14 % to set the title tag of the file, type t=set(t,1,'name','titletag') 10 15 % 11 16 % INPUT: 12 17 % Object: matlab structure, possibly hierarchical 13 % t: optional input xml tree in which a new branchneeds to be appended18 % t: optional input xml tree in which a subtree needs to be appended 14 19 % root_uid: optional uid of the xml element under which the new subtree must be appended 15 20
Note: See TracChangeset
for help on using the changeset viewer.