Changeset 8624a75 in flexpart.git


Ignore:
Timestamp:
Aug 24, 2017, 7:07:08 PM (7 years ago)
Author:
Don Morton <Don.Morton@…>
Branches:
FPv9.3.2, grib2nc4_repair
Children:
857dfd0
Parents:
4c0504c
Message:

Enhancements to FPv9.3.2

Documented in Ticket #182 (as well as CTBTO ticket 357)

Location:
flexpart_code
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • flexpart_code/fpmetbinary_mod.F90

    rfd86dea r8624a75  
    238238            ncret = nf90_def_dim(ncid, 'nxmax', nxmax, nxmax_dimid)
    239239            call handle_nf90_err(ncret)
     240! attributes
     241            ncret = nf90_put_att(ncid, ncvarid, "description","maximum dimension of wind fields in x")
     242            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     243
    240244            ncret = nf90_def_dim(ncid, 'nymax', nymax, nymax_dimid)
    241245            call handle_nf90_err(ncret)
     246! attributes
     247            ncret = nf90_put_att(ncid, ncvarid, "description","maximum dimension of wind fields in y")
     248            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     249
    242250            ncret = nf90_def_dim(ncid, 'nzmax', nzmax, nzmax_dimid)
    243251            call handle_nf90_err(ncret)
     252! attributes
     253            ncret = nf90_put_att(ncid, ncvarid, "description","maximum dimension of wind fields in z")
     254            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     255
    244256            ncret = nf90_def_dim(ncid, 'nuvzmax', nuvzmax, nuvzmax_dimid)
    245257            call handle_nf90_err(ncret)
     258! attributes
     259            ncret = nf90_put_att(ncid, ncvarid, "description"," maximum dimension of (u,v) wind field in z")
     260            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     261
    246262            ncret = nf90_def_dim(ncid, 'nwzmax', nwzmax, nwzmax_dimid)
    247263            call handle_nf90_err(ncret)
     264! attributes
     265            ncret = nf90_put_att(ncid, ncvarid, "description"," maximum dimension of w component of  wind field in z")
     266            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     267
    248268            ncret = nf90_def_dim(ncid, 'maxspec', maxspec, maxspec_dimid)
    249269            call handle_nf90_err(ncret)
     270! attributes
     271            ncret = nf90_put_att(ncid, ncvarid, "description"," maximum number of species")
     272            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     273
    250274            ncret = nf90_def_dim(ncid, 'numclass', numclass, numclass_dimid)
    251275            call handle_nf90_err(ncret)
     276! attributes
     277            ncret = nf90_put_att(ncid, ncvarid, "description"," maximum number of ageclasses")
     278            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    252279
    253280            ! There are a handful of variables indexed from 0 to n, rather than 0 to n-1,
     
    255282            ncret = nf90_def_dim(ncid, 'zero_to_nzmax', nzmax+1, zero_to_nzmax_dimid)
    256283            call handle_nf90_err(ncret)
     284! attributes
     285            ncret = nf90_put_att(ncid, ncvarid, "description","variable to change indexing of variables with nzmax dimension")
     286            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     287
    257288            ncret = nf90_def_dim(ncid, 'zero_to_maxnests', maxnests+1, zero_to_maxnests_dimid)
    258289            call handle_nf90_err(ncret)
     290! attributes
     291            ncret = nf90_put_att(ncid, ncvarid, "description","variable to change indexing of variables with maxnests dimension")
     292            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    259293
    260294            ! This is for a couple of small arrays that store polar stereographic stuff
    261295            ncret = nf90_def_dim(ncid, 'polemap_dim', 9, polemap_dimid)
    262296            call handle_nf90_err(ncret)
     297! attributes
     298            ncret = nf90_put_att(ncid, ncvarid, "description","variable to store polar stereographic indexing")
     299            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    263300
    264301            ! These two values come from conv_mod
    265302            ncret = nf90_def_dim(ncid, 'nconvlevmax_dim', nconvlevmax, nconvlevmax_dimid)
    266303            call handle_nf90_err(ncret)
     304! attributes
     305            ncret = nf90_put_att(ncid, ncvarid, "description","maximum number of levels for convection")
     306            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     307
    267308            ncret = nf90_def_dim(ncid, 'na_dim', na, na_dimid)
    268309            call handle_nf90_err(ncret)
     310! attributes
     311            ncret = nf90_put_att(ncid, ncvarid, "description","maximum number of levels for convection +1")
     312            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     313
    269314
    270315            ! Scalar values
    271 
    272316
    273317            dim1dids = (/preproc_fmt_str_dimid/)
     
    288332            ncret = nf90_put_var(ncid, ncvarid, nx)
    289333            call handle_nf90_err(ncret)
     334! attributes
     335            ncret = nf90_put_att(ncid, ncvarid, "description","actual dimensions of wind fields in x")
     336            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    290337
    291338            ncret = nf90_def_var(ncid, 'ny', NF90_INT, ncvarid)
     
    293340            ncret = nf90_put_var(ncid, ncvarid, ny)
    294341            call handle_nf90_err(ncret)
     342! attributes
     343            ncret = nf90_put_att(ncid, ncvarid, "description","actual dimensions of wind fields in y")
     344            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    295345
    296346            ncret = nf90_def_var(ncid, 'nxmin1', NF90_INT, ncvarid)
     
    298348            ncret = nf90_put_var(ncid, ncvarid, nxmin1)
    299349            call handle_nf90_err(ncret)
     350! attributes
     351            ncret = nf90_put_att(ncid, ncvarid, "description","actual dimensions of wind fields in x -1 (nx-1)")
     352            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    300353
    301354            ncret = nf90_def_var(ncid, 'nymin1', NF90_INT, ncvarid)
     
    303356            ncret = nf90_put_var(ncid, ncvarid, nymin1)
    304357            call handle_nf90_err(ncret)
     358! attributes
     359            ncret = nf90_put_att(ncid, ncvarid, "description","actual dimensions of wind fields in y -1 (ny-1)")
     360            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     361
    305362
    306363            ncret = nf90_def_var(ncid, 'nxfield', NF90_INT, ncvarid)
     
    308365            ncret = nf90_put_var(ncid, ncvarid, nxfield)
    309366            call handle_nf90_err(ncret)
     367! attributes
     368            ncret = nf90_put_att(ncid, ncvarid, "description","actual dimensions of wind fields in x for limited area fields")
     369            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    310370
    311371            ncret = nf90_def_var(ncid, 'nuvz', NF90_INT, ncvarid)
     
    313373            ncret = nf90_put_var(ncid, ncvarid, nuvz)
    314374            call handle_nf90_err(ncret)
     375! attributes
     376            ncret = nf90_put_att(ncid, ncvarid, "description","actual dimensions of (u,v) wind fields in z direction")
     377            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    315378
    316379            ncret = nf90_def_var(ncid, 'nwz', NF90_INT, ncvarid)
     
    318381            ncret = nf90_put_var(ncid, ncvarid, nwz)
    319382            call handle_nf90_err(ncret)
     383! attributes
     384            ncret = nf90_put_att(ncid, ncvarid, "description","actual dimensions of w wind fields in z direction")
     385            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    320386
    321387            ncret = nf90_def_var(ncid, 'nz', NF90_INT, ncvarid)
     
    323389            ncret = nf90_put_var(ncid, ncvarid, nz)
    324390            call handle_nf90_err(ncret)
     391! attributes
     392            ncret = nf90_put_att(ncid, ncvarid, "description","number of vertical levels in the transformed coordinates")
     393            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    325394
    326395            ncret = nf90_def_var(ncid, 'nmixz', NF90_INT, ncvarid)
     
    328397            ncret = nf90_put_var(ncid, ncvarid, nmixz)
    329398            call handle_nf90_err(ncret)
     399! attributes
     400            ncret = nf90_put_att(ncid, ncvarid, "description","number of levels up to maximum PBL height (3500 m)")
     401            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    330402
    331403            ncret = nf90_def_var(ncid, 'nlev_ec', NF90_INT, ncvarid)
     
    333405            ncret = nf90_put_var(ncid, ncvarid, nlev_ec)
    334406            call handle_nf90_err(ncret)
     407! attributes
     408            ncret = nf90_put_att(ncid, ncvarid, "description","number of vertical levels ecmwf model")
     409            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    335410
    336411            ncret = nf90_def_var(ncid, 'dx', NF90_FLOAT, ncvarid)
     
    338413            ncret = nf90_put_var(ncid, ncvarid, dx)
    339414            call handle_nf90_err(ncret)
     415! attributes
     416            ncret = nf90_put_att(ncid, ncvarid, "description","grid distance in x direction")
     417            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    340418
    341419            ncret = nf90_def_var(ncid, 'dy', NF90_FLOAT, ncvarid)
     
    343421            ncret = nf90_put_var(ncid, ncvarid, dy)
    344422            call handle_nf90_err(ncret)
     423! attributes
     424            ncret = nf90_put_att(ncid, ncvarid, "description","grid distance in y direction")
     425            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    345426
    346427            ncret = nf90_def_var(ncid, 'xlon0', NF90_FLOAT, ncvarid)
     
    348429            ncret = nf90_put_var(ncid, ncvarid, xlon0)
    349430            call handle_nf90_err(ncret)
     431! attributes
     432            ncret = nf90_put_att(ncid, ncvarid, "description","geographical longitude of the lower left corner of the wind fields")
     433            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    350434
    351435            ncret = nf90_def_var(ncid, 'ylat0', NF90_FLOAT, ncvarid)
     
    353437            ncret = nf90_put_var(ncid, ncvarid, ylat0)
    354438            call handle_nf90_err(ncret)
     439! attributes
     440            ncret = nf90_put_att(ncid, ncvarid, "description","geographical latitude of the lower left corner of the wind fields")
     441            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    355442
    356443            ncret = nf90_def_var(ncid, 'dxconst', NF90_FLOAT, ncvarid)
     
    358445            ncret = nf90_put_var(ncid, ncvarid, dxconst)
    359446            call handle_nf90_err(ncret)
     447! attributes
     448            ncret = nf90_put_att(ncid, ncvarid, "description","auxiliary variable needed for utransform")
     449            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    360450
    361451            ncret = nf90_def_var(ncid, 'dyconst', NF90_FLOAT, ncvarid)
     
    363453            ncret = nf90_put_var(ncid, ncvarid, dyconst)
    364454            call handle_nf90_err(ncret)
    365 
    366 
     455! attributes
     456            ncret = nf90_put_att(ncid, ncvarid, "description","auxiliary variable needed for vtransform")
     457            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    367458
    368459            ! Fixed fields, static in time
     
    380471&                                oro(0:nxmax-1, 0:nymax-1))
    381472            call handle_nf90_err(ncret)
     473! attributes
     474            ncret = nf90_put_att(ncid, ncvarid, "description","orography of the ECMWF model")
     475            ncret = nf90_put_att(ncid, ncvarid, "units","m")
     476
    382477
    383478            ncret = nf90_def_var(ncid, 'excessoro', NF90_FLOAT, &
     
    392487&                                excessoro(0:nxmax-1, 0:nymax-1))
    393488            call handle_nf90_err(ncret)
     489! attributes
     490            ncret = nf90_put_att(ncid, ncvarid, "description","excess orography mother domain")
     491            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     492
    394493
    395494            ncret = nf90_def_var(ncid, 'lsm', NF90_FLOAT, &
     
    404503&                                lsm(0:nxmax-1, 0:nymax-1))
    405504            call handle_nf90_err(ncret)
     505! attributes
     506            ncret = nf90_put_att(ncid, ncvarid, "description","land sea mask")
     507            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     508
    406509
    407510            dim3dids = (/nxmax_dimid, nymax_dimid, numclass_dimid/)
     
    418521&                                xlanduse(0:nxmax-1, 0:nymax-1, 1:numclass))
    419522            call handle_nf90_err(ncret)
     523! attributes
     524            ncret = nf90_put_att(ncid, ncvarid, "description","area fraction in percent")
     525            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     526
    420527
    421528            dim1dids = (/nzmax_dimid/)
     
    431538&                                height(1:nzmax))
    432539            call handle_nf90_err(ncret)
    433 
     540! attributes
     541            ncret = nf90_put_att(ncid, ncvarid, "description","heights of all model levels")
     542            ncret = nf90_put_att(ncid, ncvarid, "units","m")
    434543
    435544
     
    449558&                                uu(0:nxmax-1, 0:nymax-1, 1:nzmax, cm_index))
    450559            call handle_nf90_err(ncret)
     560! attributes
     561            ncret = nf90_put_att(ncid, ncvarid, "description","U component of wind in the [horizontal] direction")
     562            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-1")
    451563
    452564            ncret = nf90_def_var(ncid, 'vv', NF90_FLOAT, &
     
    461573&                                vv(0:nxmax-1, 0:nymax-1, 1:nzmax, cm_index))
    462574            call handle_nf90_err(ncret)
     575! attributes
     576            ncret = nf90_put_att(ncid, ncvarid, "description","V component of wind in the Y[horizontal] direction")
     577            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-1")
     578
    463579
    464580            ncret = nf90_def_var(ncid, 'uupol', NF90_FLOAT, &
     
    473589&                                uupol(0:nxmax-1, 0:nymax-1, 1:nzmax, cm_index))
    474590            call handle_nf90_err(ncret)
     591! attributes
     592            ncret = nf90_put_att(ncid, ncvarid, "description","horizontal component in polar stereographic projection of wind")
     593            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-1")
     594
    475595
    476596            ncret = nf90_def_var(ncid, 'vvpol', NF90_FLOAT, &
     
    485605&                                vvpol(0:nxmax-1, 0:nymax-1, 1:nzmax, cm_index))
    486606            call handle_nf90_err(ncret)
     607! attributes
     608            ncret = nf90_put_att(ncid, ncvarid, "description","horizontal component in polar stereographic projection of wind")
     609            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-1")
     610
    487611
    488612            ncret = nf90_def_var(ncid, 'ww', NF90_FLOAT, &
     
    497621&                                ww(0:nxmax-1, 0:nymax-1, 1:nzmax, cm_index))
    498622            call handle_nf90_err(ncret)
     623! attributes
     624            ncret = nf90_put_att(ncid, ncvarid, "description","wind component in the Z[vertical] direction")
     625            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-1")
     626
    499627
    500628            ncret = nf90_def_var(ncid, 'tt', NF90_FLOAT, &
     
    509637&                                tt(0:nxmax-1, 0:nymax-1, 1:nzmax, cm_index))
    510638            call handle_nf90_err(ncret)
     639! attributes
     640            ncret = nf90_put_att(ncid, ncvarid, "description","temperature")
     641            ncret = nf90_put_att(ncid, ncvarid, "units","K")
     642
    511643
    512644            ncret = nf90_def_var(ncid, 'qv', NF90_FLOAT, &
     
    521653&                                qv(0:nxmax-1, 0:nymax-1, 1:nzmax, cm_index))
    522654            call handle_nf90_err(ncret)
     655! attributes
     656            ncret = nf90_put_att(ncid, ncvarid, "description","specific humidity data")
     657            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    523658
    524659            ncret = nf90_def_var(ncid, 'pv', NF90_FLOAT, &
     
    533668&                                pv(0:nxmax-1, 0:nymax-1, 1:nzmax, cm_index))
    534669            call handle_nf90_err(ncret)
     670! attributes
     671            ncret = nf90_put_att(ncid, ncvarid, "description","potential vorticity")
     672            ncret = nf90_put_att(ncid, ncvarid, "units","K*m**2 kg**-1 s**-1")
     673
    535674
    536675            ncret = nf90_def_var(ncid, 'rho', NF90_FLOAT, &
     
    545684&                                rho(0:nxmax-1, 0:nymax-1, 1:nzmax, cm_index))
    546685            call handle_nf90_err(ncret)
     686! attributes
     687            ncret = nf90_put_att(ncid, ncvarid, "description","air density")
     688            ncret = nf90_put_att(ncid, ncvarid, "units","kg m**-3")
     689
    547690
    548691            ncret = nf90_def_var(ncid, 'drhodz', NF90_FLOAT, &
     
    557700&                                drhodz(0:nxmax-1, 0:nymax-1, 1:nzmax, cm_index))
    558701            call handle_nf90_err(ncret)
     702! attributes
     703            ncret = nf90_put_att(ncid, ncvarid, "description","vertical air density gradient")
     704            ncret = nf90_put_att(ncid, ncvarid, "units","kg m**-2")
     705
    559706
    560707            ncret = nf90_def_var(ncid, 'clouds', NF90_BYTE, &
     
    569716&                                clouds(0:nxmax-1, 0:nymax-1, 1:nzmax, cm_index))
    570717            call handle_nf90_err(ncret)
    571 
     718! attributes
     719            ncret = nf90_put_att(ncid, ncvarid, "description","vcloud mask, &
     720                                 no cloud no precip = 0, cloud no precip = 1, &
     721                                 rainout  conv/lsp dominated  2/3, &
     722                                 washout  conv/lsp dominated = 4/5 ")
     723            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    572724
    573725
     
    586738&                                tth(0:nxmax-1, 0:nymax-1, 1:nuvzmax, cm_index))
    587739            call handle_nf90_err(ncret)
     740! attributes
     741            ncret = nf90_put_att(ncid, ncvarid, "description","temperature in the original input model level")
     742            ncret = nf90_put_att(ncid, ncvarid, "units","K")
     743
    588744
    589745            ncret = nf90_def_var(ncid, 'qvh', NF90_FLOAT, &
     
    598754&                                qvh(0:nxmax-1, 0:nymax-1, 1:nuvzmax, cm_index))
    599755            call handle_nf90_err(ncret)
     756! attributes
     757            ncret = nf90_put_att(ncid, ncvarid, "description","specific humidity in the original input model level")
     758            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     759
    600760
    601761            ncret = nf90_def_var(ncid, 'pplev', NF90_FLOAT, &
     
    610770&                                pplev(0:nxmax-1, 0:nymax-1, 1:nuvzmax, cm_index))
    611771            call handle_nf90_err(ncret)
     772! attributes
     773            ncret = nf90_put_att(ncid, ncvarid, "description","pressure in pressure levels for GFS version")
     774            ncret = nf90_put_att(ncid, ncvarid, "units","Pa")
    612775
    613776
     
    624787&                                cloudsh(0:nxmax-1, 0:nymax-1, cm_index))
    625788            call handle_nf90_err(ncret)
     789! attributes
     790            ncret = nf90_put_att(ncid, ncvarid, "description","height of the cloud layer")
     791            ncret = nf90_put_att(ncid, ncvarid, "units","m")
    626792
    627793
     
    649815&                                ps(0:nxmax-1, 0:nymax-1, 1, cm_index))
    650816            call handle_nf90_err(ncret)
     817! attributes
     818            ncret = nf90_put_att(ncid, ncvarid, "description","surface pressure")
     819            ncret = nf90_put_att(ncid, ncvarid, "units","Pa")
     820
    651821
    652822            ncret = nf90_def_var(ncid, 'sd', NF90_FLOAT, &
     
    661831&                                sd(0:nxmax-1, 0:nymax-1, 1, cm_index))
    662832            call handle_nf90_err(ncret)
     833! attributes
     834            ncret = nf90_put_att(ncid, ncvarid, "description","snow depth")
     835            ncret = nf90_put_att(ncid, ncvarid, "units","m")
     836
    663837
    664838            ncret = nf90_def_var(ncid, 'msl', NF90_FLOAT, &
     
    673847&                                msl(0:nxmax-1, 0:nymax-1, 1, cm_index))
    674848            call handle_nf90_err(ncret)
     849! attributes
     850            ncret = nf90_put_att(ncid, ncvarid, "description","mean sea level pressure")
     851            ncret = nf90_put_att(ncid, ncvarid, "units","Pa")
     852
    675853
    676854            ncret = nf90_def_var(ncid, 'tcc', NF90_FLOAT, &
     
    685863&                                tcc(0:nxmax-1, 0:nymax-1, 1, cm_index))
    686864            call handle_nf90_err(ncret)
     865! attributes
     866            ncret = nf90_put_att(ncid, ncvarid, "description","total cloud cover")
     867            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     868
    687869
    688870            ncret = nf90_def_var(ncid, 'u10', NF90_FLOAT, &
     
    697879&                                u10(0:nxmax-1, 0:nymax-1, 1, cm_index))
    698880            call handle_nf90_err(ncret)
     881! attributes
     882            ncret = nf90_put_att(ncid, ncvarid, "description","10 m u component of wind velocity")
     883            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-1")
    699884
    700885            ncret = nf90_def_var(ncid, 'v10', NF90_FLOAT, &
     
    709894&                                v10(0:nxmax-1, 0:nymax-1, 1, cm_index))
    710895            call handle_nf90_err(ncret)
     896! attributes
     897            ncret = nf90_put_att(ncid, ncvarid, "description","10 m v component of wind velocity")
     898            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-1")
     899
    711900
    712901            ncret = nf90_def_var(ncid, 'tt2', NF90_FLOAT, &
     
    721910&                                tt2(0:nxmax-1, 0:nymax-1, 1, cm_index))
    722911            call handle_nf90_err(ncret)
     912! attributes
     913            ncret = nf90_put_att(ncid, ncvarid, "description","2 m temperature")
     914            ncret = nf90_put_att(ncid, ncvarid, "units","K")
     915
    723916
    724917            ncret = nf90_def_var(ncid, 'td2', NF90_FLOAT, &
     
    733926&                                td2(0:nxmax-1, 0:nymax-1, 1, cm_index))
    734927            call handle_nf90_err(ncret)
     928! attributes
     929            ncret = nf90_put_att(ncid, ncvarid, "description","2 m dew point temperature")
     930            ncret = nf90_put_att(ncid, ncvarid, "units","K")
     931
    735932
    736933            ncret = nf90_def_var(ncid, 'lsprec', NF90_FLOAT, &
     
    745942&                                lsprec(0:nxmax-1, 0:nymax-1, 1, cm_index))
    746943            call handle_nf90_err(ncret)
     944! attributes
     945            ncret = nf90_put_att(ncid, ncvarid, "description","large scale total precipitation")
     946            ncret = nf90_put_att(ncid, ncvarid, "units","mm h**-1")
     947
    747948
    748949            ncret = nf90_def_var(ncid, 'convprec', NF90_FLOAT, &
     
    757958&                                convprec(0:nxmax-1, 0:nymax-1, 1, cm_index))
    758959            call handle_nf90_err(ncret)
     960! attributes
     961            ncret = nf90_put_att(ncid, ncvarid, "description","convective precipitation")
     962            ncret = nf90_put_att(ncid, ncvarid, "units","mm h**-1")
     963
    759964
    760965            ncret = nf90_def_var(ncid, 'sshf', NF90_FLOAT, &
     
    769974&                                sshf(0:nxmax-1, 0:nymax-1, 1, cm_index))
    770975            call handle_nf90_err(ncret)
     976! attributes
     977            ncret = nf90_put_att(ncid, ncvarid, "description","surface sensible heat flux")
     978            ncret = nf90_put_att(ncid, ncvarid, "units","J m**-2")
     979
    771980
    772981            ncret = nf90_def_var(ncid, 'ssr', NF90_FLOAT, &
     
    781990&                                ssr(0:nxmax-1, 0:nymax-1, 1, cm_index))
    782991            call handle_nf90_err(ncret)
     992! attributes
     993            ncret = nf90_put_att(ncid, ncvarid, "description","surface solar radiation")
     994            ncret = nf90_put_att(ncid, ncvarid, "units","J m**-2")
     995
    783996
    784997            ncret = nf90_def_var(ncid, 'surfstr', NF90_FLOAT, &
     
    7931006&                                surfstr(0:nxmax-1, 0:nymax-1, 1, cm_index))
    7941007            call handle_nf90_err(ncret)
     1008! attributes
     1009            ncret = nf90_put_att(ncid, ncvarid, "description","surface stress")
     1010            ncret = nf90_put_att(ncid, ncvarid, "units","N m**-2 s")
     1011
    7951012
    7961013            ncret = nf90_def_var(ncid, 'ustar', NF90_FLOAT, &
     
    8051022&                                ustar(0:nxmax-1, 0:nymax-1, 1, cm_index))
    8061023            call handle_nf90_err(ncret)
     1024! attributes
     1025            ncret = nf90_put_att(ncid, ncvarid, "description","friction velocity")
     1026            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-1")
     1027
    8071028
    8081029            ncret = nf90_def_var(ncid, 'wstar', NF90_FLOAT, &
     
    8171038&                                wstar(0:nxmax-1, 0:nymax-1, 1, cm_index))
    8181039            call handle_nf90_err(ncret)
     1040! attributes
     1041            ncret = nf90_put_att(ncid, ncvarid, "description","convective velocity scale")
     1042            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-1")
     1043
    8191044
    8201045            ncret = nf90_def_var(ncid, 'hmix', NF90_FLOAT, &
     
    8291054&                                hmix(0:nxmax-1, 0:nymax-1, 1, cm_index))
    8301055            call handle_nf90_err(ncret)
     1056! attributes
     1057            ncret = nf90_put_att(ncid, ncvarid, "description","mixing height")
     1058            ncret = nf90_put_att(ncid, ncvarid, "units","m")
     1059
    8311060
    8321061            ncret = nf90_def_var(ncid, 'tropopause', NF90_FLOAT, &
     
    8411070&                                tropopause(0:nxmax-1, 0:nymax-1, 1, cm_index))
    8421071            call handle_nf90_err(ncret)
     1072! attributes
     1073            ncret = nf90_put_att(ncid, ncvarid, "description","altitude of thermal tropopause")
     1074            ncret = nf90_put_att(ncid, ncvarid, "units","m")
     1075
    8431076
    8441077            ncret = nf90_def_var(ncid, 'oli', NF90_FLOAT, &
     
    8531086&                                oli(0:nxmax-1, 0:nymax-1, 1, cm_index))
    8541087            call handle_nf90_err(ncret)
     1088! attributes
     1089            ncret = nf90_put_att(ncid, ncvarid, "description","inverse Obukhov length (1/L)")
     1090            ncret = nf90_put_att(ncid, ncvarid, "units","m")
     1091
    8551092
    8561093            ncret = nf90_def_var(ncid, 'diffk', NF90_FLOAT, &
     
    8651102&                                diffk(0:nxmax-1, 0:nymax-1, 1, cm_index))
    8661103            call handle_nf90_err(ncret)
    867 
     1104! attributes
     1105            ncret = nf90_put_att(ncid, ncvarid, "description","diffusion coefficient at reference height")
     1106            ncret = nf90_put_att(ncid, ncvarid, "units","m**2 s**-1")
    8681107
    8691108
     
    8881127&                                vdep(0:nxmax-1, 0:nymax-1, 1:maxspec, cm_index))
    8891128            call handle_nf90_err(ncret)
    890 
     1129! attributes
     1130            ncret = nf90_put_att(ncid, ncvarid, "description","deposition velocity")
     1131            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-2")
    8911132
    8921133
     
    9021143            ncret = nf90_put_var(ncid, ncvarid, &
    9031144&                                z0(1:numclass))
     1145! attributes
     1146            ncret = nf90_put_att(ncid, ncvarid, "description","surface roughness length")
     1147            ncret = nf90_put_att(ncid, ncvarid, "units","m")
    9041148
    9051149
     
    9171161&                                akm(1:nwzmax))
    9181162            call handle_nf90_err(ncret)
     1163! attributes
     1164            ncret = nf90_put_att(ncid, ncvarid, "description","ECMWF vertical discretization parameter")
     1165            ncret = nf90_put_att(ncid, ncvarid, "units","Pa")
     1166
    9191167
    9201168            ncret = nf90_def_var(ncid, 'bkm', NF90_FLOAT, &
     
    9291177&                                bkm(1:nwzmax))
    9301178            call handle_nf90_err(ncret)
     1179! attributes
     1180            ncret = nf90_put_att(ncid, ncvarid, "description","ECMWF  vertical discretization parameter")
     1181            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    9311182
    9321183
     
    9441195&                                akz(1:nuvzmax))
    9451196            call handle_nf90_err(ncret)
     1197! attributes
     1198            ncret = nf90_put_att(ncid, ncvarid, "description","ECMWF vertical discretization parameter at center of layer")
     1199            ncret = nf90_put_att(ncid, ncvarid, "units","Pa")
     1200
    9461201
    9471202            ncret = nf90_def_var(ncid, 'bkz', NF90_FLOAT, &
     
    9561211&                                bkz(1:nuvzmax))
    9571212            call handle_nf90_err(ncret)
     1213! attributes
     1214            ncret = nf90_put_att(ncid, ncvarid, "description","ECMWF vertical discretization parameter at center of layer")
     1215            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    9581216
    9591217
     
    9711229&                                aknew(1:nzmax))
    9721230            call handle_nf90_err(ncret)
     1231! attributes
     1232            ncret = nf90_put_att(ncid, ncvarid, "description","model discretization coefficient at the interpolated levels")
     1233            ncret = nf90_put_att(ncid, ncvarid, "units","Pa")
    9731234
    9741235            ncret = nf90_def_var(ncid, 'bknew', NF90_FLOAT, &
     
    9831244&                                bknew(1:nzmax))
    9841245            call handle_nf90_err(ncret)
     1246! attributes
     1247            ncret = nf90_put_att(ncid, ncvarid, "description","model discretization coefficient at the interpolated levels")
     1248            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    9851249
    9861250
     
    10171281&                                nxn(1:maxnests))
    10181282            call handle_nf90_err(ncret)
     1283! attributes
     1284            ncret = nf90_put_att(ncid, ncvarid, "description","actual dimensions of wind fields in x for the nexted domain")
     1285
    10191286
    10201287            ncret = nf90_def_var(ncid, 'nyn', NF90_INT, &
     
    10291296&                                nyn(1:maxnests))
    10301297            call handle_nf90_err(ncret)
     1298! attributes
     1299            ncret = nf90_put_att(ncid, ncvarid, "description","actual dimensions of wind fields in y for the nested domain")
     1300            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     1301
    10311302
    10321303            ncret = nf90_def_var(ncid, 'dxn', NF90_FLOAT, &
     
    10411312&                                dxn(1:maxnests))
    10421313            call handle_nf90_err(ncret)
     1314! attributes
     1315            ncret = nf90_put_att(ncid, ncvarid, "description","grid distance in x direction for the nested domain")
     1316            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     1317
    10431318
    10441319            ncret = nf90_def_var(ncid, 'dyn', NF90_FLOAT, &
     
    10531328&                                dyn(1:maxnests))
    10541329            call handle_nf90_err(ncret)
     1330! attributes
     1331            ncret = nf90_put_att(ncid, ncvarid, "description","grid distance in y direction for the nested domain")
     1332            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     1333
    10551334
    10561335            ncret = nf90_def_var(ncid, 'xlon0n', NF90_FLOAT, &
     
    10651344&                                xlon0n(1:maxnests))
    10661345            call handle_nf90_err(ncret)
     1346! attributes
     1347            ncret = nf90_put_att(ncid, ncvarid, "description","geographical longitude of the &
     1348                                lower left corner of the nested wind fields")
     1349            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     1350
    10671351
    10681352            ncret = nf90_def_var(ncid, 'ylat0n', NF90_FLOAT, &
     
    10771361&                                ylat0n(1:maxnests))
    10781362            call handle_nf90_err(ncret)
    1079 
    1080 
     1363! attributes
     1364            ncret = nf90_put_att(ncid, ncvarid, "description","geographical latitude of &
     1365                                 the lower left corner of the nested wind fields")
     1366            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    10811367
    10821368
     
    10951381&                                oron(0:nxmaxn-1, 0:nymaxn-1, 1:maxnests))
    10961382            call handle_nf90_err(ncret)
     1383! attributes
     1384            ncret = nf90_put_att(ncid, ncvarid, "description","orography of the ECMWF model for the nested domain")
     1385            ncret = nf90_put_att(ncid, ncvarid, "units","m")
     1386
    10971387
    10981388            ncret = nf90_def_var(ncid, 'excessoron', NF90_FLOAT, &
     
    11071397&                                excessoron(0:nxmaxn-1, 0:nymaxn-1, 1:maxnests))
    11081398            call handle_nf90_err(ncret)
     1399! attributes
     1400            ncret = nf90_put_att(ncid, ncvarid, "description","excess orography nested domain")
     1401            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     1402
    11091403
    11101404            ncret = nf90_def_var(ncid, 'lsmn', NF90_FLOAT, &
     
    11191413&                                lsmn(0:nxmaxn-1, 0:nymaxn-1, 1:maxnests))
    11201414            call handle_nf90_err(ncret)
     1415! attributes
     1416            ncret = nf90_put_att(ncid, ncvarid, "description","land sea mask for the nested domian")
     1417            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     1418
    11211419
    11221420            dim4dids = (/nxmaxn_dimid, nymaxn_dimid, numclass_dimid, maxnests_dimid/)
     
    11331431&                                xlandusen(0:nxmaxn-1, 0:nymaxn-1, 1:numclass, 1:maxnests))
    11341432            call handle_nf90_err(ncret)
     1433! attributes
     1434            ncret = nf90_put_att(ncid, ncvarid, "description","area fraction in percent for the nested domain")
     1435            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     1436
    11351437
    11361438!            PRINT *, 'SUM(oron): ', SUM(oron)
     
    11521454&                                uun(0:nxmaxn-1, 0:nymaxn-1, 1:nzmax, cm_index, 1:maxnests))
    11531455            call handle_nf90_err(ncret)
     1456! attributes
     1457            ncret = nf90_put_att(ncid, ncvarid, "description","U component of wind in the [horizontal] &
     1458                                 direction for the nested domain")
     1459            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-1")
     1460
    11541461
    11551462            ncret = nf90_def_var(ncid, 'vvn', NF90_FLOAT, &
     
    11641471&                                vvn(0:nxmaxn-1, 0:nymaxn-1, 1:nzmax, cm_index, 1:maxnests))
    11651472            call handle_nf90_err(ncret)
     1473! attributes
     1474            ncret = nf90_put_att(ncid, ncvarid, "description","V component of wind in the Y[horizontal] &
     1475                                 direction for the nested domain")
     1476            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-1")
    11661477
    11671478            ncret = nf90_def_var(ncid, 'wwn', NF90_FLOAT, &
     
    11761487&                                wwn(0:nxmaxn-1, 0:nymaxn-1, 1:nzmax, cm_index, 1:maxnests))
    11771488            call handle_nf90_err(ncret)
     1489! attributes
     1490            ncret = nf90_put_att(ncid, ncvarid, "description","wind componend in the Z[vertical] &
     1491                                  direction for the nested domain")
     1492            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-1")
     1493
    11781494
    11791495            ncret = nf90_def_var(ncid, 'ttn', NF90_FLOAT, &
     
    11881504&                                ttn(0:nxmaxn-1, 0:nymaxn-1, 1:nzmax, cm_index, 1:maxnests))
    11891505            call handle_nf90_err(ncret)
     1506! attributes
     1507            ncret = nf90_put_att(ncid, ncvarid, "description","temperature for the nested domain")
     1508            ncret = nf90_put_att(ncid, ncvarid, "units","K")
     1509
    11901510
    11911511            ncret = nf90_def_var(ncid, 'qvn', NF90_FLOAT, &
     
    12001520&                                qvn(0:nxmaxn-1, 0:nymaxn-1, 1:nzmax, cm_index, 1:maxnests))
    12011521            call handle_nf90_err(ncret)
     1522! attributes
     1523            ncret = nf90_put_att(ncid, ncvarid, "description","specific humidity data for the nested domain")
     1524            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    12021525
    12031526            ncret = nf90_def_var(ncid, 'pvn', NF90_FLOAT, &
     
    12121535&                                pvn(0:nxmaxn-1, 0:nymaxn-1, 1:nzmax, cm_index, 1:maxnests))
    12131536            call handle_nf90_err(ncret)
     1537! attributes
     1538            ncret = nf90_put_att(ncid, ncvarid, "description","potential vorticity for the nested domain")
     1539            ncret = nf90_put_att(ncid, ncvarid, "units","K*m**2 kg**-1 s**-1")
    12141540
    12151541            ncret = nf90_def_var(ncid, 'rhon', NF90_FLOAT, &
     
    12241550&                                rhon(0:nxmaxn-1, 0:nymaxn-1, 1:nzmax, cm_index, 1:maxnests))
    12251551            call handle_nf90_err(ncret)
     1552! attributes
     1553            ncret = nf90_put_att(ncid, ncvarid, "description","air density for the nested domain")
     1554            ncret = nf90_put_att(ncid, ncvarid, "units","kg m**-3")
     1555
    12261556
    12271557            ncret = nf90_def_var(ncid, 'drhodzn', NF90_FLOAT, &
     
    12361566&                                drhodzn(0:nxmaxn-1, 0:nymaxn-1, 1:nzmax, cm_index, 1:maxnests))
    12371567            call handle_nf90_err(ncret)
     1568! attributes
     1569            ncret = nf90_put_att(ncid, ncvarid, "description","vertical air density gradient for the nested domain")
     1570            ncret = nf90_put_att(ncid, ncvarid, "units","kg m**-2")
    12381571
    12391572
     
    12521585&                                tthn(0:nxmaxn-1, 0:nymaxn-1, 1:nuvzmax, cm_index, 1:maxnests))
    12531586            call handle_nf90_err(ncret)
     1587! attributes
     1588            ncret = nf90_put_att(ncid, ncvarid, "description","temperature in the original &
     1589                                 input model level for the nested domain")
     1590            ncret = nf90_put_att(ncid, ncvarid, "units","K")
     1591
    12541592
    12551593            ncret = nf90_def_var(ncid, 'qvhn', NF90_FLOAT, &
     
    12641602&                                qvhn(0:nxmaxn-1, 0:nymaxn-1, 1:nuvzmax, cm_index, 1:maxnests))
    12651603            call handle_nf90_err(ncret)
     1604! attributes
     1605            ncret = nf90_put_att(ncid, ncvarid, "description","specific humidity in the original &
     1606                                input model level for the nested domain")
     1607            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     1608
    12661609
    12671610            ! Note the new dimensions
     
    12791622&                                cloudsn(0:nxmaxn-1, 0:nymaxn-1, 0:nzmax, cm_index, 1:maxnests))
    12801623            call handle_nf90_err(ncret)
     1624! attributes
     1625            ncret = nf90_put_att(ncid, ncvarid, "description","vcloud mask, &
     1626                                 no cloud no precip = 0, cloud no precip = 1, &
     1627                                 rainout  conv/lsp dominated  2/3, &
     1628                                 washout  conv/lsp dominated = 4/5 for the nested domain")
     1629            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     1630
    12811631
    12821632            ! Note the new dimensions
     
    12941644&                                cloudsnh(0:nxmaxn-1, 0:nymaxn-1, cm_index, 1:maxnests))
    12951645            call handle_nf90_err(ncret)
     1646! attributes
     1647            ncret = nf90_put_att(ncid, ncvarid, "description","cloud mask at the horizontal levels")
     1648            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     1649
    12961650
    12971651
     
    13161670&                                psn(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    13171671            call handle_nf90_err(ncret)
     1672! attributes
     1673            ncret = nf90_put_att(ncid, ncvarid, "description","surface pressure of the nested domian")
     1674            ncret = nf90_put_att(ncid, ncvarid, "units","Pa")
     1675
    13181676
    13191677            ncret = nf90_def_var(ncid, 'sdn', NF90_FLOAT, &
     
    13281686&                                sdn(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    13291687            call handle_nf90_err(ncret)
     1688! attributes
     1689            ncret = nf90_put_att(ncid, ncvarid, "description","snow depth for the nested domain")
     1690            ncret = nf90_put_att(ncid, ncvarid, "units","m")
     1691
    13301692
    13311693            ncret = nf90_def_var(ncid, 'msln', NF90_FLOAT, &
     
    13401702&                                msln(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    13411703            call handle_nf90_err(ncret)
     1704! attributes
     1705            ncret = nf90_put_att(ncid, ncvarid, "description","mean sea level pressure for the nested domain")
     1706            ncret = nf90_put_att(ncid, ncvarid, "units","Pa")
     1707
    13421708
    13431709            ncret = nf90_def_var(ncid, 'tccn', NF90_FLOAT, &
     
    13521718&                                tccn(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    13531719            call handle_nf90_err(ncret)
     1720! attributes
     1721            ncret = nf90_put_att(ncid, ncvarid, "description","total cloud cover for the nested domain")
     1722            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     1723
    13541724
    13551725            ncret = nf90_def_var(ncid, 'u10n', NF90_FLOAT, &
     
    13641734&                                u10n(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    13651735            call handle_nf90_err(ncret)
     1736! attributes
     1737            ncret = nf90_put_att(ncid, ncvarid, "description","10 m u component of wind velocity for the nested domain")
     1738            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-1")
    13661739
    13671740            ncret = nf90_def_var(ncid, 'v10n', NF90_FLOAT, &
     
    13761749&                                v10n(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    13771750            call handle_nf90_err(ncret)
     1751! attributes
     1752            ncret = nf90_put_att(ncid, ncvarid, "description","10 m v component of wind velocity for the nested domain")
     1753            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-1")
    13781754
    13791755            ncret = nf90_def_var(ncid, 'tt2n', NF90_FLOAT, &
     
    13881764&                                tt2n(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    13891765            call handle_nf90_err(ncret)
     1766! attributes
     1767            ncret = nf90_put_att(ncid, ncvarid, "description","2 m temperature for the nested domain")
     1768            ncret = nf90_put_att(ncid, ncvarid, "units","K")
     1769
    13901770
    13911771            ncret = nf90_def_var(ncid, 'td2n', NF90_FLOAT, &
     
    14001780&                                td2n(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    14011781            call handle_nf90_err(ncret)
     1782! attributes
     1783            ncret = nf90_put_att(ncid, ncvarid, "description","2 m dew point temperature for the nested domain")
     1784            ncret = nf90_put_att(ncid, ncvarid, "units","K")
     1785
    14021786
    14031787            ncret = nf90_def_var(ncid, 'lsprecn', NF90_FLOAT, &
     
    14121796&                                lsprecn(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    14131797            call handle_nf90_err(ncret)
     1798! attributes
     1799            ncret = nf90_put_att(ncid, ncvarid, "description","large scale total precipitation for the nested domain")
     1800            ncret = nf90_put_att(ncid, ncvarid, "units","mm h**-1")
    14141801
    14151802            ncret = nf90_def_var(ncid, 'convprecn', NF90_FLOAT, &
     
    14241811&                                convprecn(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    14251812            call handle_nf90_err(ncret)
     1813! attributes
     1814            ncret = nf90_put_att(ncid, ncvarid, "description","convective precipitation for the nested domain")
     1815            ncret = nf90_put_att(ncid, ncvarid, "units","mm h**-1")
    14261816
    14271817            ncret = nf90_def_var(ncid, 'sshfn', NF90_FLOAT, &
     
    14361826&                                sshfn(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    14371827            call handle_nf90_err(ncret)
     1828! attributes
     1829            ncret = nf90_put_att(ncid, ncvarid, "description","surface sensible heat flux for the nested domain")
     1830            ncret = nf90_put_att(ncid, ncvarid, "units","J m**-2")
    14381831
    14391832            ncret = nf90_def_var(ncid, 'ssrn', NF90_FLOAT, &
     
    14481841&                                ssrn(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    14491842            call handle_nf90_err(ncret)
     1843! attributes
     1844            ncret = nf90_put_att(ncid, ncvarid, "description","surface solar radiation for the nested domain")
     1845            ncret = nf90_put_att(ncid, ncvarid, "units","J m**-2")
    14501846
    14511847            ncret = nf90_def_var(ncid, 'surfstrn', NF90_FLOAT, &
     
    14601856&                                surfstrn(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    14611857            call handle_nf90_err(ncret)
     1858! attributes
     1859            ncret = nf90_put_att(ncid, ncvarid, "description","surface stress for the nested domain")
     1860            ncret = nf90_put_att(ncid, ncvarid, "units","N m**-2 s")
     1861
    14621862
    14631863            ncret = nf90_def_var(ncid, 'ustarn', NF90_FLOAT, &
     
    14721872&                                ustarn(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    14731873            call handle_nf90_err(ncret)
     1874! attributes
     1875            ncret = nf90_put_att(ncid, ncvarid, "description","friction velocity for the nested domain")
     1876            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-1")
    14741877
    14751878            ncret = nf90_def_var(ncid, 'wstarn', NF90_FLOAT, &
     
    14841887&                                wstarn(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    14851888            call handle_nf90_err(ncret)
     1889! attributes
     1890            ncret = nf90_put_att(ncid, ncvarid, "description","convective velocity scale for the nested domain")
     1891            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-1")
     1892
    14861893
    14871894            ncret = nf90_def_var(ncid, 'hmixn', NF90_FLOAT, &
     
    14961903&                                hmixn(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    14971904            call handle_nf90_err(ncret)
     1905! attributes
     1906            ncret = nf90_put_att(ncid, ncvarid, "description","mixing height for the nested domain")
     1907            ncret = nf90_put_att(ncid, ncvarid, "units","m")
    14981908
    14991909            ncret = nf90_def_var(ncid, 'tropopausen', NF90_FLOAT, &
     
    15081918&                                tropopausen(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    15091919            call handle_nf90_err(ncret)
     1920! attributes
     1921            ncret = nf90_put_att(ncid, ncvarid, "description","altitude of thermal tropopause for the nested domain")
     1922            ncret = nf90_put_att(ncid, ncvarid, "units","m")
    15101923
    15111924            ncret = nf90_def_var(ncid, 'olin', NF90_FLOAT, &
     
    15201933&                                olin(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    15211934            call handle_nf90_err(ncret)
     1935! attributes
     1936            ncret = nf90_put_att(ncid, ncvarid, "description","inverse Obukhov length (1/L) for the nested domain")
     1937            ncret = nf90_put_att(ncid, ncvarid, "units","m")
    15221938
    15231939            ncret = nf90_def_var(ncid, 'diffkn', NF90_FLOAT, &
     
    15321948&                                diffkn(0:nxmaxn-1, 0:nymaxn-1, 1, cm_index, 1:maxnests))
    15331949            call handle_nf90_err(ncret)
     1950! attributes
     1951            ncret = nf90_put_att(ncid, ncvarid, "description","diffusion coefficient at reference height &
     1952                                 for the nested domain")
     1953            ncret = nf90_put_att(ncid, ncvarid, "units","m**2 s**-1")
     1954
     1955
    15341956
    15351957            dim4dids = (/nxmaxn_dimid, nymaxn_dimid, maxspec_dimid, maxnests_dimid/)
     
    15481970&                                vdepn(0:nxmaxn-1, 0:nymaxn-1, 1:maxspec, cm_index, 1:maxnests))
    15491971            call handle_nf90_err(ncret)
    1550 
     1972! attributes
     1973            ncret = nf90_put_att(ncid, ncvarid, "description","deposition velocity for the nested domain")
     1974            ncret = nf90_put_att(ncid, ncvarid, "units","m s**-2")
    15511975
    15521976!            PRINT *, 'SUM(psn): ', SUM(psn(:,:,:,cm_index,:))
     
    15701994&                                xresoln(0:maxnests))
    15711995            call handle_nf90_err(ncret)
     1996! attributes
     1997            ncret = nf90_put_att(ncid, ncvarid, "description","factor by which the resolutions in the nests &
     1998                                  is enhanced compared to mother grid")
     1999            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     2000
    15722001
    15732002            ncret = nf90_def_var(ncid, 'yresoln', NF90_FLOAT, &
     
    15822011&                                yresoln(0:maxnests))
    15832012            call handle_nf90_err(ncret)
     2013! attributes
     2014            ncret = nf90_put_att(ncid, ncvarid, "description","factor by which the resolutions in the nests &
     2015                                  is enhanced compared to mother grid")
     2016            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     2017
    15842018
    15852019            dim1dids = (/maxnests_dimid/)
     
    15962030&                                xln(1:maxnests))
    15972031            call handle_nf90_err(ncret)
     2032! attributes
     2033            ncret = nf90_put_att(ncid, ncvarid, "description","lower left corner x  point of nested grids &
     2034                                in grid coordinates of mother grid")
     2035            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     2036
    15982037
    15992038            ncret = nf90_def_var(ncid, 'yln', NF90_FLOAT, &
     
    16082047&                                yln(1:maxnests))
    16092048            call handle_nf90_err(ncret)
     2049! attributes
     2050            ncret = nf90_put_att(ncid, ncvarid, "description","lower left corner y  point of nested grids &
     2051                                in grid coordinates of mother grid")
     2052            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     2053
    16102054
    16112055            ncret = nf90_def_var(ncid, 'xrn', NF90_FLOAT, &
     
    16202064&                                xrn(1:maxnests))
    16212065            call handle_nf90_err(ncret)
     2066! attributes
     2067            ncret = nf90_put_att(ncid, ncvarid, "description","upper right corner x  point of nested grids &
     2068                                in grid coordinates of mother grid")
     2069            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     2070
    16222071
    16232072            ncret = nf90_def_var(ncid, 'yrn', NF90_FLOAT, &
     
    16322081&                                yrn(1:maxnests))
    16332082            call handle_nf90_err(ncret)
     2083! attributes
     2084            ncret = nf90_put_att(ncid, ncvarid, "description","upper right corner y  point of nested grids &
     2085                                in grid coordinates of mother grid")
     2086            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    16342087
    16352088!            PRINT *, 'SUM(yresoln): ', SUM(yresoln)
     
    16492102            ncret = nf90_put_var(ncid, ncvarid, &
    16502103&                                southpolemap(:))
     2104! attributes
     2105            ncret = nf90_put_att(ncid, ncvarid, "description","auxiliary variable to define stereographic projections")
     2106            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     2107
    16512108
    16522109            ncret = nf90_def_var(ncid, 'northpolemap', NF90_FLOAT, &
     
    16582115            ncret = nf90_put_var(ncid, ncvarid, &
    16592116&                                northpolemap(:))
    1660 
     2117! attributes
     2118            ncret = nf90_put_att(ncid, ncvarid, "description","auxiliary variable to define stereographic projections")
     2119            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    16612120
    16622121
     
    16672126            ncret = nf90_put_var(ncid, ncvarid, logical2integer(xglobal))
    16682127            call handle_nf90_err(ncret)
     2128! attributes
     2129            ncret = nf90_put_att(ncid, ncvarid, "description","logical variable  T for global fields, F for limited area fields")
     2130            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     2131
    16692132
    16702133            ncret = nf90_def_var(ncid, 'sglobal', NF90_INT, ncvarid)
     
    16722135            ncret = nf90_put_var(ncid, ncvarid, logical2integer(sglobal))
    16732136            call handle_nf90_err(ncret)
     2137! attributes
     2138            ncret = nf90_put_att(ncid, ncvarid, "description","logical variable  T if domain extends towards south pole")
     2139            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     2140
    16742141
    16752142            ncret = nf90_def_var(ncid, 'nglobal', NF90_INT, ncvarid)
     
    16772144            ncret = nf90_put_var(ncid, ncvarid, logical2integer(nglobal))
    16782145            call handle_nf90_err(ncret)
     2146! attributes
     2147            ncret = nf90_put_att(ncid, ncvarid, "description","logical variable T if domain extends towards north pole")
     2148            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     2149
    16792150
    16802151            ncret = nf90_def_var(ncid, 'switchnorthg', NF90_FLOAT, ncvarid)
     
    16822153            ncret = nf90_put_var(ncid, ncvarid, switchnorthg)
    16832154            call handle_nf90_err(ncret)
     2155! attributes
     2156            ncret = nf90_put_att(ncid, ncvarid, "description","degrees for use polar stereographic grid north of switchnorth")
     2157            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     2158
    16842159
    16852160            ncret = nf90_def_var(ncid, 'switchsouthg', NF90_FLOAT, ncvarid)
     
    16872162            ncret = nf90_put_var(ncid, ncvarid, switchsouthg)
    16882163            call handle_nf90_err(ncret)
     2164! attributes
     2165            ncret = nf90_put_att(ncid, ncvarid, "description","degrees for use polar stereographic grid south of switchshouth")
     2166            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    16892167
    16902168
     
    17072185            ncret = nf90_put_var(ncid, ncvarid, &
    17082186&                                pconv(:))
     2187! attributes
     2188            ncret = nf90_put_att(ncid, ncvarid, "description","pressure at the input model levels for the convection calculation")
     2189            ncret = nf90_put_att(ncid, ncvarid, "units","Pa")
     2190
    17092191
    17102192            ncret = nf90_def_var(ncid, 'dpr', NF90_FLOAT, &
     
    17162198            ncret = nf90_put_var(ncid, ncvarid, &
    17172199&                                dpr(:))
     2200! attributes
     2201            ncret = nf90_put_att(ncid, ncvarid, "description","pressure difference around tconv(k)")
     2202            ncret = nf90_put_att(ncid, ncvarid, "units","Pa")
     2203
    17182204
    17192205            ncret = nf90_def_var(ncid, 'pconv_hpa', NF90_FLOAT, &
     
    17252211            ncret = nf90_put_var(ncid, ncvarid, &
    17262212&                                pconv_hpa(:))
     2213! attributes
     2214            ncret = nf90_put_att(ncid, ncvarid, "description","pressure at the input model levels &
     2215                                 in hPa for the convection calculation")
     2216            ncret = nf90_put_att(ncid, ncvarid, "units","hPa")
     2217
    17272218
    17282219            ncret = nf90_def_var(ncid, 'ft', NF90_FLOAT, &
     
    17342225            ncret = nf90_put_var(ncid, ncvarid, &
    17352226&                                ft(:))
     2227! attributes
     2228            ncret = nf90_put_att(ncid, ncvarid, "description","auxiliary variable for the convection scheme")
     2229            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     2230
    17362231
    17372232            ncret = nf90_def_var(ncid, 'fq', NF90_FLOAT, &
     
    17432238            ncret = nf90_put_var(ncid, ncvarid, &
    17442239&                                fq(:))
     2240! attributes
     2241            ncret = nf90_put_att(ncid, ncvarid, "description","auxiliary variable for the convection scheme")
     2242            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     2243
    17452244
    17462245            ncret = nf90_def_var(ncid, 'sub', NF90_FLOAT, &
     
    17532252&                                sub(:))
    17542253
     2254! attributes
     2255            ncret = nf90_put_att(ncid, ncvarid, "description","auxiliary variable for the convection scheme")
     2256            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
     2257
     2258
    17552259            dim1dids = (/na_dimid/)
    17562260
     
    17632267            ncret = nf90_put_var(ncid, ncvarid, &
    17642268&                                phconv(:))
     2269! attributes
     2270            ncret = nf90_put_att(ncid, ncvarid, "description","pressure between levels k-1 and k")
     2271            ncret = nf90_put_att(ncid, ncvarid, "units","Pa")
     2272
    17652273
    17662274            ncret = nf90_def_var(ncid, 'phconv_hpa', NF90_FLOAT, &
     
    17722280            ncret = nf90_put_var(ncid, ncvarid, &
    17732281&                                phconv_hpa(:))
     2282! attributes
     2283            ncret = nf90_put_att(ncid, ncvarid, "description","pressure between levels k-1 and k in hPa")
     2284            ncret = nf90_put_att(ncid, ncvarid, "units","hPa")
    17742285
    17752286            ncret = nf90_def_var(ncid, 'tconv', NF90_FLOAT, &
     
    17812292            ncret = nf90_put_var(ncid, ncvarid, &
    17822293&                                tconv(:))
     2294! attributes
     2295            ncret = nf90_put_att(ncid, ncvarid, "description","temperature at the input model levels &
     2296                                for the convection calculation")
     2297            ncret = nf90_put_att(ncid, ncvarid, "units","K")
     2298
    17832299
    17842300            ncret = nf90_def_var(ncid, 'qconv', NF90_FLOAT, &
     
    17902306            ncret = nf90_put_var(ncid, ncvarid, &
    17912307&                                qconv(:))
     2308! attributes
     2309            ncret = nf90_put_att(ncid, ncvarid, "description","specific humidity at the input model  &
     2310                                levels for the convection calculation")
     2311            ncret = nf90_put_att(ncid, ncvarid, "units","none")
     2312
    17922313
    17932314            ncret = nf90_def_var(ncid, 'qsconv', NF90_FLOAT, &
     
    17992320            ncret = nf90_put_var(ncid, ncvarid, &
    18002321&                                qsconv(:))
     2322! attributes
     2323            ncret = nf90_put_att(ncid, ncvarid, "description","Saturation water vapor specific humidity &
     2324                                for the convection calculation")
     2325            ncret = nf90_put_att(ncid, ncvarid, "units","kg/kg")
     2326
    18012327
    18022328            ! New dimensions
     
    18112337            ncret = nf90_put_var(ncid, ncvarid, &
    18122338&                                fmass(:,:))
     2339! attributes
     2340            ncret = nf90_put_att(ncid, ncvarid, "description","mass in the grid column for the convection calculation")
     2341            ncret = nf90_put_att(ncid, ncvarid, "units","kg")
     2342
    18132343
    18142344            ncret = nf90_def_var(ncid, 'fmassfrac', NF90_FLOAT, &
     
    18202350            ncret = nf90_put_var(ncid, ncvarid, &
    18212351&                                fmassfrac(:,:))
     2352! attributes
     2353            ncret = nf90_put_att(ncid, ncvarid, "description","mass fraction due to  the convection &
     2354                                displacement from level k to level k")
     2355            ncret = nf90_put_att(ncid, ncvarid, "units","kg")
     2356
    18222357
    18232358
     
    18332368            ncret = nf90_put_var(ncid, ncvarid, &
    18342369&                                cbaseflux(0:nxmax-1,0:nymax-1))
     2370! attributes
     2371            ncret = nf90_put_att(ncid, ncvarid, "description","cloudbase massflux due to the convection")
     2372            ncret = nf90_put_att(ncid, ncvarid, "units","(kg/m**2)/s")
    18352373
    18362374            ! New dimensions
     
    18452383            ncret = nf90_put_var(ncid, ncvarid, &
    18462384&                                cbasefluxn(0:nxmaxn-1,0:nymaxn-1,1:maxnests))
     2385! attributes
     2386            ncret = nf90_put_att(ncid, ncvarid, "description","cloudbase massflux due to the convection for the nested domain")
     2387            ncret = nf90_put_att(ncid, ncvarid, "units","(kg/m**2)/s")
    18472388
    18482389
     
    18522393            ncret = nf90_put_var(ncid, ncvarid, psconv)
    18532394            call handle_nf90_err(ncret)
     2395! attributes
     2396            ncret = nf90_put_att(ncid, ncvarid, "description","surface pressure for the convection calculation")
     2397            ncret = nf90_put_att(ncid, ncvarid, "units","Pa")
     2398
    18542399
    18552400            ncret = nf90_def_var(ncid, 'tt2conv', NF90_FLOAT, ncvarid)
     
    18572402            ncret = nf90_put_var(ncid, ncvarid, tt2conv)
    18582403            call handle_nf90_err(ncret)
     2404! attributes
     2405            ncret = nf90_put_att(ncid, ncvarid, "description","2 m temperature for the convection calculation")
     2406            ncret = nf90_put_att(ncid, ncvarid, "units","K")
     2407
    18592408
    18602409            ncret = nf90_def_var(ncid, 'td2conv', NF90_FLOAT, ncvarid)
     
    18622411            ncret = nf90_put_var(ncid, ncvarid, td2conv)
    18632412            call handle_nf90_err(ncret)
     2413! attributes
     2414            ncret = nf90_put_att(ncid, ncvarid, "description","2 m dew point temperature for the convection calculation")
     2415            ncret = nf90_put_att(ncid, ncvarid, "units","K")
     2416
    18642417
    18652418            ncret = nf90_def_var(ncid, 'nconvlev', NF90_INT, ncvarid)
     
    18672420            ncret = nf90_put_var(ncid, ncvarid, nconvlev)
    18682421            call handle_nf90_err(ncret)
     2422! attributes
     2423            ncret = nf90_put_att(ncid, ncvarid, "description","number of levels for convection")
     2424            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    18692425
    18702426            ncret = nf90_def_var(ncid, 'nconvtop', NF90_INT, ncvarid)
     
    18722428            ncret = nf90_put_var(ncid, ncvarid, nconvtop)
    18732429            call handle_nf90_err(ncret)
     2430! attributes
     2431            ncret = nf90_put_att(ncid, ncvarid, "description","upper levels for convection")
     2432            ncret = nf90_put_att(ncid, ncvarid, "units"," ")
    18742433
    18752434!            PRINT *, 'SUM(pconv): ', SUM(pconv)
  • flexpart_code/grib2nc4/Makefile

    r87d9684 r8624a75  
    1111NETCDFF = /opt/netcdf-fortran-4.4.3
    1212NETCDF = /opt/netcdf-c-4.4.0
    13 
     13#GRIBAPI = /usr/local/grib-api
     14#HDF5 = /usr/local/hdf5-1.8.16
     15#NETCDFF = /usr/local/netcdf-fortran-4.4.3
     16#NETCDF = /usr/local/netcdf-c-4.4.0
    1417
    1518
    1619
    1720BINARY = grib2nc4
    18 OBJS = processmetfields.o
    19 FPMODOBJS = par_mod.o com_mod.o class_vtable_mod.o cmapf_mod.o conv_mod.o
    20 FLXPRTOBJS = detectformat.o grib2check.o shift_field_0.o gridcheck.o \
    21              readwind.o readwind_nests.o calcpar.o calcpar_nests.o \
    22              shift_field.o pbl_profile.o scalev.o obukhov.o \
    23              richardson.o ew.o getvdep.o calcpv.o obukhov_gfs.o \
    24              richardson_gfs.o getvdep_nests.o calcpv_nests.o psim.o psih.o \
    25              qvsat.o caldate.o getrb.o raerod.o getrc.o partdep.o \
    26              verttransform.o verttransform_nests.o readwind_gfs.o \
    27              calcpar_gfs.o verttransform_gfs.o gridcheck_gfs.o
     21CMP_BINARY = nc4cmp
     22OBJS = processmetfields.o verttransform_grib2nc4_ecmwf.o verttransform_grib2nc4_gfs.o
     23FPMODOBJS = ${FLEXPART_SRC}/par_mod.o ${FLEXPART_SRC}/com_mod.o ${FLEXPART_SRC}/class_vtable_mod.o ${FLEXPART_SRC}/cmapf_mod.o ${FLEXPART_SRC}/conv_mod.o
     24FLXPRTOBJS = ${FLEXPART_SRC}/detectformat.o ${FLEXPART_SRC}/grib2check.o ${FLEXPART_SRC}/shift_field_0.o ${FLEXPART_SRC}/gridcheck.o \
     25             ${FLEXPART_SRC}/readwind.o ${FLEXPART_SRC}/readwind_nests.o ${FLEXPART_SRC}/calcpar.o ${FLEXPART_SRC}/calcpar_nests.o \
     26             ${FLEXPART_SRC}/shift_field.o ${FLEXPART_SRC}/pbl_profile.o ${FLEXPART_SRC}/scalev.o ${FLEXPART_SRC}/obukhov.o \
     27             ${FLEXPART_SRC}/richardson.o ${FLEXPART_SRC}/ew.o ${FLEXPART_SRC}/getvdep.o ${FLEXPART_SRC}/calcpv.o ${FLEXPART_SRC}/obukhov_gfs.o \
     28             ${FLEXPART_SRC}/richardson_gfs.o ${FLEXPART_SRC}/getvdep_nests.o ${FLEXPART_SRC}/calcpv_nests.o ${FLEXPART_SRC}/psim.o ${FLEXPART_SRC}/psih.o \
     29             ${FLEXPART_SRC}/qvsat.o ${FLEXPART_SRC}/caldate.o ${FLEXPART_SRC}/getrb.o ${FLEXPART_SRC}/raerod.o ${FLEXPART_SRC}/getrc.o ${FLEXPART_SRC}/partdep.o \
     30             ${FLEXPART_SRC}/verttransform.o ${FLEXPART_SRC}/verttransform_nests.o ${FLEXPART_SRC}/readwind_gfs.o \
     31             ${FLEXPART_SRC}/calcpar_gfs.o ${FLEXPART_SRC}/verttransform_gfs.o ${FLEXPART_SRC}/gridcheck_gfs.o
    2832
    2933
     
    3236
    3337INCLUDES_NETCDF = -I${NETCDFF}/include
    34 INCLUDES = -I${GRIBAPI}/include ${INCLUDES_NETCDF}
     38INCLUDES = -I${GRIBAPI}/include ${INCLUDES_NETCDF}  -I${FLEXPART_SRC}
    3539
    3640
    3741### NetCDF link flags - use the first one for dynamic libs, the second
    3842### one for static libs
    39 #LDFLAGS_NETCDF = -L${NETCDFF}/lib -lnetcdff -L${NETCDF}/lib -lnetcdf
    40 LDFLAGS_NETCDF=-static -L${NETCDFF}/lib -lnetcdff -L${NETCDF}/lib -lnetcdf -lnetcdf -L${HDF5}/lib -lhdf5_fortran -lhdf5_hl -lhdf5hl_fortran -lhdf5 -ldl -lz
     43LDFLAGS_NETCDF = -L${NETCDFF}/lib -lnetcdff -L${NETCDF}/lib -lnetcdf
     44#LDFLAGS_NETCDF=-static -L${NETCDFF}/lib -lnetcdff -L${NETCDF}/lib -lnetcdf -lnetcdf -L${HDF5}/lib -lhdf5_fortran -lhdf5_hl -lhdf5hl_fortran -lhdf5 -ldl -lz
    4145
    4246
    43 LDFLAGS = -L${GRIBAPI}/lib -lgrib_api_f90 -lgrib_api ${LDFLAGS_NETCDF} -ljasper
     47LDFLAGS = -L${GRIBAPI}/lib -lgrib_api_f90 -lgrib_api ${LDFLAGS_NETCDF} -ljasper -L${FLEXPART_SRC}
    4448
    4549
     
    5155${BINARY}.o : ${BINARY}.F90 fp2nc4io_mod.mod ${FPMODOBJS} Makefile
    5256        ${FC} -c ${BINARY}.F90 ${FFLAGS} ${INCLUDES}
     57
     58#-----------  NC4 compare ------------------------
     59${CMP_BINARY} : ${CMP_BINARY}.o
     60        ${FC} -o ${CMP_BINARY} ${CMP_BINARY}.o ${LDFLAGS}
     61
     62${CMP_BINARY}.o : ${CMP_BINARY}.F90 Makefile
     63        ${FC} -c ${CMP_BINARY}.F90 ${FFLAGS} ${INCLUDES}
    5364
    5465fp2nc4io_mod.mod : ${FPMODOBJS}
  • flexpart_code/grib2nc4/README

    r496c607 r8624a75  
    77         M. Harustak
    88
    9 Last Update: 29 May 2016
     9Last Update: 05 July 2017
    1010
    1111======================================================================
     
    1919data for computations.  It then takes the data which has been stored in
    2020FLEXPART global arrays and selectively writes it to a NetCDF4 file.
     21
     22Optional parameter allows user to request arrays calculated for specified
     23location instead of default algorithm selecting lowest left corner of meteorological
     24domain with a surface pressure above 100000Pa.
    2125
    2226This distribution is integrated into the FLEXPART source code, in a grib2nc4
     
    4246is good, but only whether data was stored correctly in the NC4 files.
    4347
     48To be able to quickly compare variables in NetCDF files, simple utility
     49nc4cmp was introduced. It compares specified variable in two NetCDF files
     50(with dimension up to 3) and it prints average and maximal difference between
     51the values. It allows for specification of optional tolerance (in %).
     52Difference is calculated as abs((value1-value2)/value1)*100.
     53It is calculated for all values of variable multidimensional array.
     54
     55
    4456======================================================================
    45572. Quick-Start
     
    6476Simply type "make" (noting that you may see some warnings related to
    6577variables for nests) to produce grib2nc4.
     78
     79NetCDF compare utility nc4cmp can be built using command "make nc4cmp".
    6680
    6781Before trying to run, you might want to try "make test" to make sure that
     
    8195as the second argument.
    8296
     97Usage:
     98
     99  ./grib2nc4 <inpath> <outpath> [lat=value lon=value] [optional varnames]
     100
     101
    83102Sample usage:
    84103
     
    92111
    93112  ./grib2nc4 GD15051200 def9_nc1p0.nc4  q  w
     113
     114Calculation at user specified location can be requested by adding coord parameter
     115to the command line:
     116
     117  ./grib2nc4 GD15051200 def9_nc1p0.nc4 lon=20 lat=45
     118
     119To compare two NetCDF files, nc4cmp can be used.
     120
     121Usage:
     122
     123  ./nc4cmp <file1> <file2> <variable> [optional tolerance in %]
     124
     125Sample usage:
     126
     127  ./nc4cmp def9_nc1p0.nc4 def9_nc1p0_reference.nc4 U
     128
     129Sample usage with tolerance 1%:
     130
     131  ./nc4cmp def9_nc1p0.nc4 def9_nc1p0_reference.nc4 U 1.0
     132
     133This will extract variable U from both NetCDF files, print and compare dimensions,
     134compare values and print average and maximal difference.
     135
    94136
    95137======================================================================
  • flexpart_code/grib2nc4/fp2nc4io_mod.F90

    r87d9684 r8624a75  
    157157        ncfunc_retval = nf90_def_var(ncid, 'height', NF90_DOUBLE, &
    158158&                                    z_dimid, varid)
     159! attributes
     160            ncfunc_retval = nf90_put_att(ncid, varid, "description","height of the FLEXPART model levels")
     161            ncfunc_retval = nf90_put_att(ncid, varid, "units","m a.g.l")
    159162
    160163        ncfunc_retval = nf90_def_var_deflate(ncid, varid,   &
     
    169172        ncfunc_retval = nf90_def_var(ncid, 'dx', NF90_DOUBLE, varid)
    170173        ncfunc_retval = nf90_put_var(ncid, varid, dx)
     174! attributes
     175            ncfunc_retval = nf90_put_att(ncid, varid, "description","grid distance in x direction")
     176            ncfunc_retval = nf90_put_att(ncid, varid, "units","degrees")
     177
    171178
    172179        ncfunc_retval = nf90_def_var(ncid, 'dy', NF90_DOUBLE, varid)
    173180        ncfunc_retval = nf90_put_var(ncid, varid, dy)
     181! attributes
     182            ncfunc_retval = nf90_put_att(ncid, varid, "description","grid distance in y direction")
     183            ncfunc_retval = nf90_put_att(ncid, varid, "units","degrees")
     184
    174185
    175186        ncfunc_retval = nf90_def_var(ncid, 'xlon0', NF90_DOUBLE, varid)
    176187        ncfunc_retval = nf90_put_var(ncid, varid, xlon0)
     188! attributes
     189            ncfunc_retval = nf90_put_att(ncid, varid, "description","longitude of the lowest left corner")
     190            ncfunc_retval = nf90_put_att(ncid, varid, "units","degrees")
     191
    177192
    178193        ncfunc_retval = nf90_def_var(ncid, 'ylat0', NF90_DOUBLE, varid)
    179194        ncfunc_retval = nf90_put_var(ncid, varid, ylat0)
     195! attributes
     196            ncfunc_retval = nf90_put_att(ncid, varid, "description","latitude of the lowest left corner")
     197            ncfunc_retval = nf90_put_att(ncid, varid, "units","degrees")
     198
    180199
    181200        ! All done, close the NetCDF file
     
    296315            ncfunc_retval = nf90_put_var(ncid, varid, &
    297316&                                        uu(0:nx-1, 0:ny-1, 1:nz, 1))
     317! attributes
     318            ncfunc_retval = nf90_put_att(ncid, varid, "description","U component of wind in the X[horizontal] direction")
     319            ncfunc_retval = nf90_put_att(ncid, varid, "units","m s**-1")
     320
     321
    298322        ELSEIF (nc_varname == 'V') THEN
    299323            ncfunc_retval = nf90_put_var(ncid, varid, &
    300324&                                        vv(0:nx-1, 0:ny-1, 1:nz, 1))
     325! attributes
     326            ncfunc_retval = nf90_put_att(ncid, varid, "description","V component of wind in the Y[horizontal] direction")
     327            ncfunc_retval = nf90_put_att(ncid, varid, "units","m s**-1")
     328
     329
    301330        ELSEIF (nc_varname == 'T') THEN
    302331            ncfunc_retval = nf90_put_var(ncid, varid, &
    303332&                                        tt(0:nx-1, 0:ny-1, 1:nz, 1))
     333! attributes
     334            ncfunc_retval = nf90_put_att(ncid, varid, "description","temperature")
     335            ncfunc_retval = nf90_put_att(ncid, varid, "units","k")
     336
    304337        ELSEIF (nc_varname == 'W') THEN
    305338            ncfunc_retval = nf90_put_var(ncid, varid, &
    306339&                                        ww(0:nx-1, 0:ny-1, 1:nz, 1))
     340! attributes
     341            ncfunc_retval = nf90_put_att(ncid, varid, "description","wind component in the Z[vertical] direction")
     342            ncfunc_retval = nf90_put_att(ncid, varid, "units","m s**-1")
     343
     344
    307345        ELSEIF (nc_varname == 'Q') THEN
    308346            ncfunc_retval = nf90_put_var(ncid, varid, &
    309347&                                        qv(0:nx-1, 0:ny-1, 1:nz, 1))
     348! attributes
     349            ncfunc_retval = nf90_put_att(ncid, varid, "description","specific humidity")
     350            ncfunc_retval = nf90_put_att(ncid, varid, "units"," ")
     351
     352
    310353        ELSE
    311354            PRINT *,
  • flexpart_code/grib2nc4/grib2nc4.F90

    r496c607 r8624a75  
    1111    !        May 2016                                                        *
    1212    !*************************************************************************
     13   !   M. Harustak                                                          *
     14   !   -) modification to generate the output in single precission          *
     15   !   -) possibility to add a lat lon selection to obtain the met variables*
     16   !      in the vertical levels defined in that location                   *
     17   !*************************************************************************
    1318
    1419    USE par_mod
     
    2126    IMPLICIT NONE
    2227
    23     LOGICAL :: metfile_exists   
     28    LOGICAL :: metfile_exists, coordinates_provided, lat_provided, lon_provided
    2429    INTEGER :: i, j, k
    2530    INTEGER :: num_optional_vars, num_vars
    2631    INTEGER, PARAMETER :: DEFLATE_LEVEL = 2  ! Compression level (0-9)
    27     CHARACTER(LEN=512) :: met_filepath, netcdf4_filepath
     32    CHARACTER(LEN=512) :: met_filepath, netcdf4_filepath, param_str, coord_name_str, coord_val_str
    2833    CHARACTER, DIMENSION(:), ALLOCATABLE :: vars_list  ! list of variables
    29    
     34    INTEGER :: coordX, coordY, stat
     35    REAL :: coord_lat, coord_lon
    3036    INTEGER :: metdata_format = UNKNOWN_METDATA  ! From FP par_mod
    3137
     
    3440    ! Read in mandatory arguments
    3541    IF (IARGC() < 2) THEN
    36         PRINT *, 'Usage: grib2netcdf4 <inpath> <outpath> [optional varnames]'
     42        PRINT *, 'Usage: grib2netcdf4 <inpath> <outpath> [lon=X lat=Y] [optional varnames]'
    3743        STOP
    3844    ELSE
     
    4854    ! First, get the number of optional args and allocate vars_list,
    4955    ! and fill the first three elements
    50     IF (IARGC() > 2) THEN
    51         num_optional_vars = IARGC() - 2
    52     ELSE
    53         num_optional_vars = 0
    54     ENDIF
     56    coordinates_provided = .FALSE.
     57    lat_provided = .FALSE.
     58    lon_provided = .FALSE.
     59    ALLOCATE( vars_list(IARGC()+3),stat=stat )
    5560
    56     num_vars = num_optional_vars + 3
    57     ALLOCATE( vars_list(num_vars) )
    5861    vars_list(1) = 'u'
    5962    vars_list(2) = 'v'
    6063    vars_list(3) = 't'
    6164       
    62     ! Read in optional variable arguments, starting at element 4 of vars_list
    63     IF (IARGC() > 2) THEN
    64         DO i=1,num_optional_vars
    65             CALL GETARG( i+2, vars_list(i+3) )
    66         ENDDO
     65    num_vars = 3
     66    DO i=3,IARGC()
     67        CALL GETARG(i,param_str)
     68        param_str = TRIM(param_str)
     69        j = SCAN(param_str,"=")
     70        if (j>1) then
     71            coord_name_str=param_str(1:j-1)
     72            coord_val_str=param_str(j+1:)
     73            IF ( coord_name_str == "lat" .or. coord_name_str == "LAT" ) THEN
     74                read(coord_val_str,*,iostat=stat) coord_lat
     75                if ( stat == 0 ) then
     76                    lat_provided = .TRUE.
     77                else
     78                    print *, "Incorrect coordinates: ", coord_val_str
     79                    stop
     80                endif
     81            ELSE IF ( coord_name_str == "lon" .or. coord_name_str == "LON" ) THEN
     82                read(coord_val_str,*,iostat=stat) coord_lon
     83                if ( stat == 0 ) then
     84                    lon_provided = .TRUE.
     85                else
     86                    print *, "Incorrect coordinates: ", coord_val_str
     87                    stop
     88                endif
     89            ENDIF
     90        else
     91            num_vars = num_vars + 1
     92            vars_list(num_vars) = param_str
     93        endif
     94    ENDDO
     95    IF (lat_provided .AND. lon_provided) THEN
     96        coordinates_provided = .TRUE.
    6797    ENDIF
    6898
     
    126156    !CALL gridcheck_nests
    127157
     158    ! If the coordinates are provided, then we need to obtain
     159    !  the corresponding grid indexes since this is what verttransform needs
     160    if ( coordinates_provided ) then
     161        coordX = (coord_lon-xlon0)/dx
     162        coordY = (coord_lat-ylat0)/dy
     163        print *, "Coordinates: "
     164        print *, "lon: ", coord_lon, ", lat: ",coord_lat
     165        print *, "x: ", coordX, ", y: ", coordY
     166    endif
     167
    128168    PRINT *, 'Calling processmetfields()...'
    129     call processmetfields( 1, metdata_format)
     169    call processmetfields( 1, metdata_format, coordinates_provided, coordX, coordY)
    130170
    131171    PRINT *, 'Calling fp2nc4io_dump()...'
  • flexpart_code/grib2nc4/processmetfields.F90

    r496c607 r8624a75  
    1 subroutine processmetfields(ind,metdata_format)
     1subroutine processmetfields(ind,metdata_format,coordinates_provided, coordX, coordY)
     2
    23  !                       i     o
    34  !*****************************************************************************
     
    3738  integer :: dumpData
    3839  character(len=512):: fpfname, dumpPath, filename
     40  integer :: coordX, coordY
     41  logical :: coordinates_provided
    3942
    4043
     
    107110             call calcpar_ecmwf(memind(1),uuh,vvh,pvh)
    108111             call calcpar_nests(memind(1),uuhn,vvhn,pvhn,metdata_format)
    109              call verttransform_ecmwf(memind(1),uuh,vvh,wwh,pvh)
     112             if ( coordinates_provided ) then
     113                 call verttransform_grib2nc4_ecmwf(memind(1),uuh,vvh,wwh,pvh,coordX,coordY)
     114             else
     115                 call verttransform_grib2nc4_ecmwf(memind(1),uuh,vvh,wwh,pvh,-1,-1)
     116             endif
    110117             call verttransform_nests(memind(1),uuhn,vvhn,wwhn,pvhn)
    111118             memtime(1)=wftime(ind)
     
    116123             call calcpar_gfs(memind(1),uuh,vvh,pvh)
    117124             call calcpar_nests(memind(1),uuhn,vvhn,pvhn,metdata_format)
    118              call verttransform_gfs(memind(1),uuh,vvh,wwh,pvh)
     125             if ( coordinates_provided ) then
     126                 call verttransform_grib2nc4_gfs(memind(1),uuh,vvh,wwh,pvh,coordX,coordY)
     127             else
     128                 call verttransform_grib2nc4_gfs(memind(1),uuh,vvh,wwh,pvh,-1,-1)
     129             endif
    119130             call verttransform_nests(memind(1),uuhn,vvhn,wwhn,pvhn)
    120131             memtime(1)=wftime(ind)
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG