Changeset 1485


Ignore:
Timestamp:
07/31/09 16:42:14 (16 years ago)
Author:
Eric.Larour
Message:

better movie plots

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/classes/public/plot/plot_transient_movie.m

    r1095 r1485  
    99        subplot(width,width,i);
    1010
    11         if strcmpi(md.type,'2d')
    12                 choice=input('Which field do you want to plot? (vel/vx/vy/thickness/surface/bed)','s');
    13                 if ~strcmp(choice,'vel') & ~strcmp(choice,'vx') & ~strcmp(choice,'vy') & ~strcmp(choice,'thickness') & ~strcmp(choice,'bed') & ~strcmp(choice,'surface')
    14                         disp('plot_transient_movie error message: input not supported yet, exiting...')
    15                         return
    16                 end
     11        %xlim
     12        if ~isnan(options_structure.transient_movie_field),
     13                field=options_structure.transient_movie_field;
    1714        else
    18                 choice=input('Which field do you want to plot? (vel/vx/vy/vz/thickness/surface/bed/temperature/melting)','s');
    19                 if ~strcmp(choice,'vel') & ~strcmp(choice,'vx') & ~strcmp(choice,'vy') & ~strcmp(choice,'vz') & ~strcmp(choice,'temperature') & ~strcmp(choice,'thickness') & ~strcmp(choice,'bed') & ~strcmp(choice,'surface')
    20                         disp('plot_transient_movie error message: input not supported yet, exiting...')
    21                         return
    22                 end
     15                error('specify transient_movie_field in options list');
    2316        end
    2417
     
    2821        %loop over the time steps
    2922        for i=1:length(md.results.transient)
    30                 eval(['data=md.results.transient(' num2str(i) ').' num2str(choice) ';']);
     23                eval(['data=md.results.transient(' num2str(i) ').' num2str(field) ';']);
    3124
    3225                %process data
    3326                [data isongrid]=processdata(md,data,options_structure);
    34                 titlestring=[choice ' at time ' num2str(md.results.transient(i).time/md.yts) ' year'];
     27                titlestring=[field ' at time ' num2str(md.results.transient(i).time/md.yts) ' year'];
    3528                plot_unit(x,y,z,elements,data,isongrid,is2d,options_structure)
    3629                apply_options_movie(md,options_structure,titlestring);
    37                 pause(0.5)
     30               
     31                if ~isnan(options_structure.transient_movie_output),
     32                        frames(i)=getframe(gcf);
     33                else
     34                        pause(0.5)
     35                end
    3836        end
     37
     38        %output movie if requested.
     39        if ~isnan(options_structure.transient_movie_output),
     40                filename=options_structure.transient_movie_output;
     41               
     42                %fps
     43                if ~isnan(options_structure.transient_movie_fps),
     44                        fps=options_structure.transient_movie_fps;
     45                else
     46                        fps=5;
     47                end
     48                %quality
     49                if ~isnan(options_structure.transient_movie_quality),
     50                        quality=options_structure.transient_movie_quality;
     51                else
     52                        quality=75;
     53                end
     54                movie2avi(frames,filename,'fps',fps,'quality',quality);
     55        end
     56
    3957end %function
    4058
Note: See TracChangeset for help on using the changeset viewer.