Changeset b9970e3 in flexpart.git


Ignore:
Timestamp:
Dec 15, 2016, 5:28:20 PM (7 years ago)
Author:
Don Morton <Don.Morton@…>
Branches:
fp9.3.1-20161214-nc4
Children:
929ae37
Parents:
5b3cc42
Message:

Incremental addition and testing of NC4 formatting to preprocessed met data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • flexpart_code/fpmetbinary_mod.F90

    r5b3cc42 rb9970e3  
    9292        INTEGER millisecs_start, millisecs_stop, count_rate, count_max
    9393
    94         INTEGER ncretval, ncid
     94        INTEGER :: ncretval, ncid          ! NetCDF func return value, file id
    9595
    9696        CALL SYSTEM_CLOCK(millisecs_start, count_rate, count_max)
     
    109109
    110110
    111         CALL fpio(IOUNIT_DUMP, 'DUMP', cm_index)
     111        CALL fpio(IOUNIT_DUMP, ncid, 'DUMP', cm_index)
    112112        CLOSE(IOUNIT_DUMP)
    113113
     
    126126                                                  ! Should be 1 or 2
    127127
     128        INTEGER :: ncretval, ncid          ! NetCDF func return value, file id
     129
    128130        INTEGER millisecs_start, millisecs_stop, count_rate, count_max
    129131
    130132        CALL SYSTEM_CLOCK(millisecs_start, count_rate, count_max)
     133
     134        print *, "Opening nc file for reading"
     135        ncretval = nf90_open(filename // ".nc4", NF90_NOWRITE, ncid)
     136
     137
     138
    131139        OPEN(IOUNIT_LOAD, file=filename, action='READ', status='OLD', form="unformatted", access="stream")
    132         CALL fpio(IOUNIT_LOAD, 'LOAD', cm_index)
     140        CALL fpio(IOUNIT_LOAD, ncid, 'LOAD', cm_index)
    133141        CLOSE(IOUNIT_LOAD)
    134142        CALL SYSTEM_CLOCK(millisecs_stop, count_rate, count_max)
     
    283291    END SUBROUTINE fpmetbinary_zero
    284292
    285     SUBROUTINE fpio(iounit, op, cm_index)
     293    SUBROUTINE fpio(iounit, ncid, op, cm_index)
    286294        IMPLICIT NONE
     295        INTEGER, INTENT(IN) :: ncid               ! NetCDF file id
    287296        INTEGER, INTENT(IN) :: iounit
    288297        CHARACTER(LEN=4), INTENT(IN) :: op        ! Operation - DUMP or LOAD
     
    291300                                                  ! Should be 1 or 2
    292301
     302
     303        INTEGER :: ncret          ! Return value from NetCDF calls
     304        INTEGER :: nxmax_dimid, nymax_dimid, nzmax_dimid, nuvzmax_dimid, nwzmax_dimid
     305
     306        ! These are used when loading in dimensions from NC file
     307        CHARACTER(LEN=NF90_MAX_NAME) :: nxmax_dimname, nymax_dimname, nzmax_dimname, &
     308&                                       nuvzmax_dimname, nwzmax_dimname
     309
    293310        ! These are temporary variables, used in the LOAD option, for
    294311        ! comparing against the current values in FLEXPART of nxmax, nymax, ...
     
    310327            ! information to provide the structure of arrays
    311328            WRITE (iounit) nxmax, nymax, nzmax, nuvzmax, nwzmax
     329
     330            ncret = nf90_def_dim(ncid, 'nxmax', nxmax, nxmax_dimid)
     331            ncret = nf90_def_dim(ncid, 'nymax', nymax, nymax_dimid)
     332            ncret = nf90_def_dim(ncid, 'nzmax', nzmax, nzmax_dimid)
     333            ncret = nf90_def_dim(ncid, 'nuvzmax', nuvzmax, nuvzmax_dimid)
     334            ncret = nf90_def_dim(ncid, 'nwzmax', nwzmax, nwzmax_dimid)
     335
     336
     337
     338
    312339
    313340            ! Scalar values
     
    474501&                         temp_nuvzmax, temp_nwzmax
    475502
     503            ! Get dimensions
     504            ncret = nf90_inq_dimid(ncid, 'nxmax', nxmax_dimid)
     505            ncret = nf90_inquire_dimension(ncid, nxmax_dimid, nxmax_dimname, &
     506&                                                temp_nxmax)
     507            PRINT *, 'temp_nxmax: ', temp_nxmax
     508
     509            ncret = nf90_inq_dimid(ncid, 'nymax', nymax_dimid)
     510            ncret = nf90_inquire_dimension(ncid, nymax_dimid, nymax_dimname, &
     511&                                                temp_nymax)
     512            PRINT *, 'temp_nymax: ', temp_nymax
     513
     514            ncret = nf90_inq_dimid(ncid, 'nzmax', nzmax_dimid)
     515            ncret = nf90_inquire_dimension(ncid, nzmax_dimid, nzmax_dimname, &
     516&                                                temp_nzmax)
     517            PRINT *, 'temp_nzmax: ', temp_nzmax
     518
     519            ncret = nf90_inq_dimid(ncid, 'nuvzmax', nuvzmax_dimid)
     520            ncret = nf90_inquire_dimension(ncid, nuvzmax_dimid, nuvzmax_dimname, &
     521&                                                temp_nuvzmax)
     522            PRINT *, 'temp_nuvzmax: ', temp_nuvzmax
     523
     524            ncret = nf90_inq_dimid(ncid, 'nwzmax', nwzmax_dimid)
     525            ncret = nf90_inquire_dimension(ncid, nwzmax_dimid, nwzmax_dimname, &
     526&                                                temp_nwzmax)
     527            PRINT *, 'temp_nwzmax: ', temp_nwzmax
     528
     529
    476530
    477531            IF ( (temp_nxmax == nxmax) .AND. (temp_nymax == nymax) .AND. &
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG