Changeset 25502
- Timestamp:
- 08/31/20 19:41:23 (5 years ago)
- Location:
- issm/trunk-jpl
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/frictionshakti.m
r25499 r25502 9 9 end 10 10 methods 11 function self = extrude(self,md) % {{{12 self.coefficient=project3d(md,'vector',self.coefficient,'type','node','layer',1);13 end % }}}14 11 function self = frictionshakti(varargin) % {{{ 15 12 switch nargin … … 24 21 function self = setdefaultparameters(self) % {{{ 25 22 23 end % }}} 24 function self = extrude(self,md) % {{{ 25 self.coefficient=project3d(md,'vector',self.coefficient,'type','node','layer',1); 26 26 end % }}} 27 27 function md = checkconsistency(self,md,solution,analyses) % {{{ -
issm/trunk-jpl/src/m/classes/frictionshakti.py
r25499 r25502 4 4 from fielddisplay import fielddisplay 5 5 from project3d import project3d 6 from structtoobj import structtoobj 6 7 from WriteData import WriteData 7 8 … … 14 15 """ 15 16 16 def __init__(self, md): # {{{17 def __init__(self, *args): # {{{ 17 18 self.coefficient = np.nan 18 #set defaults 19 self.setdefaultparameters() 19 20 nargs = len(args) 21 if nargs == 0: 22 self.setdefaultparameters() 23 elif nargs == 1: 24 self = structtoobj(self, args[0]) 20 25 #}}} 21 26 … … 42 47 43 48 md = checkfield(md, 'fieldname', 'friction.coefficient', 'timeseries', 1, 'NaN', 1, 'Inf', 1) 49 44 50 return md 45 51 # }}} -
issm/trunk-jpl/src/m/classes/model.m
r25499 r25502 424 424 if isobject(md.outputdefinition.definitions{i}) 425 425 %get subfields 426 solutionsubfields=field s(md.outputdefinition.definitions{i});426 solutionsubfields=fieldnames(md.outputdefinition.definitions{i}); 427 427 for j=1:length(solutionsubfields), 428 428 field=md.outputdefinition.definitions{i}.(solutionsubfields{j}); … … 548 548 549 549 %loop over model fields 550 model_fields=field s(md1);550 model_fields=fieldnames(md1); 551 551 for i=1:length(model_fields), 552 552 %get field … … 554 554 fieldsize=size(field); 555 555 if isobject(field), %recursive call 556 object_fields=field s(md1.(model_fields{i}));556 object_fields=fieldnames(md1.(model_fields{i})); 557 557 for j=1:length(object_fields), 558 558 %get field … … 721 721 if isstruct(md1.results), 722 722 md2.results=struct(); 723 solutionfields=field s(md1.results);723 solutionfields=fieldnames(md1.results); 724 724 for i=1:length(solutionfields), 725 725 if isstruct(md1.results.(solutionfields{i})) … … 728 728 for p=1:length(md1.results.(solutionfields{i})) 729 729 current = md1.results.(solutionfields{i})(p); 730 solutionsubfields=field s(current);730 solutionsubfields=fieldnames(current); 731 731 for j=1:length(solutionsubfields), 732 732 field=md1.results.(solutionfields{i})(p).(solutionsubfields{j}); … … 757 757 if isobject(md1.outputdefinition.definitions{i}) 758 758 %get subfields 759 solutionsubfields=field s(md1.outputdefinition.definitions{i});759 solutionsubfields=fieldnames(md1.outputdefinition.definitions{i}); 760 760 for j=1:length(solutionsubfields), 761 761 field=md1.outputdefinition.definitions{i}.(solutionsubfields{j}); -
issm/trunk-jpl/src/m/classes/sealevelmodel.m
r25499 r25502 106 106 end % }}} 107 107 function self=mergeresults(self) % {{{ 108 champs=field s(self.icecaps{1}.results.TransientSolution);108 champs=fieldnames(self.icecaps{1}.results.TransientSolution); 109 109 for i=1:length(self.mergedcaps)/2, 110 110 md=self.mergedcaps{2*(i-1)+1}; trans=self.mergedcaps{2*(i-1)+2}; -
issm/trunk-jpl/src/m/consistency/comparemodels.m
r20964 r25502 2 2 3 3 %loop over model fields 4 model_fields=field s(md1);4 model_fields=fieldnames(md1); 5 5 for i=1:length(model_fields), 6 6 field1=md1.(model_fields{i}); … … 11 11 continue; 12 12 end 13 object_fields=field s(md1.(model_fields{i}));13 object_fields=fieldnames(md1.(model_fields{i})); 14 14 for j=1:length(object_fields), 15 15 field1=md1.(model_fields{i}).(object_fields{j}); -
issm/trunk-jpl/src/m/contrib/defleurian/netCDF/export_netCDF.m
r25458 r25502 54 54 groupID=netcdf.defGrp(ncid,groups{i}); 55 55 %In each group gather the fields of the class 56 groupfields=field s(md.(groups{i}));56 groupfields=fieldnames(md.(groups{i})); 57 57 for j=1:length(groupfields), 58 58 Var=md.(groups{i}).(groupfields{j}); … … 87 87 listgroupID=netcdf.defGrp(subgroupID,lname); 88 88 netcdf.putAtt(listgroupID,netcdf.getConstant('NC_GLOBAL'),'classtype',class(Var{l})); 89 subfields=field s(Var{l});89 subfields=fieldnames(Var{l}); 90 90 for m=1:length(subfields) 91 91 if ~strcmp(subfields{m},'outlog') … … 121 121 listgroupID=netcdf.defGrp(subgroupID,lname); 122 122 netcdf.putAtt(listgroupID,netcdf.getConstant('NC_GLOBAL'),'classtype',classtype); 123 subfields=field s(Var(l));123 subfields=fieldnames(Var(l)); 124 124 for m=1:length(subfields) 125 125 if ~strcmp(subfields{m},'outlog') … … 135 135 end 136 136 netcdf.putAtt(subgroupID,netcdf.getConstant('NC_GLOBAL'),'classtype',classtype); 137 subfields=field s(Var);137 subfields=fieldnames(Var); 138 138 for m=1:length(subfields) 139 139 if ~strcmp(subfields{m},'outlog') … … 197 197 elseif isa(Var,'struct'), 198 198 %Start by getting the structure fields and size 199 locfields=field s(Var);199 locfields=fieldnames(Var); 200 200 [dims,DimSize,DimValue]=GetDims(ncid,Var,DimSize,DimValue); 201 201 varid = netcdf.defVar(groupID,field,'NC_CHAR',dims); … … 244 244 varsize=size(Var'); 245 245 elseif isa(Var,'struct') 246 varsize=length(field s(Var));246 varsize=length(fieldnames(Var)); 247 247 else 248 248 varsize=size(Var); -
issm/trunk-jpl/src/m/contrib/larour/mdanalysis.m
r24880 r25502 531 531 mv=md.mask; 532 532 end 533 strings=field s(mv);533 strings=fieldnames(mv); 534 534 strings={'all',strings{:}}; 535 535 set(hObject,'String',strings); … … 693 693 if issealevel, 694 694 if isearth, 695 resultfields=field s(md.earth.results);695 resultfields=fieldnames(md.earth.results); 696 696 else 697 resultfields=field s(md.icecaps{1}.results);697 resultfields=fieldnames(md.icecaps{1}.results); 698 698 end 699 699 else 700 resultfields=field s(md.results);700 resultfields=fieldnames(md.results); 701 701 end 702 702 if isempty(resultfields), … … 854 854 end 855 855 fieldHandle=findobj('Tag', 'Masque'); 856 strings=field s(mv);856 strings=fieldnames(mv); 857 857 strings={'all',strings{:}}; 858 858 set(fieldHandle,'String',strings); -
issm/trunk-jpl/src/m/miscellaneous/fielddisplay.m
r21989 r25502 75 75 function struct_display(offset,name,field,comment) % {{{ 76 76 77 if ~isempty(field s(field))77 if ~isempty(fieldnames(field)) 78 78 displayunit(offset,name,'(structure)',comment), 79 79 offset=[offset ' ']; 80 80 81 structure_fields=field s(field);81 structure_fields=fieldnames(field); 82 82 83 83 for i=1:length(structure_fields), -
issm/trunk-jpl/src/m/miscellaneous/structtoobj.m
r8952 r25502 3 3 4 4 %Get object and structure fields 5 structfields=field s(S);5 structfields=fieldnames(S); 6 6 objprops =properties(class(obj)); 7 7 8 8 %recover object properties 9 9 for i=1:length(structfields), 10 fieldname 10 fieldname=structfields{i}; 11 11 if ismember(fieldname,objprops), 12 12 fieldvalue=getfield(S,fieldname); -
issm/trunk-jpl/src/m/plot/plot_transient_movie.m
r25193 r25502 14 14 else 15 15 disp('List of available fields:'); 16 F=field s(md.results.TransientSolution(1));16 F=fieldnames(md.results.TransientSolution(1)); 17 17 num = []; 18 18 for i=1:numel(F), -
issm/trunk-jpl/src/m/plot/processdata.m
r23912 r25502 20 20 if isstruct(data), 21 21 disp('data provided is a struct with the following fields:'); 22 F=field s(data);22 F=fieldnames(data); 23 23 for i=1:numel(F), 24 24 disp([' ' num2str(i) ': ' F{i} ]); -
issm/trunk-jpl/src/m/regional/regionaltransient2d.m
r16470 r25502 43 43 44 44 %loop over model fields 45 model_fields=field s(md1);45 model_fields=fieldnames(md1); 46 46 for i=1:length(model_fields), 47 47 … … 52 52 %copy field, interpolated to new mesh 53 53 if isobject(field), %recursive call 54 object_fields=field s(md1.(model_fields{i}));54 object_fields=fieldnames(md1.(model_fields{i})); 55 55 fname=['(model_fields{i}).(object_fields{j})']; 56 56 else -
issm/trunk-jpl/src/m/solve/convert2str.m
r17721 r25502 109 109 function str = struct_display(field) % {{{ 110 110 111 if ~isempty(field s(field))111 if ~isempty(fieldnames(field)) 112 112 displayunit('(structure)'), 113 113 114 structure_fields=field s(field);114 structure_fields=fieldnames(field); 115 115 116 116 for i=1:length(structure_fields), -
issm/trunk-jpl/test/NightlyRun/test350.m
r23024 r25502 10 10 md.cluster=generic('name',oshostname(),'np',2); 11 11 12 %Use hydro ogy coupled friciton law12 %Use hydrology coupled friction law 13 13 md.friction=frictionshakti(md.friction); 14 14 -
issm/trunk-jpl/test/NightlyRun/test350.py
r25023 r25502 22 22 md.cluster = generic('name', gethostname(), 'np', 2) 23 23 24 #Use hydro ogy coupled friciton law25 md.friction = frictionshakti(md )24 #Use hydrology coupled friction law 25 md.friction = frictionshakti(md.friction) 26 26 27 27 #Change hydrology class to Shakti' model
Note:
See TracChangeset
for help on using the changeset viewer.