Changeset 2573


Ignore:
Timestamp:
Oct 25, 2021, 11:01:18 AM (3 years ago)
Author:
emillour
Message:

Mars GCM:
Fixes for the picky gfortran10 compiler which identifies using a scalar
instead of a one-element array as an error.
MW+EM

Location:
trunk/LMDZ.MARS
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/README

    r2571 r2573  
    34933493== 22/10/2021 == SF+AB
    34943494Clarify the description of extract
     3495
     3496== 25/10/2021 == MW+EM
     3497Fixes for the picky gfortran10 compiler which identifies using a scalar
     3498instead of a one-element array as an error.
  • trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/ini_archive.F

    r1422 r2573  
    176176      ierr = NF_REDEF (nid)
    177177#ifdef NC_DOUBLE
    178       ierr = NF_DEF_VAR (nid,"controle",NF_DOUBLE,1,idim_index,nvarid)
    179 #else
    180       ierr = NF_DEF_VAR (nid,"controle",NF_FLOAT,1,idim_index,nvarid)
     178      ierr = NF_DEF_VAR (nid,"controle",NF_DOUBLE,1,[idim_index],nvarid)
     179#else
     180      ierr = NF_DEF_VAR (nid,"controle",NF_FLOAT,1,[idim_index],nvarid)
    181181#endif
    182182      ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22,
     
    195195      ierr = NF_REDEF (nid)
    196196#ifdef NC_DOUBLE
    197       ierr = NF_DEF_VAR (nid,"rlonu",NF_DOUBLE,1,idim_rlonu,nvarid)
    198 #else
    199       ierr = NF_DEF_VAR (nid,"rlonu",NF_FLOAT,1,idim_rlonu,nvarid)
     197      ierr = NF_DEF_VAR (nid,"rlonu",NF_DOUBLE,1,[idim_rlonu],nvarid)
     198#else
     199      ierr = NF_DEF_VAR (nid,"rlonu",NF_FLOAT,1,[idim_rlonu],nvarid)
    200200#endif
    201201      ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 23,
     
    210210      ierr = NF_REDEF (nid)
    211211#ifdef NC_DOUBLE
    212       ierr = NF_DEF_VAR (nid,"rlatu",NF_DOUBLE,1,idim_rlatu,nvarid)
    213 #else
    214       ierr = NF_DEF_VAR (nid,"rlatu",NF_FLOAT,1,idim_rlatu,nvarid)
     212      ierr = NF_DEF_VAR (nid,"rlatu",NF_DOUBLE,1,[idim_rlatu],nvarid)
     213#else
     214      ierr = NF_DEF_VAR (nid,"rlatu",NF_FLOAT,1,[idim_rlatu],nvarid)
    215215#endif
    216216      ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22,
     
    225225      ierr = NF_REDEF (nid)
    226226#ifdef NC_DOUBLE
    227       ierr = NF_DEF_VAR (nid,"rlonv",NF_DOUBLE,1,idim_rlonv,nvarid)
    228 #else
    229       ierr = NF_DEF_VAR (nid,"rlonv",NF_FLOAT,1,idim_rlonv,nvarid)
     227      ierr = NF_DEF_VAR (nid,"rlonv",NF_DOUBLE,1,[idim_rlonv],nvarid)
     228#else
     229      ierr = NF_DEF_VAR (nid,"rlonv",NF_FLOAT,1,[idim_rlonv],nvarid)
    230230#endif
    231231      ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 23,
     
    240240      ierr = NF_REDEF (nid)
    241241#ifdef NC_DOUBLE
    242       ierr = NF_DEF_VAR (nid,"rlatv",NF_DOUBLE,1,idim_rlatv,nvarid)
    243 #else
    244       ierr = NF_DEF_VAR (nid,"rlatv",NF_FLOAT,1,idim_rlatv,nvarid)
     242      ierr = NF_DEF_VAR (nid,"rlatv",NF_DOUBLE,1,[idim_rlatv],nvarid)
     243#else
     244      ierr = NF_DEF_VAR (nid,"rlatv",NF_FLOAT,1,[idim_rlatv],nvarid)
    245245#endif
    246246      ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 22,
     
    260260      ierr = NF_REDEF (nid)
    261261#ifdef NC_DOUBLE
    262       ierr = NF_DEF_VAR (nid,"ap",NF_DOUBLE,1,idim_llmp1,nvarid)
    263 #else
    264       ierr = NF_DEF_VAR (nid,"ap",NF_FLOAT,1,idim_llmp1,nvarid)
     262      ierr = NF_DEF_VAR (nid,"ap",NF_DOUBLE,1,[idim_llmp1],nvarid)
     263#else
     264      ierr = NF_DEF_VAR (nid,"ap",NF_FLOAT,1,[idim_llmp1],nvarid)
    265265#endif
    266266      ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 32,
     
    275275      ierr = NF_REDEF (nid)
    276276#ifdef NC_DOUBLE
    277       ierr = NF_DEF_VAR (nid,"bp",NF_DOUBLE,1,idim_llmp1,nvarid)
    278 #else
    279       ierr = NF_DEF_VAR (nid,"bp",NF_FLOAT,1,idim_llmp1,nvarid)
     277      ierr = NF_DEF_VAR (nid,"bp",NF_DOUBLE,1,[idim_llmp1],nvarid)
     278#else
     279      ierr = NF_DEF_VAR (nid,"bp",NF_FLOAT,1,[idim_llmp1],nvarid)
    280280#endif
    281281      ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 35,
     
    291291      ierr = NF_REDEF (nid)
    292292#ifdef NC_DOUBLE
    293       ierr = NF_DEF_VAR (nid,"aps",NF_DOUBLE,1,idim_llm,nvarid)
    294 #else
    295       ierr = NF_DEF_VAR (nid,"aps",NF_FLOAT,1,idim_llm,nvarid)
     293      ierr = NF_DEF_VAR (nid,"aps",NF_DOUBLE,1,[idim_llm],nvarid)
     294#else
     295      ierr = NF_DEF_VAR (nid,"aps",NF_FLOAT,1,[idim_llm],nvarid)
    296296#endif
    297297      ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 36,
     
    307307      ierr = NF_REDEF (nid)
    308308#ifdef NC_DOUBLE
    309       ierr = NF_DEF_VAR (nid,"bps",NF_DOUBLE,1,idim_llm,nvarid)
    310 #else
    311       ierr = NF_DEF_VAR (nid,"bps",NF_FLOAT,1,idim_llm,nvarid)
     309      ierr = NF_DEF_VAR (nid,"bps",NF_DOUBLE,1,[idim_llm],nvarid)
     310#else
     311      ierr = NF_DEF_VAR (nid,"bps",NF_FLOAT,1,[idim_llm],nvarid)
    312312#endif
    313313      ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 30,
     
    324324      ierr = NF_REDEF (nid)
    325325#ifdef NC_DOUBLE
    326       ierr = NF_DEF_VAR (nid,"presnivs",NF_DOUBLE,1,idim_llm,nvarid)
    327 #else
    328       ierr = NF_DEF_VAR (nid,"presnivs",NF_FLOAT,1,idim_llm,nvarid)
     326      ierr = NF_DEF_VAR (nid,"presnivs",NF_DOUBLE,1,[idim_llm],nvarid)
     327#else
     328      ierr = NF_DEF_VAR (nid,"presnivs",NF_FLOAT,1,[idim_llm],nvarid)
    329329#endif
    330330      ierr = NF_ENDDEF(nid)
     
    339339      ierr = NF_REDEF (nid)
    340340#ifdef NC_DOUBLE
    341       ierr = NF_DEF_VAR (nid,"latitude",NF_DOUBLE,1,idim_rlatu,nvarid)
    342 #else
    343       ierr = NF_DEF_VAR (nid,"latitude",NF_FLOAT,1,idim_rlatu,nvarid)
     341      ierr = NF_DEF_VAR (nid,"latitude",NF_DOUBLE,1,[idim_rlatu],nvarid)
     342#else
     343      ierr = NF_DEF_VAR (nid,"latitude",NF_FLOAT,1,[idim_rlatu],nvarid)
    344344#endif
    345345      ierr =NF_PUT_ATT_TEXT(nid,nvarid,'units',13,"degrees_north")
     
    355355       ierr = NF_REDEF (nid)
    356356#ifdef NC_DOUBLE
    357       ierr =NF_DEF_VAR(nid,"longitude", NF_DOUBLE, 1, idim_rlonv,nvarid)
    358 #else
    359       ierr = NF_DEF_VAR(nid,"longitude", NF_FLOAT, 1, idim_rlonv,nvarid)
     357      ierr=NF_DEF_VAR(nid,"longitude",NF_DOUBLE,1,[idim_rlonv],nvarid)
     358#else
     359      ierr=NF_DEF_VAR(nid,"longitude",NF_FLOAT,1,[idim_rlonv],nvarid)
    360360#endif
    361361      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14,
     
    372372#ifdef NC_DOUBLE
    373373      ierr = NF_DEF_VAR (nid, "altitude", NF_DOUBLE, 1,
    374      .       idim_llm,nvarid)
     374     .       [idim_llm],nvarid)
    375375#else
    376376      ierr = NF_DEF_VAR (nid, "altitude", NF_FLOAT, 1,
    377      .       idim_llm,nvarid)
     377     .       [idim_llm],nvarid)
    378378#endif
    379379      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name",10,"pseudo-alt")
     
    394394      ! define variable
    395395#ifdef NC_DOUBLE
    396       ierr=NF_DEF_VAR(nid,"soildepth",NF_DOUBLE,1,idim_nsoilmx,nvarid)
    397 #else
    398       ierr=NF_DEF_VAR(nid,"soildepth",NF_FLOAT,1,idim_nsoilmx,nvarid)
     396      ierr=NF_DEF_VAR(nid,"soildepth",NF_DOUBLE,1,[idim_nsoilmx],nvarid)
     397#else
     398      ierr=NF_DEF_VAR(nid,"soildepth",NF_FLOAT,1,[idim_nsoilmx],nvarid)
    399399#endif
    400400      ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 20,
  • trunk/LMDZ.MARS/libf/phymars/iniwrite.F

    r2545 r2573  
    130130#ifdef NC_DOUBLE
    131131      ierr = NF_DEF_VAR (nid, "controle", NF_DOUBLE, 1,
    132      .       idim_index,nvarid)
     132     .       [idim_index],nvarid)
    133133#else
    134134      ierr = NF_DEF_VAR (nid, "controle", NF_FLOAT, 1,
    135      .       idim_index,nvarid)
     135     .       [idim_index],nvarid)
    136136#endif
    137137      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 18,
     
    165165      ierr = NF_REDEF (nid)
    166166#ifdef NC_DOUBLE
    167       ierr =NF_DEF_VAR(nid, "latitude", NF_DOUBLE, 1, idim_rlatu,nvarid)
    168 #else
    169       ierr =NF_DEF_VAR (nid, "latitude", NF_FLOAT, 1, idim_rlatu,nvarid)
     167      ierr=NF_DEF_VAR(nid,"latitude",NF_DOUBLE,1,[idim_rlatu],nvarid)
     168#else
     169      ierr=NF_DEF_VAR(nid,"latitude",NF_FLOAT,1,[idim_rlatu],nvarid)
    170170#endif
    171171      ierr =NF_PUT_ATT_TEXT(nid,nvarid,'units',13,"degrees_north")
     
    190190      ierr = NF_REDEF (nid)
    191191#ifdef NC_DOUBLE
    192       ierr =NF_DEF_VAR(nid,"longitude", NF_DOUBLE, 1, idim_rlonv,nvarid)
    193 #else
    194       ierr = NF_DEF_VAR(nid,"longitude", NF_FLOAT, 1, idim_rlonv,nvarid)
     192      ierr =NF_DEF_VAR(nid,"longitude",NF_DOUBLE,1,[idim_rlonv],nvarid)
     193#else
     194      ierr = NF_DEF_VAR(nid,"longitude",NF_FLOAT,1,[idim_rlonv],nvarid)
    195195#endif
    196196      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14,
     
    208208#ifdef NC_DOUBLE
    209209      ierr = NF_DEF_VAR (nid, "altitude", NF_DOUBLE, 1,
    210      .       idim_llm,nvarid)
     210     .       [idim_llm],nvarid)
    211211#else
    212212      ierr = NF_DEF_VAR (nid, "altitude", NF_FLOAT, 1,
    213      .       idim_llm,nvarid)
     213     .       [idim_llm],nvarid)
    214214#endif
    215215      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name",10,"pseudo-alt")
     
    227227!      ierr = NF_REDEF (nid)
    228228!#ifdef NC_DOUBLE
    229 !      ierr = NF_DEF_VAR (nid, "rlatv", NF_DOUBLE, 1, idim_rlatv,nvarid)
    230 !#else
    231 !      ierr = NF_DEF_VAR (nid, "rlatv", NF_FLOAT, 1, idim_rlatv,nvarid)
     229!      ierr = NF_DEF_VAR (nid, "rlatv",NF_DOUBLE,1,[idim_rlatv],nvarid)
     230!#else
     231!      ierr = NF_DEF_VAR (nid, "rlatv",NF_FLOAT,1,[idim_rlatv],nvarid)
    232232!#endif
    233233!      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 20,
     
    280280      ! define variable
    281281#ifdef NC_DOUBLE
    282       ierr=NF_DEF_VAR(nid,"soildepth",NF_DOUBLE,1,idim_nsoilmx,nvarid)
    283 #else
    284       ierr=NF_DEF_VAR(nid,"soildepth",NF_FLOAT,1,idim_nsoilmx,nvarid)
     282      ierr=NF_DEF_VAR(nid,"soildepth",NF_DOUBLE,1,[idim_nsoilmx],nvarid)
     283#else
     284      ierr=NF_DEF_VAR(nid,"soildepth",NF_FLOAT,1,[idim_nsoilmx],nvarid)
    285285#endif
    286286      ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 20,
  • trunk/LMDZ.MARS/libf/phymars/iniwritesoil.F90

    r1532 r2573  
    8181! Define the variable
    8282#ifdef NC_DOUBLE
    83 ierr=NF_DEF_VAR(nid,"longitude",NF_DOUBLE,1,idim_rlonv,varid)
    84 #else
    85 ierr=NF_DEF_VAR(nid,"longitude",NF_FLOAT,1,idim_rlonv,varid)
     83ierr=NF_DEF_VAR(nid,"longitude",NF_DOUBLE,1,[idim_rlonv],varid)
     84#else
     85ierr=NF_DEF_VAR(nid,"longitude",NF_FLOAT,1,[idim_rlonv],varid)
    8686#endif
    8787if (ierr.ne.NF_NOERR) then
     
    119119! Define the variable
    120120#ifdef NC_DOUBLE
    121 ierr=NF_DEF_VAR(nid,"latitude",NF_DOUBLE,1,idim_rlatu,varid)
    122 #else
    123 ierr=NF_DEF_VAR(nid,"latitude",NF_FLOAT,1,idim_rlatu,varid)
     121ierr=NF_DEF_VAR(nid,"latitude",NF_DOUBLE,1,[idim_rlatu],varid)
     122#else
     123ierr=NF_DEF_VAR(nid,"latitude",NF_FLOAT,1,[idim_rlatu],varid)
    124124#endif
    125125if (ierr.ne.NF_NOERR) then
     
    150150! Define the variable
    151151#ifdef NC_DOUBLE
    152 ierr=NF_DEF_VAR(nid,"depth",NF_DOUBLE,1,idim_depth,varid)
    153 #else
    154 ierr=NF_DEF_VAR(nid,"depth",NF_FLOAT,1,idim_depth,varid)
     152ierr=NF_DEF_VAR(nid,"depth",NF_DOUBLE,1,[idim_depth],varid)
     153#else
     154ierr=NF_DEF_VAR(nid,"depth",NF_FLOAT,1,[idim_depth],varid)
    155155#endif
    156156if (ierr.ne.NF_NOERR) then
     
    184184! Define the variable
    185185#ifdef NC_DOUBLE
    186 ierr=NF_DEF_VAR(nid,"time",NF_DOUBLE,1,idim_time,varid)
    187 #else
    188 ierr=NF_DEF_VAR(nid,"time",NF_FLOAT,1,idim_time,varid)
     186ierr=NF_DEF_VAR(nid,"time",NF_DOUBLE,1,[idim_time],varid)
     187#else
     188ierr=NF_DEF_VAR(nid,"time",NF_FLOAT,1,[idim_time],varid)
    189189#endif
    190190if (ierr.ne.NF_NOERR) then
  • trunk/LMDZ.MARS/libf/phymars/physiq_mod.F

    r2570 r2573  
    29492949     &                  fluxtop_sw_tot)
    29502950         call WRITEDIAGFI(ngrid,"temp","temperature","K",3,zt)
    2951          call WRITEDIAGFI(ngrid,"Sols","Time","sols",0,zday)
     2951         call WRITEDIAGFI(ngrid,"Sols","Time","sols",0,[zday])
    29522952         call WRITEDIAGFI(ngrid,"Ls","Solar longitude","deg",
    2953      &                    0,zls*180./pi)
     2953     &                    0,[zls*180./pi])
    29542954         call WRITEDIAGFI(ngrid,"u","Zonal wind","m.s-1",3,zu)
    29552955         call WRITEDIAGFI(ngrid,"v","Meridional wind","m.s-1",3,zv)
     
    34323432
    34333433            call WRITEDIAGFI(ngrid,"PhiH","H escape flux","s-1",
    3434      $           0,PhiEscH)
     3434     $           0,[PhiEscH])
    34353435            call WRITEDIAGFI(ngrid,"PhiH2","H2 escape flux","s-1",
    3436      $           0,PhiEscH2)
     3436     $           0,[PhiEscH2])
    34373437            call WRITEDIAGFI(ngrid,"PhiD","D escape flux","s-1",
    3438      $           0,PhiEscD)
     3438     $           0,[PhiEscD])
    34393439
    34403440!            call wstats(ngrid,"PhiH","H escape flux","s-1",
    3441 !     $           0,PhiEscH)
     3441!     $           0,[PhiEscH])
    34423442!            call wstats(ngrid,"PhiH2","H2 escape flux","s-1",
    3443 !     $           0,PhiEscH2)
     3443!     $           0,[PhiEscH2])
    34443444!            call wstats(ngrid,"PhiD","D escape flux","s-1",
    3445 !     $           0,PhiEscD)
     3445!     $           0,[PhiEscD])
    34463446           
    34473447!            call wstats(ngrid,"q15um","15 um cooling","K/s",
     
    39073907        call WRITEDIAGFI(ngrid,'co2conservation',
    39083908     &                     'Total CO2 mass conservation in physic',
    3909      &                     '%',0,(co2totA-co2totB)/co2totA)
     3909     &                     '%',0,[(co2totA-co2totB)/co2totA])
    39103910      endif ! of if (igcm_co2_ice.ne.0)
    39113911! XIOS outputs
  • trunk/LMDZ.MARS/libf/phymars/writediagfi.F

    r2514 r2573  
    292292           ! Write (append) the new date to the 'Time' array
    293293!#ifdef NC_DOUBLE
    294 !           ierr= NF_PUT_VARA_DOUBLE(nid,varid,ntime,1,date)
     294!           ierr= NF_PUT_VARA_DOUBLE(nid,varid,[ntime],[1],[date])
    295295!#else
    296            ierr= NF_PUT_VARA_REAL(nid,varid,ntime,1,date)
     296           ierr= NF_PUT_VARA_REAL(nid,varid,[ntime],[1],[date])
    297297!#endif
    298298           if (ierr.ne.NF_NOERR) then
     
    496496             ierr= NF_PUT_VARA_REAL(nid,varid,corner,edges,dx2)
    497497           ELSE
    498              ierr= NF_PUT_VARA_REAL(nid,varid,corner,edges,dx2_1d)
     498             ierr= NF_PUT_VARA_REAL(nid,varid,corner,edges,[dx2_1d])
    499499           ENDIF
    500500!#endif     
     
    603603
    604604!#ifdef NC_DOUBLE
    605 !           ierr = NF_PUT_VARA_DOUBLE (nid,varid,corner,edges,dx0
     605!           ierr = NF_PUT_VARA_DOUBLE (nid,varid,[corner(1)],[edges(1)],[dx0]
    606606!#else
    607            ierr= NF_PUT_VARA_REAL(nid,varid,corner,edges,dx0)
     607           ierr= NF_PUT_VARA_REAL(nid,varid,[corner(1)],
     608     &             [edges(1)],[dx0])
    608609!#endif
    609610           if (ierr.ne.NF_NOERR) then
  • trunk/LMDZ.MARS/libf/phymars/writediagmicrofi.F

    r2437 r2573  
    308308!           ierr= NF_PUT_VARA_DOUBLE(nid,varid,ntime,1,date)
    309309!#else
    310            ierr= NF_PUT_VARA_REAL(nid,varid,ntime,1,date)
     310           ierr= NF_PUT_VARA_REAL(nid,varid,[ntime],[1],[date])
    311311!#endif
    312312           if (ierr.ne.NF_NOERR) then
     
    331331           ierr= NF_INQ_VARID(nid,"microtime",varid)
    332332!#else
    333            ierr= NF_PUT_VARA_REAL(nid,varid,microstep,1,subdate)
     333           ierr= NF_PUT_VARA_REAL(nid,varid,[microstep],[1],[subdate])
    334334!#endif
    335335           if (ierr.ne.NF_NOERR) then
     
    539539             ierr= NF_PUT_VARA_REAL(nid,varid,corner,edges,dx2)
    540540           ELSE
    541              ierr= NF_PUT_VARA_REAL(nid,varid,corner,edges,dx2_1d)
     541             ierr= NF_PUT_VARA_REAL(nid,varid,corner,edges,[dx2_1d])
    542542           ENDIF
    543543!#endif     
     
    654654!           ierr = NF_PUT_VARA_DOUBLE (nid,varid,corner,edges,dx0) 
    655655!#else
    656            ierr= NF_PUT_VARA_REAL(nid,varid,corner,edges,dx0)
     656           ierr= NF_PUT_VARA_REAL(nid,varid,corner,edges,[dx0])
    657657!#endif
    658658           if (ierr.ne.NF_NOERR) then
  • trunk/LMDZ.MARS/libf/phymars/writediagsoil.F90

    r2311 r2573  
    174174!     ierr=NF_PUT_VARA_DOUBLE(nid,varid,ntime,1,date)
    175175!#else
    176      ierr=NF_PUT_VARA_REAL(nid,varid,ntime,1,date)
     176     ierr=NF_PUT_VARA_REAL(nid,varid,[ntime],[1],[date])
    177177!#endif
    178178     if (ierr.ne.NF_NOERR) then
     
    342342    ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,data2)
    343343  else
    344     ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,data2_1d)
     344    ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,[data2_1d])
    345345  endif
    346346!#endif
     
    382382!  ierr=NF_PUT_VARA_DOUBLE(nid,varid,corners,edges,data0)
    383383!#else
    384   ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,data0)
     384  ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,[data0])
    385385!#endif
    386386  if (ierr.ne.NF_NOERR) then
  • trunk/LMDZ.MARS/libf/phymars/wstats_mod.F90

    r2563 r2573  
    1818
    1919integer,save :: count(istime) ! count tab to know the variable record
    20 !$OMP THREADPRIVATE(istats,count)
     20!$OMP THREADPRIVATE(count)
    2121
    2222contains
     
    537537  ierr = NF_REDEF (nid)
    538538#ifdef NC_DOUBLE
    539   ierr = NF_DEF_VAR (nid,"altitude", NF_DOUBLE, 1,idim_llm,nvarid)
    540 #else
    541   ierr = NF_DEF_VAR (nid,"altitude", NF_FLOAT, 1,idim_llm,nvarid)
     539  ierr = NF_DEF_VAR (nid,"altitude", NF_DOUBLE, 1,[idim_llm],nvarid)
     540#else
     541  ierr = NF_DEF_VAR (nid,"altitude", NF_FLOAT, 1,[idim_llm],nvarid)
    542542#endif
    543543  ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name",8,"altitude")
     
    834834   time(i)=i*24./istime
    835835#ifdef NC_DOUBLE
    836    ierr= NF_PUT_VARA_DOUBLE(nid,varid(4),i,1,time(i))
    837 #else
    838    ierr= NF_PUT_VARA_REAL(nid,varid(4),i,1,time(i))
     836   ierr= NF_PUT_VARA_DOUBLE(nid,varid(4),[i],[1],time(i))
     837#else
     838   ierr= NF_PUT_VARA_REAL(nid,varid(4),[i],[1],time(i))
    839839#endif
    840840enddo
     
    859859
    860860do i=1,nbvar
    861    varid=(i-1)*2+5
     861   nvarid=(i-1)*2+5
    862862
    863863   ! What's the variable's name?
    864    ierr=NF_INQ_VARNAME(nid,varid,name)
     864   ierr=NF_INQ_VARNAME(nid,nvarid,name)
    865865   write(*,*) "OK variable ",name
    866866   ! Its units?
    867867   units=" "
    868    ierr=NF_GET_ATT_TEXT(nid,varid,"units",units)
     868   ierr=NF_GET_ATT_TEXT(nid,nvarid,"units",units)
    869869   ! Its title?
    870870   title=" "
    871    ierr=NF_GET_ATT_TEXT(nid,varid,"title",title)
     871   ierr=NF_GET_ATT_TEXT(nid,nvarid,"title",title)
    872872   ! Its number of dimensions?   
    873    ierr=NF_INQ_VARNDIMS(nid,varid,ndims)
     873   ierr=NF_INQ_VARNDIMS(nid,nvarid,ndims)
    874874   ! Its values?
    875875
     
    890890         ! Extraction of the "source" variables
    891891#ifdef NC_DOUBLE
    892          ierr = NF_GET_VARA_DOUBLE(nid,varid,start,size,sum3d)
    893          ierr = NF_GET_VARA_DOUBLE(nid,varid+1,start,size,square3d)
    894 #else
    895          ierr = NF_GET_VARA_REAL(nid,varid,start,size,sum3d)
    896          ierr = NF_GET_VARA_REAL(nid,varid+1,start,size,square3d)
    897 #endif
    898          ! Calculation of these variables
     892         ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,size,sum3d)
     893         ierr = NF_GET_VARA_DOUBLE(nid,nvarid+1,start,size,square3d)
     894#else
     895         ierr = NF_GET_VARA_REAL(nid,nvarid,start,size,sum3d)
     896         ierr = NF_GET_VARA_REAL(nid,nvarid+1,start,size,square3d)
     897#endif
     898         ! Calculation of these nvariables
    899899         mean3d=sum3d/count(lt)
    900900         sd3d=sqrt(max(0.,square3d/count(lt)-mean3d**2))
    901901         ! Writing of the variables
    902902#ifdef NC_DOUBLE
    903          ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,size,mean3d)
    904          ierr = NF_PUT_VARA_DOUBLE(nid,varid+1,start,size,sd3d)
    905 #else
    906          ierr = NF_PUT_VARA_REAL(nid,varid,start,size,mean3d)
    907          ierr = NF_PUT_VARA_REAL(nid,varid+1,start,size,sd3d)
     903         ierr = NF_PUT_VARA_DOUBLE(nid,nvarid,start,size,mean3d)
     904         ierr = NF_PUT_VARA_DOUBLE(nid,nvarid+1,start,size,sd3d)
     905#else
     906         ierr = NF_PUT_VARA_REAL(nid,nvarid,start,size,mean3d)
     907         ierr = NF_PUT_VARA_REAL(nid,nvarid+1,start,size,sd3d)
    908908#endif
    909909      enddo
     
    924924         ! Extraction of the "source" variables
    925925#ifdef NC_DOUBLE
    926          ierr = NF_GET_VARA_DOUBLE(nid,varid,start,size,sum2d)
    927          ierr = NF_GET_VARA_DOUBLE(nid,varid+1,start,size,square2d)
    928 #else
    929          ierr = NF_GET_VARA_REAL(nid,varid,start,size,sum2d)
    930          ierr = NF_GET_VARA_REAL(nid,varid+1,start,size,square2d)
     926         ierr = NF_GET_VARA_DOUBLE(nid,nvarid,start,size,sum2d)
     927         ierr = NF_GET_VARA_DOUBLE(nid,nvarid+1,start,size,square2d)
     928#else
     929         ierr = NF_GET_VARA_REAL(nid,nvarid,start,size,sum2d)
     930         ierr = NF_GET_VARA_REAL(nid,nvarid+1,start,size,square2d)
    931931#endif
    932932         ! Calculation of these variables
     
    935935         ! Writing of the variables
    936936#ifdef NC_DOUBLE
    937          ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,size,mean2d)
    938          ierr = NF_PUT_VARA_DOUBLE(nid,varid+1,start,size,sd2d)
    939 #else
    940          ierr = NF_PUT_VARA_REAL(nid,varid,start,size,mean2d)
    941          ierr = NF_PUT_VARA_REAL(nid,varid+1,start,size,sd2d)
     937         ierr = NF_PUT_VARA_DOUBLE(nid,nvarid,start,size,mean2d)
     938         ierr = NF_PUT_VARA_DOUBLE(nid,nvarid+1,start,size,sd2d)
     939#else
     940         ierr = NF_PUT_VARA_REAL(nid,nvarid,start,size,mean2d)
     941         ierr = NF_PUT_VARA_REAL(nid,nvarid+1,start,size,sd2d)
    942942#endif
    943943      enddo
Note: See TracChangeset for help on using the changeset viewer.