Changeset 4309 for BOL


Ignore:
Timestamp:
Oct 26, 2022, 1:16:12 PM (2 years ago)
Author:
musat
Message:

Suite fusion de la fusion entre la version commune (compte fabric) et la version perso
IonelaMusat?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOL/Multi_atlas/atlas/atlas_none.py

    r3915 r4309  
    1212
    1313# Répertoire de base pour les entrées et les résultats
    14 #dir_default='/data/hourdin/LMDZ6/SE/ORIG'
    15 #dir_default='/prodigfs/fabric/LMDZ6/SE/ORIG'
    16 #dir_default='/prodigfs/ipslfs/dods/fabric/lmdz/SE/ORIG'
     14dir_default='/thredds/ipsl/fabric/lmdz/SE/ORIG'
    1715
    1816# Gestion des options et arguments d'appel
     
    2321parser.add_option("-i", "--input", help="repertoire des donnes d'entree(defaut : %s)",
    2422                  action="store",default=None)
    25 parser.add_option("-g", "--grid", help="nom de grille (default: VLR)", action="store",default='VLR')
    26 parser.add_option("-r", "--region", help="nom de zone (default: GLOB)", action="store",default='GLOB')
     23#parser.add_option("-g", "--grid", help="nom de grille (default: VLR)", action="store",default='VLR')
     24parser.add_option("-g", "--grid", help="nom de grille (default: VLR)", action="store",default='')
     25
     26parser.add_option("-r", "--region", help="nom de zone (GLOB, ATLTN, etc; default: GLOB)", action="store",default='GLOB')
    2727parser.add_option("-p", "--season", help="saison a traiter " "(eg : JJA, DJF, YEAR, defaut=%YEAR)",
     28#parser.add_option("--season", help="saison a traiter " "(eg : JJA, DJF, YEAR, defaut=%YEAR)",
     29#parser.add_option("-r", "--region", help="région a traiter " "(eg : GLOB, ATLTN, defaut=%GLOB)",
    2830                  action="store", default='YEAR')
    2931parser.add_option("-s", "--simulation", help="simulation+annees a traiter (sim_YYY1_YYY2) - laisser vide pour lister",
     
    3840parser.add_option("--dirpng",help="Path of the simulation directory", action="store",default=None)
    3941parser.add_option("-o", "--pdf", help="nom du pdf de sortie (default: atlas_<SIMU>_<SAISON>.pdf)", action="store")
     42parser.add_option("--lonmin", help="longitude minimale",action="store",default='0')
     43parser.add_option("--lonmax", help="longitude maximale",action="store",default='360')
     44parser.add_option("--latmin", help="latitude minimale",action="store",default='-90')
     45parser.add_option("--latmax", help="latitude maximale",action="store",default='90')
     46parser.add_option("--pmin", help="pression minimale",action="store",default='1')
    4047(opts, args) = parser.parse_args()
    4148
     49print 'pmin = ',opts.pmin
     50centerlon=float(opts.lonmax)-180
     51print 'centerlon = ',centerlon
     52#quit()
    4253#---------------------------------------------------------------------------------
    4354import math
     
    5162#
    5263clog('debug')
    53 crm(pattern='pme')
    54 crm(pattern='hflsevap')
     64#crm(pattern='pme')
     65#crm(pattern='hflsevap')
    5566#crm(pattern='tasmax')
    5667#crm(pattern='tasmin')
     
    8798#
    8899# -- Declare the script ml2pl for vertical interpolation
    89 cscript("ml2pl", "/home/jservon/Evaluation/CliMAF/Atlas_LMDz/ml2pl.sh -p ${var_2} -m ${var_1} ${in_1} ${out} ${in_2}",
     100cscript("ml2pl", "/home/fabric/LMDZ/atlas/ml2pl.sh -p ${var_2} -m ${var_1} ${in_1} ${out} ${in_2}",
    90101    commuteWithTimeConcatenation=True, commuteWithSpaceConcatenation=True)
    91102# -- Vertical levels for the vertical interpolation
     
    106117    #    interpolates the model on the ref, both vertically and horizontally, and returns the difference)
    107118    if is3d(variable) :
    108        simu_pres = svsg(opts.simulation,'pres',opts.season,opts.grid)
    109        simu = ml2pl(simu,simu_pres)
    110        if (ref != 'OBS' ) :
     119#cas1 sim2 != sim1 ; sim1 != OBS ; sim2 != OBS
     120       if (opts.simulation != 'OBS' and opts.reference != 'OBS' and opts.simulation != opts.reference ) :
     121           print 'simu = ',opts.simulation
     122           print 'reff = ',opts.reference
     123           simu_pres = svsg(opts.simulation,'pres',opts.season,opts.grid)
     124           simu = ml2pl(simu,simu_pres)
     125           simu = zonmean(simu)
     126           print 'simu = ',simu
    111127           reff_pres = svsg(opts.reference,'pres',opts.season,opts.grid)
    112128           reff = ml2pl(reff,reff_pres)
    113        simu = zonmean(simu)
    114        reff = zonmean(reff)
    115        diff = diff_zonmean(simu,reff)
    116     else:
    117         if (opts.grid == '' ) : reff=regrid(reff,simu)
     129           reff = zonmean(reff)
     130           print 'reff = ',reff
     131### IM250821 : projection grille horizontale
     132#          reff=regrid(reff,simu)
     133           simu=regrid(simu,reff)
     134### IM250821 end
     135           diff=minus(simu,reff)
     136           print 'diff_zonmean simu = ',diff
     137           print ' cas1 sim ref on pressure levels w/ zonmean '
     138#cas2 sim !=$ OBS ; ref = OBS
     139       elif (opts.simulation != 'OBS' and opts.reference == 'OBS' ) :
     140           print 'cas2'
     141### interpolation sur des niveaux de pression
     142           simu_pres = svsg(opts.simulation,'pres',opts.season,opts.grid)
     143           simu = ml2pl(simu,simu_pres)
     144### moyenne zonale
     145           simu = zonmean(simu)
     146### moyenne zonale
     147           reff = zonmean(reff)
     148### projection grille simu
     149           reff=regrid(reff,simu)
     150### differences moyennes zonales
     151           diff=minus(simu,reff)
     152           print ' cas2 sim ref on pressure levels w/ zonmean '
     153#cas3 sim1 = sim2
     154       elif ( opts.simulation == opts.reference and opts.simulation != 'OBS') :
     155           simu_pres = svsg(opts.simulation,'pres',opts.season,opts.grid)
     156           simu = ml2pl(simu,simu_pres)
     157           simu = zonmean(simu)
     158           reff = simu
     159           diff=minus(simu,reff)
     160           print ' cas3 sim ref on pressure levels w/ zonmean '
     161       else :
     162           print ' Cas non prevu !! '
     163           print ' Modifier l appel de atlas_none.py et relancer '
     164           exit(0)
     165    else:
     166#27.11.21 if (opts.grid == '' ) : reff=regrid(reff,simu)
     167        if ( opts.simulation != opts.reference ) : reff=regrid(reff,simu)
    118168        diff=minus(simu,reff)
    119169
    120170    pparams = plot_params(variable,'full_field')
     171    #print 'minp',opts.minp
     172    vertical_interval = 'trYMaxF=1000|trYMinF=1'
     173    #vertical_interval = 'trYMaxF=1000|trYMinF=100'
     174    #vertical_interval = 'trYMaxF=1000|trYMinF='+opts.pmin
    121175    vertical_interval = 'trYMaxF=1000|trYMinF=1'
    122176    stringFontHeight=0.018
    123177    if is3d(variable):
    124         pparams.update({'options':vertical_interval})
     178        #pparams.update({'options':vertical_interval, 'y':'lin'})
     179        pparams.update({'options':vertical_interval+'|gsnYAxisIrregular2Linear=True'})
    125180        stringFontHeight=0.03
    126181    # Map for simulation
    127     simu_fig=plot(simu,title="",
     182    simu_fig=plot(llbox(simu,lonmin=opts.lonmin,lonmax=opts.lonmax,latmin=opts.latmin,latmax=opts.latmax),
     183                  title="",
    128184                  gsnLeftString=variable,
    129185                  gsnCenterString=opts.simulation,
    130186                  gsnRightString=opts.season,
    131187                  gsnStringFontHeightF=stringFontHeight,
    132                   mpCenterLonF=0,
     188                  mpCenterLonF=centerlon,
    133189                  **pparams)
    134 ###11052021 begin
    135 #    # Single figures
     190#                 mpCenterLonF=0,
     191    # Single figures
    136192    page=cpage([[simu_fig]],orientation='landscape', page_trim=True, fig_trim=True)
    137193    pdf_page=cpage([[simu_fig]],orientation='landscape',
    138         page_trim=True, fig_trim=True, format='pdf', title=variable+" "+opts.simulation)
    139 #pdfargs.append(cfile(pdf_page,target='/home/fabric/users/musat/myatlas/simu_fig.pdf'))
    140     #pdffile="atlas_"+opts.simulation+"_"+opts.season+".pdf"
    141     #pdfargs.append(cfile(pdf_page,target=opts.simumapp))
    142     pdfargs.append(cfile(pdf_page,target=opts.dirpng+"/"+opts.season+"/"+opts.simulation+"/MAP/"+variable+".pdf"))
    143 #
    144 ###11052021 end
     194    page_trim=True, fig_trim=True, format='pdf', title=variable+" "+opts.simulation)
     195    print 'PB = ',opts.dirpng,opts.season,opts.simulation,'MAP',opts.region,variable
     196    pdfargs.append(cfile(pdf_page,target=opts.dirpng+"/"+opts.season+"/"+opts.simulation+"/MAP/"+opts.region+"/"+variable+".pdf"))
    145197    simu_avg=cvalue(space_average(simu))
    146198    #
    147199    # Map for reference
    148     ref_fig=plot(reff,title="",
     200    ref_fig=plot(llbox(reff,lonmin=opts.lonmin,lonmax=opts.lonmax,latmin=opts.latmin,latmax=opts.latmax),
     201                 title="",
    149202                 gsnLeftString=variable,
    150203                 gsnCenterString=ref,
    151204                 gsnRightString=opts.season,
    152205                 gsnStringFontHeightF=stringFontHeight,
    153                  mpCenterLonF=0,
     206                 mpCenterLonF=centerlon,
    154207                 **pparams)
    155 ###11052021 begin
     208#                mpCenterLonF=0,
    156209    #    # Single figures ref_fig
    157210    page=cpage([[ref_fig]],orientation='landscape', page_trim=True, fig_trim=True)
    158211    pdf_page=cpage([[ref_fig]],orientation='landscape',
    159212        page_trim=True, fig_trim=True, format='pdf', title=variable+" "+opts.simulation)
    160     pdfargs.append(cfile(pdf_page,target=opts.dirpng+"/"+opts.season+"/"+opts.reference+"/MAP/"+variable+".pdf"))
    161 ###11052021 end
     213    pdfargs.append(cfile(pdf_page,target=opts.dirpng+"/"+opts.season+"/"+opts.reference+"/MAP/"+opts.region+"/"+variable+".pdf"))
    162214    ref_avg=cvalue(space_average(reff))
    163215    #
     
    183235    #
    184236    if is3d(variable):
    185         p.update({'options':vertical_interval})
     237        #p.update({'options':vertical_interval, 'y':'lin'})
     238        p.update({'options':vertical_interval+'|gsnYAxisIrregular2Linear=True'})
    186239    if variable in ['ua','va','ta','hus','hur']:
    187240        tmp_levs = tmp_aux_params['colors']
    188241        p.update({'contours':tmp_levs})
    189         diff_fig=plot(diff,wreff,title="", format='png', mpCenterLonF=0,
     242        diff_fig=plot(llbox(diff,lonmin=opts.lonmin,lonmax=opts.lonmax,latmin=opts.latmin,latmax=opts.latmax),
     243                  llbox(wreff,lonmin=opts.lonmin,lonmax=opts.lonmax,latmin=opts.latmin,latmax=opts.latmax),
     244                  title="", format='png',
    190245                  gsnLeftString=variable,
    191246                  gsnCenterString=opts.simulation+' - '+ref,
     
    197252        pdf_page=cpage([[diff_fig]],orientation='landscape',
    198253                page_trim=True, fig_trim=True, format='pdf', title=variable+" "+opts.simulation)
    199         pdfargs.append(cfile(pdf_page,target=opts.dirpng+"/"+opts.season+"/"+opts.simulation+"/DMAP_"+opts.reference+"/"+variable+".pdf"))
     254        pdfargs.append(cfile(pdf_page,target=opts.dirpng+"/"+opts.season+"/"+opts.simulation+"/DMAP_"+opts.reference+"/"+opts.region+"/"+variable+".pdf"))
    200255    else:
    201256        p.update({'contours':1})
    202         diff_fig=plot(diff,title="", format='png', mpCenterLonF=0,
     257        diff_fig=plot(llbox(diff,lonmin=opts.lonmin,lonmax=opts.lonmax,latmin=opts.latmin,latmax=opts.latmax),
     258                  title="", format='png',
    203259                  gsnLeftString=variable,
    204260                  gsnCenterString=opts.simulation+' - '+ref,
    205261                  gsnRightString=opts.season,
    206262                  gsnStringFontHeightF=stringFontHeight,
     263                  mpCenterLonF=centerlon,
    207264                  **p)
     265#                 mpCenterLonF=0,
    208266
    209267    #
     
    218276        msimu = mul(wsimu,mask)
    219277        # -- Compute the zonal mean
    220         zmean=ccdo(msimu, operator='zonmean')
     278        zmean=ccdo(msimu, operator='zonmean')
    221279        ref_zmean=ccdo(wreff, operator='zonmean')
    222280        #
     
    254312                                 'gsnStringFontHeightF='+str(stringFontHeight))
    255313    #    # Single figures
    256         page=cpage([[simu_fig]],orientation='landscape', page_trim=True, fig_trim=True)
    257         pdf_page=cpage([[simu_fig]],orientation='landscape',
    258                 page_trim=True, fig_trim=True, format='pdf', title=variable+" "+opts.simulation)
    259         pdfargs.append(cfile(pdf_page,target=opts.dirpng+"/"+opts.season+"/"+opts.simulation+"/MAP/"+variable+".pdf"))
     314        page=cpage([[simu_fig]],orientation='landscape', page_trim=True, fig_trim=True)
     315        pdf_page=cpage([[simu_fig]],orientation='landscape',
     316                page_trim=True, fig_trim=True, format='pdf', title=variable+" "+opts.simulation)
     317        pdfargs.append(cfile(pdf_page,target=opts.dirpng+"/"+opts.season+"/"+opts.simulation+"/MAP/"+opts.region+"/"+variable+".pdf"))
    260318    #    # Single figures ref_fig
    261         page=cpage([[ref_fig]],orientation='landscape', page_trim=True, fig_trim=True)
    262         pdf_page=cpage([[ref_fig]],orientation='landscape',
    263                 page_trim=True, fig_trim=True, format='pdf', title=variable+" "+opts.simulation)
    264         pdfargs.append(cfile(pdf_page,target=opts.dirpng+"/"+opts.season+"/"+opts.reference+"/MAP/"+variable+".pdf"))
     319        page=cpage([[ref_fig]],orientation='landscape', page_trim=True, fig_trim=True)
     320        pdf_page=cpage([[ref_fig]],orientation='landscape',
     321                page_trim=True, fig_trim=True, format='pdf', title=variable+" "+opts.simulation)
     322        pdfargs.append(cfile(pdf_page,target=opts.dirpng+"/"+opts.season+"/"+opts.reference+"/MAP/"+opts.region+"/"+variable+".pdf"))
    265323    #    # Single figures diff_fig
    266         page=cpage([[diff_fig]],orientation='landscape', page_trim=True, fig_trim=True)
    267         pdf_page=cpage([[diff_fig]],orientation='landscape',
    268                 page_trim=True, fig_trim=True, format='pdf', title=variable+" "+opts.simulation)
    269         pdfargs.append(cfile(pdf_page,target=opts.dirpng+"/"+opts.season+"/"+opts.simulation+"/DMAP_"+opts.reference+"/"+variable+".pdf"))
     324        page=cpage([[diff_fig]],orientation='landscape', page_trim=True, fig_trim=True)
     325        pdf_page=cpage([[diff_fig]],orientation='landscape',
     326                page_trim=True, fig_trim=True, format='pdf', title=variable+" "+opts.simulation)
     327        pdfargs.append(cfile(pdf_page,target=opts.dirpng+"/"+opts.season+"/"+opts.simulation+"/DMAP_"+opts.reference+"/"+opts.region+"/"+variable+".pdf"))
    270328# Creation du Pdf multi-pages
    271         comm=subprocess.Popen(pdfargs, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     329        comm=subprocess.Popen(pdfargs, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    272330    #    # Composite figure
    273331    if is3d(variable):
     
    279337        pdf_page=cpage([[simu_fig,ref_fig],[diff_fig,zmean_fig]],orientation='landscape',
    280338                   page_trim=True, fig_trim=True, format='pdf', title=variable+" "+opts.simulation)
     339    pdfargs.append(cfile(pdf_page))
    281340    #
    282341    thumbnail_size = 200
     
    307366index += close_table()
    308367index += trailer()
    309 #out="index_example.html"
    310368out="index_"+opts.region+"_"+opts.season+"_"+opts.simulation+".html"
    311369with open(out,"w") as filout : filout.write(index)
Note: See TracChangeset for help on using the changeset viewer.