Ignore:
Timestamp:
Jul 12, 2012, 1:37:16 PM (12 years ago)
Author:
lguez
Message:

In "dynetat0" and "dynredem_*", replaced calls to "nf_get_var*" and
"nf_put_var*" (old NetCDF 77 interface, embedded in a test of
NC_DOUBLE) by calls to "nf90_get_var" and "nf95_put_var". This
required a change of the rank of some variables in those procedures.

Updated the NetCDF95 library, included in "bibio".

Revision tested in sequential and parallel with MPI. Identical
results.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/trunk/libf/bibio/simple.F90

    r1279 r1635  
    22module simple
    33
     4  use handle_err_m, only: handle_err
     5 
    46  implicit none
    57
     8  private handle_err
     9
    610contains
    711
     
    913
    1014    use netcdf, only: nf90_open
    11     use handle_err_m, only: handle_err
    1215
    1316    character(len=*), intent(in):: path
     
    3639
    3740    use netcdf, only: nf90_inq_dimid
    38     use handle_err_m, only: handle_err
    39 
    40     integer,             intent( in) :: ncid
    41     character (len = *), intent( in) :: name
     41
     42    integer,             intent(in) :: ncid
     43    character (len = *), intent(in) :: name
    4244    integer,             intent(out) :: dimid
    4345    integer, intent(out), optional:: ncerr
     
    5254       ncerr = ncerr_not_opt
    5355    else
    54        call handle_err("nf95_inq_dimid", ncerr_not_opt, ncid)
     56       call handle_err("nf95_inq_dimid " // name, ncerr_not_opt, ncid)
    5557    end if
    5658
     
    5961  !************************
    6062
    61   subroutine nf95_inquire_dimension(ncid, dimid, name, len, ncerr)
     63  subroutine nf95_inquire_dimension(ncid, dimid, name, nclen, ncerr)
    6264
    6365    use netcdf, only: nf90_inquire_dimension
    64     use handle_err_m, only: handle_err
    6566
    6667    integer,                       intent( in) :: ncid, dimid
    6768    character (len = *), optional, intent(out) :: name
    68     integer,             optional, intent(out) :: len
    69     integer, intent(out), optional:: ncerr
    70 
    71     ! Variable local to the procedure:
    72     integer ncerr_not_opt
    73 
    74     !-------------------
    75 
    76     ncerr_not_opt = nf90_inquire_dimension(ncid, dimid, name, len)
     69    integer,             optional, intent(out) :: nclen
     70    integer, intent(out), optional:: ncerr
     71
     72    ! Variable local to the procedure:
     73    integer ncerr_not_opt
     74
     75    !-------------------
     76
     77    ncerr_not_opt = nf90_inquire_dimension(ncid, dimid, name, nclen)
    7778    if (present(ncerr)) then
    7879       ncerr = ncerr_not_opt
     
    8889
    8990    use netcdf, only: nf90_inq_varid
    90     use handle_err_m, only: handle_err
    9191
    9292    integer,             intent(in) :: ncid
    93     character (len = *), intent(in) :: name
     93    character(len=*), intent(in):: name
    9494    integer,             intent(out) :: varid
    9595    integer, intent(out), optional:: ncerr
     
    115115
    116116    ! In "nf90_inquire_variable", "dimids" is an assumed-size array.
    117     ! This is the classical case of an array the size of which is
     117    ! This is not optimal.
     118    ! We are in the classical case of an array the size of which is
    118119    ! unknown in the calling procedure, before the call.
    119120    ! Here we use a better solution: a pointer argument array.
     
    121122
    122123    use netcdf, only: nf90_inquire_variable, nf90_max_var_dims
    123     use handle_err_m, only: handle_err
    124124
    125125    integer, intent(in):: ncid, varid
     
    151151       ncerr = ncerr_not_opt
    152152    else
    153        call handle_err("nf95_inquire_variable", ncerr_not_opt, ncid)
     153       call handle_err("nf95_inquire_variable", ncerr_not_opt, ncid, varid)
    154154    end if
    155155
     
    161161   
    162162    use netcdf, only: nf90_create
    163     use handle_err_m, only: handle_err
    164163
    165164    character (len = *), intent(in   ) :: path
     
    186185  !************************
    187186
    188   subroutine nf95_def_dim(ncid, name, len, dimid, ncerr)
     187  subroutine nf95_def_dim(ncid, name, nclen, dimid, ncerr)
    189188
    190189    use netcdf, only: nf90_def_dim
    191     use handle_err_m, only: handle_err
    192190
    193191    integer,             intent( in) :: ncid
    194192    character (len = *), intent( in) :: name
    195     integer,             intent( in) :: len
     193    integer,             intent( in) :: nclen
    196194    integer,             intent(out) :: dimid
    197195    integer, intent(out), optional :: ncerr
     
    202200    !-------------------
    203201
    204     ncerr_not_opt = nf90_def_dim(ncid, name, len, dimid)
    205     if (present(ncerr)) then
    206        ncerr = ncerr_not_opt
    207     else
    208        call handle_err("nf95_def_dim", ncerr_not_opt, ncid)
     202    ncerr_not_opt = nf90_def_dim(ncid, name, nclen, dimid)
     203    if (present(ncerr)) then
     204       ncerr = ncerr_not_opt
     205    else
     206       call handle_err("nf95_def_dim " // name, ncerr_not_opt, ncid)
    209207    end if
    210208
     
    216214
    217215    use netcdf, only: nf90_redef
    218     use handle_err_m, only: handle_err
    219216
    220217    integer, intent( in) :: ncid
     
    240237
    241238    use netcdf, only: nf90_enddef
    242     use handle_err_m, only: handle_err
    243239
    244240    integer,           intent( in) :: ncid
     
    265261
    266262    use netcdf, only: nf90_close
    267     use handle_err_m, only: handle_err
    268263
    269264    integer, intent( in) :: ncid
     
    289284
    290285    use netcdf, only: nf90_copy_att
    291     use handle_err_m, only: handle_err
    292286
    293287    integer, intent( in):: ncid_in,  varid_in
     
    305299       ncerr = ncerr_not_opt
    306300    else
    307        call handle_err("nf95_copy_att", ncerr_not_opt, ncid_out)
     301       call handle_err("nf95_copy_att " // name, ncerr_not_opt, ncid_out)
    308302    end if
    309303
    310304  end subroutine nf95_copy_att
    311305
     306  !***********************
     307
     308  subroutine nf95_inquire_attribute(ncid, varid, name, xtype, nclen, attnum, &
     309       ncerr)
     310
     311    use netcdf, only: nf90_inquire_attribute
     312
     313    integer,             intent( in)           :: ncid, varid
     314    character (len = *), intent( in)           :: name
     315    integer,             intent(out), optional :: xtype, nclen, attnum
     316    integer, intent(out), optional:: ncerr
     317
     318    ! Variable local to the procedure:
     319    integer ncerr_not_opt
     320
     321    !-------------------
     322
     323    ncerr_not_opt = nf90_inquire_attribute(ncid, varid, name, xtype, nclen, &
     324         attnum)
     325    if (present(ncerr)) then
     326       ncerr = ncerr_not_opt
     327    else
     328       call handle_err("nf95_inquire_attribute " // name, ncerr_not_opt, &
     329            ncid, varid)
     330    end if
     331
     332  end subroutine nf95_inquire_attribute
     333
     334  !***********************
     335
     336  subroutine nf95_inquire(ncid, nDimensions, nVariables, nAttributes, &
     337       unlimitedDimId, formatNum, ncerr)
     338
     339    use netcdf, only: nf90_inquire
     340
     341    integer,           intent( in) :: ncid
     342    integer, optional, intent(out) :: nDimensions, nVariables, nAttributes
     343    integer, optional, intent(out) :: unlimitedDimId, formatNum
     344    integer, intent(out), optional:: ncerr
     345
     346    ! Variable local to the procedure:
     347    integer ncerr_not_opt
     348
     349    !-------------------
     350
     351    ncerr_not_opt = nf90_inquire(ncid, nDimensions, nVariables, nAttributes, &
     352         unlimitedDimId, formatNum)
     353    if (present(ncerr)) then
     354       ncerr = ncerr_not_opt
     355    else
     356       call handle_err("nf95_inquire", ncerr_not_opt, ncid)
     357    end if
     358
     359  end subroutine nf95_inquire
     360
    312361end module simple
Note: See TracChangeset for help on using the changeset viewer.