Changeset 5f50284 in flexpart.git


Ignore:
Timestamp:
Apr 15, 2017, 5:36:41 PM (7 years ago)
Author:
Don Morton <Don.Morton@…>
Branches:
fp9.3.1-20161214-nc4
Children:
515b21c
Parents:
89ad9c3
Message:

In fp9.3.1-20161214-nc4 branch, decoupled the NC4 FP format from
raw binary (just commented that out for now) and tested
successfully.

Location:
flexpart_code
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • flexpart_code/fpgridcheck.F90

    r48a5c5c r5f50284  
    1313  integer :: i
    1414  logical :: exists
    15   character(len=512) fpfname    ! .fp filename
     15  character(len=512) fpfname    !  .fp filename
    1616
    1717
     
    5252  ! load the other stuff in index 1.  It will be overwritten in subsequent
    5353  ! loads.
     54
     55
     56PRINT *, 'fpgridcheck(): fpfname:', fpfname
    5457  CALL fpmetbinary_load(TRIM(fpfname), 1)
    5558
  • flexpart_code/fpmetbinary_mod.F90

    r89ad9c3 r5f50284  
    9999        ! Create and open NC4 file for writing
    100100        PRINT *, 'Opening NC4 file...'
    101         ncretval = nf90_create(filename // ".nc4", &
     101        ncretval = nf90_create(filename, &
    102102&                              OR(NF90_CLOBBER, NF90_HDF5), &
    103103&                              ncid)
    104104
     105
     106#ifdef RAWBIN
    105107        OPEN(IOUNIT_DUMP, file=filename, action='WRITE', status='REPLACE', form="unformatted", access="stream")
    106 
     108#endif
    107109
    108110
     
    111113
    112114        CALL fpio(IOUNIT_DUMP, ncid, 'DUMP', cm_index)
     115
     116#ifdef RAWBIN
    113117        CLOSE(IOUNIT_DUMP)
     118#endif
    114119
    115120        PRINT *, 'Closing NC4 file...'
     
    133138        CALL SYSTEM_CLOCK(millisecs_start, count_rate, count_max)
    134139
    135         print *, "Opening nc file for reading"
    136         ncretval = nf90_open(filename // ".nc4", NF90_NOWRITE, ncid)
    137 
    138 
    139 
     140PRINT *, "filename: ", filename
     141PRINT *, "Opening nc file for reading: ", filename
     142        ncretval = nf90_open(filename, NF90_NOWRITE, ncid)
     143        call handle_nf90_err(ncretval)
     144PRINT *, 'OPENED NC4 FILE FOR READING...'
     145
     146
     147
     148#ifdef RAWBIN
    140149        OPEN(IOUNIT_LOAD, file=filename, action='READ', status='OLD', form="unformatted", access="stream")
     150#endif
     151
    141152        CALL fpio(IOUNIT_LOAD, ncid, 'LOAD', cm_index)
     153
     154#ifdef RAWBIN
    142155        CLOSE(IOUNIT_LOAD)
     156#endif
     157
     158
    143159        CALL SYSTEM_CLOCK(millisecs_stop, count_rate, count_max)
    144160        !PRINT *, 'Load walltime secs: ', (millisecs_stop-millisecs_start)/1000.0
     
    352368
    353369            ! Write the preprocessing format version string
     370            !  NEED TO FILL THIS IN FOR NC4
     371
     372
     373#ifdef RAWBIN
    354374            WRITE (iounit) PREPROC_FORMAT_VERSION_STR
     375
     376#endif
    355377
    356378            ! Write the compiled max dimensions from par_mod - these are
    357379            ! not meant to be reassigned during a LOAD, but used as "header"
    358380            ! information to provide the structure of arrays
     381
     382#ifdef RAWBIN
    359383            WRITE (iounit) nxmax, nymax, nzmax, nuvzmax, nwzmax
     384#endif
     385
    360386
    361387            ncret = nf90_def_dim(ncid, 'nxmax', nxmax, nxmax_dimid)
     
    392418
    393419            ! Scalar values
     420
     421
     422#ifdef RAWBIN
    394423            WRITE(iounit) nx, ny, nxmin1, nymin1, nxfield
    395424            WRITE(iounit) nuvz, nwz, nz, nmixz, nlev_ec
    396425            WRITE(iounit) dx, dy, xlon0, ylat0, dxconst, dyconst
     426#endif
    397427
    398428            ncret = nf90_def_var(ncid, 'nx', NF90_INT, ncvarid)
     
    479509
    480510            ! Fixed fields, static in time
     511
     512
     513#ifdef RAWBIN
    481514            WRITE(iounit) oro, excessoro, lsm, xlanduse, height
     515#endif
    482516
    483517            dim2dids = (/nxmax_dimid, nymax_dimid/)
     
    550584
    551585            ! 3d fields
     586
     587
     588
     589#ifdef RAWBIN
    552590            WRITE(iounit) uu(:,:,:,cm_index)
    553591            WRITE(iounit) vv(:,:,:,cm_index)
     
    565603            WRITE(iounit) clouds(:,:,:,cm_index)
    566604            WRITE(iounit) cloudsh(:,:,cm_index)
     605#endif
     606
     607
    567608
    568609            dim3dids = (/nxmax_dimid, nymax_dimid, nzmax_dimid/)
     
    766807
    767808            ! 2d fields
     809
     810
     811#ifdef RAWBIN
    768812            WRITE(iounit) ps(:,:,:,cm_index)
    769813            WRITE(iounit) sd(:,:,:,cm_index)
     
    786830            WRITE(iounit) diffk(:,:,:,cm_index)
    787831            WRITE(iounit) vdep(:,:,:,cm_index)
     832#endif
     833
     834
    788835
    789836            dim2dids = (/nxmax_dimid, nymax_dimid/)
     
    10431090
    10441091            ! 1d fields
     1092
     1093
     1094
     1095#ifdef RAWBIN
    10451096            WRITE(iounit) z0(:)
    10461097            WRITE(iounit) akm(:)
     
    10501101            WRITE(iounit) aknew(:)
    10511102            WRITE(iounit) bknew(:)
     1103#endif
    10521104
    10531105            dim1dids = (/numclass_dimid/)
     
    11611213            call handle_nf90_err(ncret)
    11621214
     1215
     1216#ifdef RAWBIN
    11631217            WRITE(iounit) nxn(:)
    11641218            WRITE(iounit) nyn(:)
     
    11671221            WRITE(iounit) xlon0n(:)
    11681222            WRITE(iounit) ylat0n(:)
     1223#endif
    11691224
    11701225            ! Nested, scalar values (for each nest)
     
    13071362
    13081363            ! 3d nested fields
     1364
     1365
     1366
     1367#ifdef RAWBIN
    13091368            WRITE(iounit) uun(:,:,:,cm_index,:)
    13101369            WRITE(iounit) vvn(:,:,:,cm_index,:)
     
    13191378            WRITE(iounit) tthn(:,:,:,cm_index,:)
    13201379            WRITE(iounit) qvhn(:,:,:,cm_index,:)
    1321 
     1380#endif
    13221381
    13231382            dim4dids = (/nxmaxn_dimid, nymaxn_dimid, nzmax_dimid, maxnests_dimid/)
     
    14921551
    14931552            ! 2d nested fields
     1553
     1554
     1555#ifdef RAWBIN
    14941556            WRITE(iounit) psn(:,:,:,cm_index,:)
    14951557            WRITE(iounit) sdn(:,:,:,cm_index,:)
     
    15121574            WRITE(iounit) diffkn(:,:,:,cm_index,:)
    15131575            WRITE(iounit) vdepn(:,:,:,cm_index,:)
     1576#endif
     1577
    15141578
    15151579            dim3dids = (/nxmaxn_dimid, nymaxn_dimid, maxnests_dimid/)
     
    17711835
    17721836            ! Auxiliary variables for nests
     1837
     1838#ifdef RAWBIN
    17731839            WRITE(iounit) xresoln(:)
    17741840            WRITE(iounit) yresoln(:)
     
    17771843            WRITE(iounit) xrn(:)
    17781844            WRITE(iounit) yrn(:)
     1845#endif
     1846
    17791847
    17801848            dim1dids = (/zero_to_maxnests_dimid/)
     
    18601928
    18611929            ! Variables for polar stereographic projection
     1930
     1931
     1932
     1933#ifdef RAWBIN
    18621934            WRITE(iounit) xglobal, sglobal, nglobal
    18631935            WRITE(iounit) switchnorthg, switchsouthg
    18641936            WRITE(iounit) southpolemap(:)
    18651937            WRITE(iounit) northpolemap(:)
    1866 
     1938#endif
    18671939
    18681940
     
    19251997
    19261998            ! Variables declared in conv_mod (convection)
     1999
     2000
     2001#ifdef RAWBIN
    19272002            WRITE(iounit) pconv(:)
    19282003            WRITE(iounit) phconv(:)
     
    19422017            WRITE(iounit) psconv, tt2conv, td2conv
    19432018            WRITE(iounit) nconvlev, nconvtop
     2019#endif
    19442020
    19452021
     
    21332209            ! Read the preprocessed format version string and insure it
    21342210            ! matches this version
     2211
     2212
     2213#ifdef RAWBIN
    21352214            READ (iounit) temp_preproc_format_version_str
    21362215            PRINT *, 'Reading preprocessed file format version: ', &
     
    21482227                STOP
    21492228            END IF
     2229#endif
     2230
     2231
     2232
    21502233
    21512234            ! Read the compiled max dimensions that were dumped from par_mod
     
    21532236            ! current FLEXPART dimensions - they need to be the same, or else
    21542237            ! we abort.
     2238
     2239
     2240
     2241#ifdef RAWBIN
    21552242            READ (iounit) temp_nxmax, temp_nymax, temp_nzmax, &
    21562243&                         temp_nuvzmax, temp_nwzmax
    2157 
     2244#endif
     2245
     2246
     2247
     2248
     2249PRINT *, 'GET DIMENSIONS'
    21582250            ! Get dimensions
    21592251            ncret = nf90_inq_dimid(ncid, 'nxmax', nxmax_dimid)
    21602252            call handle_nf90_err(ncret)
     2253PRINT *, 'GOT nxmax_dimid'           
    21612254            ncret = nf90_inquire_dimension(ncid, nxmax_dimid, nxmax_dimname, &
    21622255&                                                temp_nxmax)
     
    21642257            PRINT *, 'temp_nxmax: ', temp_nxmax
    21652258
     2259PRINT *, 'GOT temp_nxmax'
     2260
    21662261            ncret = nf90_inq_dimid(ncid, 'nymax', nymax_dimid)
    21672262            call handle_nf90_err(ncret)
     
    22072302
    22082303
     2304
     2305PRINT *, 'CHECK DIMENSIONS'
    22092306
    22102307            IF ( (temp_nxmax == nxmax) .AND. (temp_nymax == nymax) .AND. &
     
    22342331
    22352332            ! Scalar values
     2333
     2334
     2335#ifdef RAWBIN
    22362336            READ(iounit) nx, ny, nxmin1, nymin1, nxfield
    22372337            READ(iounit) nuvz, nwz, nz, nmixz, nlev_ec
    22382338            READ(iounit) dx, dy, xlon0, ylat0, dxconst, dyconst
    2239 
    2240 
     2339#endif
     2340
     2341
     2342
     2343
     2344PRINT *, 'GET SCALARS'
    22412345
    22422346            ! Get the varid , then read into scalar variable
     
    23272431
    23282432            ! Fixed fields, static in time
     2433           
     2434#ifdef RAWBIN           
    23292435            READ(iounit) oro, excessoro, lsm, xlanduse, height
     2436#endif
    23302437
    23312438            ncret = nf90_inq_varid(ncid, 'oro', ncvarid)
     
    23582465
    23592466            ! 3d fields
     2467
     2468
     2469
     2470#ifdef RAWBIN
    23602471            READ(iounit) uu(:,:,:,cm_index)
    23612472            READ(iounit) vv(:,:,:,cm_index)
     
    23732484            READ(iounit) clouds(:,:,:,cm_index)
    23742485            READ(iounit) cloudsh(:,:,cm_index)
    2375 
     2486#endif
    23762487
    23772488
     
    24302541            ncret = nf90_inq_varid(ncid, 'clouds', ncvarid)
    24312542            call handle_nf90_err(ncret)
    2432             ncret = nf90_get_var(ncid, ncvarid, clouds(0:nxmax-1,0:nzmax-1,1:nzmax,cm_index))
     2543            ncret = nf90_get_var(ncid, ncvarid, clouds(0:nxmax-1,0:nymax-1,1:nzmax,cm_index))
    24332544            call handle_nf90_err(ncret)
    24342545
     
    24662577
    24672578            ! 2d fields
     2579
     2580
     2581#ifdef RAWBIN
    24682582            READ(iounit) ps(:,:,:,cm_index)
    24692583            READ(iounit) sd(:,:,:,cm_index)
     
    24862600            READ(iounit) diffk(:,:,:,cm_index)
    24872601            READ(iounit) vdep(:,:,:,cm_index)
     2602#endif
     2603
     2604
    24882605
    24892606            ! Get the varid and read the variable into the array
     
    26032720
    26042721            ! 1d fields
     2722
     2723#ifdef RAWBIN
    26052724            READ(iounit) z0(:)
    26062725            READ(iounit) akm(:)
     
    26102729            READ(iounit) aknew(:)
    26112730            READ(iounit) bknew(:)
    2612 
     2731#endif
    26132732
    26142733            ncret = nf90_inq_varid(ncid, 'z0', ncvarid)
     
    27012820
    27022821            ! Nested, scalar values (for each nest)
     2822
     2823
     2824
     2825
     2826#ifdef RAWBIN
    27032827            READ(iounit) nxn(:)
    27042828            READ(iounit) nyn(:)
     
    27072831            READ(iounit) xlon0n(:)
    27082832            READ(iounit) ylat0n(:)
     2833#endif
    27092834
    27102835
     
    27422867
    27432868            ! Nested fields, static over time
     2869
     2870#ifdef RAWBIN
    27442871            READ(iounit) oron, excessoron, lsmn, xlandusen
     2872#endif
    27452873
    27462874            ncret = nf90_inq_varid(ncid, 'oron', ncvarid)
     
    27712899
    27722900            ! 3d nested fields
     2901
     2902#ifdef RAWBIN
    27732903            READ(iounit) uun(:,:,:,cm_index,:)
    27742904            READ(iounit) vvn(:,:,:,cm_index,:)
     
    27832913            READ(iounit) tthn(:,:,:,cm_index,:)
    27842914            READ(iounit) qvhn(:,:,:,cm_index,:)
    2785 
     2915#endif
    27862916
    27872917            ncret = nf90_inq_varid(ncid, 'uun', ncvarid)
     
    28562986
    28572987            ! 2d nested fields
     2988
     2989
     2990#ifdef RAWBIN
    28582991            READ(iounit) psn(:,:,:,cm_index,:)
    28592992            READ(iounit) sdn(:,:,:,cm_index,:)
     
    28763009            READ(iounit) diffkn(:,:,:,cm_index,:)
    28773010            READ(iounit) vdepn(:,:,:,cm_index,:)
     3011#endif
     3012
    28783013
    28793014            ncret = nf90_inq_varid(ncid, 'psn', ncvarid)
     
    29873122
    29883123            ! Auxiliary variables for nests
     3124
     3125
     3126#ifdef RAWBIN
    29893127            READ(iounit) xresoln(:)
    29903128            READ(iounit) yresoln(:)
     
    29933131            READ(iounit) xrn(:)
    29943132            READ(iounit) yrn(:)
     3133#endif
     3134
    29953135
    29963136            ncret = nf90_inq_varid(ncid, 'xresoln', ncvarid)
     
    30323172
    30333173            ! Variables for polar stereographic projection
     3174
     3175
     3176#ifdef RAWBIN
    30343177            READ(iounit) xglobal, sglobal, nglobal
    30353178            READ(iounit) switchnorthg, switchsouthg
    30363179            READ(iounit) southpolemap(:)
    30373180            READ(iounit) northpolemap(:)
    3038 
     3181#endif
    30393182
    30403183            ncret = nf90_inq_varid(ncid, 'southpolemap', ncvarid)
     
    30893232
    30903233            ! Variables declared in conv_mod (convection)
     3234
     3235
     3236#ifdef RAWBIN
    30913237            READ(iounit) pconv(:)
    30923238            READ(iounit) phconv(:)
     
    31063252            READ(iounit) psconv, tt2conv, td2conv
    31073253            READ(iounit) nconvlev, nconvtop
     3254#endif
     3255
     3256
    31083257
    31093258            ncret = nf90_inq_varid(ncid, 'pconv', ncvarid)
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG