Esempio n. 1
0
        for itv in Intervals((tmin, tmax, tbb), (tstep, ustep)):
            log.notice("Interval %s", itv)
            select = dict(time=itv[:2])
            if options.level:
                select["level"] = slice(*map(int, options.level.split(",")))
            if options.bbox:
                select.update(dict(latitude=(latmin, latmax), longitude=(lonmin, lonmax)))
            pylab.figure()
            try:
                sec = mars.plot_section(
                    varname=varname,
                    select=select,
                    xmin=xmin,
                    ymin=ymin,
                    xmax=xmax,
                    ymax=ymax,
                    pmap=True,
                    sec_axes_rect=[0.1, 0.1, 0.6, 0.7],
                    map_axes_rect=[0.75, 0.1, 0.2, 0.3],
                    plot_show=False,
                )
            except:
                log.exception("")
            pylab.legend(loc="best")
            output = options.output % dict(var=varname[0], tmin=strftime(dtfmt, itv[0]), tmax=strftime(dtfmt, itv[1]))
            log.notice("Saving %s", output)
            pylab.savefig(output)

    if options.show:
        pylab.show()
Esempio n. 2
0
     lat = ([xymin], [xymax])
     lon = (xy, xy)
 else:
     lon = ([xymin], [xymax])
     lat = (xy, xy)
 
 if 'loc' in options.plots:
     for op in options.operations:
         log.notice('loc %s', op)
         pylab.figure()
         xlkw = datakw.copy()
         xlkw.update(extrema=op)
         
         xlkw.update(pmap=False, cur_color='b', cur_linestyle='', cur_marker='o')
         try: cur, var, lat, lon = sat.plot_extrema_location(**xlkw)
         except: log.exception('Cannot plot satellite')
         
         xlkw.update(pmap=False, cur_color='g', cur_linestyle='-', cur_marker='+')
         xlkw['select'].update(level=slice(int(options.level),None))
         try: cur, var, lat, lon = mars.plot_extrema_location(**xlkw)
         except: log.exception('Cannot plot mars')
         
         xrotate(45)
         pylab.legend(loc='best')
         
         try: mars.plot_trajectory_map(lon, lat, **xlkw)
         except: log.exception('Cannot plot trajectory')
         
         output = options.output%dict(plot='loc', op=op, var=varname[0], tmin=strftime(dtfmt, itv[0]), tmax=strftime(dtfmt, itv[1]))
         log.info('Saving %s', output)
         pylab.savefig(output)
Esempio n. 3
0
     
     for depth in depths:
     
         for itv in Intervals((tmin, tmax, tbb),(tstep, ustep)):
             log.notice('Interval %s', itv)
             
             plotkw = dict(plot_show=False)
             select = dict(time=itv[:2], latitude=(latmin,latmax,'ccb'), longitude=(lonmin,lonmax,'ccb'))
             
             if not options.coloc:
             
                 pylab.figure()
                 try:
                     mp = mars.plot_layer(varname=varname, depth=depth, select=select, **plotkw)
                     plotkw['map'] = mp
                 except: log.exception('Cannot plot mars layer')
                 try: mp = profiles.plot_layer(varname=varname, depth=depth, select=select, **plotkw)
                 except: log.exception('Cannot plot profiles layer')
             
             else:
                 pylab.figure()
                 try: Colocator().plot_layer_mod_on_pro(mars, profiles, varname=varname, depth=depth, select=select, method=options.coloc)
                 except: log.exception('Cannot plot layer')
                 
             output = options.output%dict(var=varname[0], depth='%sm'%abs(depth), tmin=strftime(dtfmt, itv[0]), tmax=strftime(dtfmt, itv[1]))
             pylab.legend(loc='best')
             pylab.title('Layer %s\nDepth: %s\ntime: %s'%(varname[0], depth, itv))
             log.notice('Saving %s', output)
             pylab.savefig(output)
 
 if options.show: pylab.show()
