Exemple #1
0
                              ctitle=CONFRUN + ': transport of heat, ' + csec,
                              ymin=0,
                              ymax=0,
                              mnth_col='g',
                              cfig_type=ff)

        js = js + 1

if idfig == 'mld':
    jbox = 0
    for cbox in bo.cname_mld_boxes:
        cf_in_m = 'mean_' + cvar + '_' + CONFRUN + '_' + cbox + '.nc'
        if os.path.exists(cf_in_m):
            print ' Opening ' + cf_in_m
            vt0, vd0 = bn.read_1d_series(cf_in_m,
                                         cvar,
                                         cv_t='time',
                                         l_return_time=True)
            nbm = len(vt0)
            if nbm % 12 != 0:
                print 'ERROR: plot_time_series.py => ' + cvar + ', number of records not a multiple of 12!'
                sys.exit(0)
            VY, FY = bt.monthly_2_annual(vt0, vd0)
            ittic = bt.iaxe_tick(nbm / 12)
            bp.plot("1d_mon_ann")(vt0,
                                  VY,
                                  vd0,
                                  FY,
                                  cfignm=cdiag + '_' + CONFRUN + '_' + cbox,
                                  dt_year=ittic,
                                  cyunit=cyu,
                                  ctitle=CONFRUN + ': ' + clnm +
    vvar  = [ vdic['NN_SSH'], vdic['NN_SSS'], vdic['NN_SST'] ]
    vname = [ 'SSH'     ,  'SSS'      , 'SST'     ]
    vunit = [ r'm'    ,  r'PSU'   , r'$^{\circ}$C']


    jvar=0
    for cvar in vvar:
        cdiag = 'mean_'+cvar
        print '\n Treating '+cdiag

        for cocean in bo.voce2treat:
            Xf[:,:] = 0. ; jrun = 0
            for confrun in clist_confruns:

                cf_in = cd_diag+'/'+confrun+'/'+cdiag+'_'+confrun+'_'+cocean+'.nc'
                vt0, vd0 = bn.read_1d_series(cf_in, cvar, cv_t='time', l_return_time=True)
                nbm = len(vt0)
                test_nb_mnth_rec(nbm, nb_years, cdiag)
                VY, FY = bt.monthly_2_annual(vt0, vd0)
                vtime[:nbm/12]   = VY[:]
                Xf[jrun,:nbm/12] = FY[:] ; Xf[jrun,nbm/12:] = -999.
                jrun = jrun + 1

            bp.plot("1d_multi")(vtime[:], Xf[:,:], clist_runs, cfig_type=cffig,
                                cfignm=cdiag+'_comparison_'+cocean, dt_year=ittic, loc_legend=DEFAULT_LEGEND_LOC,
                                cyunit=vunit[jvar], ctitle = vname[jvar]+', '+cocean, ymin=0, ymax=0)

        jvar = jvar+1


    vname = ['SSH', 'SSS', 'SST']
    vunit = [r'm', r'PSU', r'$^{\circ}$C']

    jvar = 0
    for cvar in vvar:
        cdiag = 'mean_' + cvar
        print '\n Treating ' + cdiag

        for cocean in bo.voce2treat:
            Xf[:, :] = 0.
            jrun = 0
            for confrun in clist_confruns:

                cf_in = cd_diag + '/' + confrun + '/' + cdiag + '_' + confrun + '_' + cocean + '.nc'
                vt0, vd0 = bn.read_1d_series(cf_in,
                                             cvar,
                                             cv_t='time',
                                             l_return_time=True)
                nbm = len(vt0)
                test_nb_mnth_rec(nbm, nb_years, cdiag)
                VY, FY = bt.monthly_2_annual(vt0, vd0)
                vtime[:nbm / 12] = VY[:]
                Xf[jrun, :nbm / 12] = FY[:]
                Xf[jrun, nbm / 12:] = -999.
                jrun = jrun + 1

            bp.plot("1d_multi")(vtime[:],
                                Xf[:, :],
                                clist_runs,
                                cfig_type=cffig,
                                cfignm=cdiag + '_comparison_' + cocean,
                                dt_year=ittic,
        # Transport of heat:
        bp.plot("1d_mon_ann")(vtime, VY, Xtrsp[1,:], FY[1,:], cfignm='transport_heat_'+csec+'_'+CONFRUN,
                             dt_year=ittic, cyunit='PW', ctitle = CONFRUN+': transport of heat, '+csec,
                             ymin=0, ymax=0, mnth_col='g')


        js = js + 1




if idfig == 'mld':
    jbox = 0
    for cbox in bo.cname_mld_boxes:
        cf_in_m = 'mean_'+cvar+'_'+CONFRUN+'_'+cbox+'.nc'
        if os.path.exists(cf_in_m):
            print ' Opening '+cf_in_m
            vt0, vd0 = bn.read_1d_series(cf_in_m, cvar, cv_t='time', l_return_time=True)
            nbm = len(vt0)
            if nbm%12 != 0: print 'ERROR: plot_time_series.py => '+cvar+', number of records not a multiple of 12!', sys.exit(0)
            VY, FY = bt.monthly_2_annual(vt0, vd0)
            ittic = bt.iaxe_tick(nbm/12)
            bp.plot("1d_mon_ann")(vt0, VY, vd0, FY, cfignm=cdiag+'_'+CONFRUN+'_'+cbox, dt_year=ittic, cyunit=cyu,
                                  ctitle = CONFRUN+': '+clnm+bo.clgnm_mld_boxes[jbox], ymin=ym, ymax=yp, plt_m03=True, plt_m09=True)
        else:
            print 'WARNING: plot_time_series.py => MLD diag => '+cf_in_m+' not found!'
        jbox = jbox+1


print 'plot_time_series.py done...\n'