From e3597f9d99a326d0fd1052ae37f688493be3679a Mon Sep 17 00:00:00 2001 From: Jan Mandel Date: Tue, 31 May 2016 07:12:15 -0600 Subject: [PATCH] misc --- other/Matlab/detection/cycles.m | 26 ++++++++++++++++---------- other/Matlab/detection/detect_fit_level2.m | 5 ++--- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/other/Matlab/detection/cycles.m b/other/Matlab/detection/cycles.m index e590a39c..040272f7 100644 --- a/other/Matlab/detection/cycles.m +++ b/other/Matlab/detection/cycles.m @@ -6,7 +6,7 @@ heads={'Observations from ',... 'Observations to ',... 'Next cycle restart at ',... 'Next cycle replay until ',... - 'Next cycle continue until '}; + 'Next cycle end time '}; start_cycle=input_num('starting cycle',1) for i=start_cycle:num_cycles start=base+i-1; @@ -17,9 +17,11 @@ for i=start_cycle:num_cycles end wrfout{i}=['wrfout_d01_',datestr(start+2,'yyyy-mm-dd_HH:MM:SS')]; wrfrst{i}=['wrfrst_d01_',datestr(restart,'yyyy-mm-dd_HH:MM:SS')]; + perimeter_time(i)=(time_bounds(i,4)-base)*24*3600; + fprintf('perimeter_time=%10.3f\n',perimeter_time(i)) end -for i=1:num_cycles - savefile(wrfout{i}) +for i=start_cycle:num_cycles + %savefile(wrfout{i}) w=read_wrfout_tign(wrfout{i}); % start, end observations; restart time, perimeter time fprintf('%s %s\n','Reading fire arrival time from ',wrfout{i}) @@ -27,17 +29,21 @@ for i=1:num_cycles for j=1:4, fprintf('Cycle %i %s %s\n',i,heads{j},datestr(time_bounds(i,j),'dd-mmm-yyyy HH:MM:SS')) end - + fprintf('perimeter_time=%10.3f\n',perimeter_time(i)) p=detect_fit_level2(1,time_bounds(i,:),w) - savefile(wrfrst{i}) - ncreplace(wrfrst{i},'TIGN_G',p.spinup) + %savefile(wrfrst{i}) for j=3:5, fprintf('Cycle %i %s %s\n',i,heads{j},datestr(time_bounds(i,j),'dd-mmm-yyyy HH:MM:SS')) end - command=sprintf('ln -s namelist.input_%i namelist.input',i); - disp(command) - if system(command), - warning('command failed') + fprintf('perimeter_time=%10.3f\n',perimeter_time(i)) + command=sprintf('rm -f namelist.input; ln -s namelist.input_%i namelist.input',i); + q=sprintf('replace TIGN_G in %s and run\n %s 0/1',wrfrst{i},command); + y=input_num(q,1); + if y + ncreplace(wrfrst{i},'TIGN_G',p.spinup) + if system(command), + warning('command failed') + end end input('Run WRF-SFIRE and continue when done\n') end diff --git a/other/Matlab/detection/detect_fit_level2.m b/other/Matlab/detection/detect_fit_level2.m index e69fc24d..c9381b43 100644 --- a/other/Matlab/detection/detect_fit_level2.m +++ b/other/Matlab/detection/detect_fit_level2.m @@ -24,8 +24,7 @@ end % then in Matlab: % set up paths by running setup.m in wrf-fire/WRFV3/test/em_fire % f='wrfout_d01_2013-08-20_00:00:00'; -% t=nc2struct(f,{'Times'},{}); n=size(t.times,2) -% w=nc2struct(f,{'Times','TIGN_G','FXLONG','FXLAT','UNIT_FXLAT','UNIT_FXLONG','XLONG','XLAT','NFUEL_CAT'},{'DX','DY'},n); +% w=read_wrfout_tign(f); % save ~/w.mat w % fuels.m is created by WRF-SFIRE at the beginning of the run % copy w.mat and fuel.m to your machine where this fuction will run @@ -283,4 +282,4 @@ function savefig(file,cycle) end print('-dpng',[filename,'.png']) saveas(gcf,[filename,'.fig'],'fig') -end \ No newline at end of file +end -- 2.11.4.GIT