Esempio n. 4
0
                plotkw = dict(plot_show=False)
                select = dict(time=itv[:2],
                              latitude=(latmin, latmax, 'ccb'),
                              longitude=(lonmin, lonmax, 'ccb'))

                if not options.coloc:

                    pylab.figure()
                    try:
                        mp = mars.plot_layer(varname=varname,
                                             depth=depth,
                                             select=select,
                                             **plotkw)
                        plotkw['map'] = mp
                    except:
                        log.exception('Cannot plot mars layer')
                    try:
                        mp = profiles.plot_layer(varname=varname,
                                                 depth=depth,
                                                 select=select,
                                                 **plotkw)
                    except:
                        log.exception('Cannot plot profiles layer')

                else:
                    pylab.figure()
                    try:
                        Colocator().plot_layer_mod_on_pro(mars,
                                                          profiles,
                                                          varname=varname,
                                                          depth=depth,
Esempio n. 5
0
        for itv in Intervals((tmin, tmax, tbb), (tstep, ustep)):
            log.notice('Interval %s', itv)

            select = dict(time=itv[:2], level=slice(int(options.level), None))
            if options.bbox:
                select.update(
                    dict(latitude=(latmin, latmax),
                         longitude=(lonmin, lonmax)))
            pylab.figure()
            try:
                sec = mars.plot_hovmoller(varname=varname,
                                          xorymin=xymin,
                                          xorymax=xymax,
                                          xory=xy,
                                          meridonal=options.meridional,
                                          select=select,
                                          pmap=True,
                                          hov_axes_rect=[0.1, 0.1, 0.6, 0.7],
                                          map_axes_rect=[0.75, 0.1, 0.2, 0.3],
                                          plot_show=False)
            except:
                log.exception('')
            pylab.legend(loc='best')
            output = options.output % dict(var=varname[0],
                                           tmin=strftime(dtfmt, itv[0]),
                                           tmax=strftime(dtfmt, itv[1]))
            log.notice('Saving %s', output)
            pylab.savefig(output)

    if options.show: pylab.show()
Esempio n. 6
0
                      latitude=(latmin, latmax, 'ccb'),
                      longitude=(lonmin, lonmax, 'ccb'))
        plotkw = dict(plot_show=False)

        # ==========
        # Methode 1. Tracé des observations (points) sur fond 2D grillés de champs de modèles moyennés sur la période choisie.
        if not options.coloc:

            if 'mld' in options.plots:
                pylab.figure()
                kw = plotkw.copy()
                m = c = None
                try:
                    m, c = mars.plot_mld(select, **kw)
                except:
                    log.exception('Cannot plot mars mld')
                kw.update(map=m, cmap=c)
                try:
                    profiles.plot_mld(select, **kw)
                except:
                    log.exception('Cannot plot profiles mld')
                pylab.legend(loc='best')
                pylab.title('Mixed Layer Depth\ntime: %s' % (itv, ))
                output = options.output % dict(plot='mld',
                                               tmin=strftime(dtfmt, itv[0]),
                                               tmax=strftime(dtfmt, itv[1]))
                log.notice('Saving %s', output)
                pylab.savefig(output)

            if 'ped' in options.plots:
                pylab.figure()
Esempio n. 7
0
 for itv in Intervals((tmin, tmax, tbb),(tstep, ustep)):
     log.notice('Interval %s', itv)
     
     select = dict(time=itv, latitude=(latmin,latmax,'ccb'), longitude=(lonmin,lonmax,'ccb'))
     plotkw = dict(plot_show=False)
     
     # ==========
     # Methode 1. Tracé des observations (points) sur fond 2D grillés de champs de modèles moyennés sur la période choisie.
     if not options.coloc:
         
         if 'mld' in options.plots:
             pylab.figure()
             kw = plotkw.copy()
             m = c = None
             try: m,c = mars.plot_mld(select, **kw)
             except: log.exception('Cannot plot mars mld')
             kw.update(map=m, cmap=c)
             try: profiles.plot_mld(select, **kw)
             except: log.exception('Cannot plot profiles mld')
             pylab.legend(loc='best')
             pylab.title('Mixed Layer Depth\ntime: %s'%(itv,))
             output = options.output%dict(plot='mld', tmin=strftime(dtfmt, itv[0]), tmax=strftime(dtfmt, itv[1]))
             log.notice('Saving %s', output)
             pylab.savefig(output)
         
         if 'ped' in options.plots:
             pylab.figure()
             kw = plotkw.copy()
             m = c = None
             try: m,c = mars.plot_ped(select, **kw)
             except: log.exception('Cannot plot mars ped')
Esempio n. 8
0
    if options.cfgfile:
        mars.load_default_config(options.cfgfile, nested=True)
        mars.load_config(options.cfgfile, nested=True)
    
    for varname in variables:
        log.notice('Variable %s', varname)
        
        for itv in Intervals((tmin, tmax, tbb),(tstep, ustep)):
            log.notice('Interval %s', itv)
            
            select = dict(time=itv[:2], level=slice(int(options.level),None))
            if options.bbox: select.update(dict(latitude=(latmin,latmax), longitude=(lonmin,lonmax)))
            pylab.figure()
            try:
                sec = mars.plot_hovmoller(
                    varname=varname, xorymin=xymin, xorymax=xymax, xory=xy, meridonal=options.meridional,
                    select=select,
                    pmap=True, hov_axes_rect=[0.1, 0.1, 0.6, 0.7], map_axes_rect=[0.75, 0.1, 0.2, 0.3], plot_show=False)
            except: log.exception('')
            pylab.legend(loc='best')
            output = options.output%dict(var=varname[0], tmin=strftime(dtfmt, itv[0]), tmax=strftime(dtfmt, itv[1]))
            log.notice('Saving %s', output)
            pylab.savefig(output)
    
    if options.show: pylab.show()