Changeset 5f50284 in flexpart.git
- Timestamp:
- Apr 15, 2017, 5:36:41 PM (7 years ago)
- Branches:
- fp9.3.1-20161214-nc4
- Children:
- 515b21c
- Parents:
- 89ad9c3
- Location:
- flexpart_code
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
flexpart_code/fpgridcheck.F90
r48a5c5c r5f50284 13 13 integer :: i 14 14 logical :: exists 15 character(len=512) fpfname ! .fp filename15 character(len=512) fpfname ! .fp filename 16 16 17 17 … … 52 52 ! load the other stuff in index 1. It will be overwritten in subsequent 53 53 ! loads. 54 55 56 PRINT *, 'fpgridcheck(): fpfname:', fpfname 54 57 CALL fpmetbinary_load(TRIM(fpfname), 1) 55 58 -
flexpart_code/fpmetbinary_mod.F90
r89ad9c3 r5f50284 99 99 ! Create and open NC4 file for writing 100 100 PRINT *, 'Opening NC4 file...' 101 ncretval = nf90_create(filename // ".nc4", &101 ncretval = nf90_create(filename, & 102 102 & OR(NF90_CLOBBER, NF90_HDF5), & 103 103 & ncid) 104 104 105 106 #ifdef RAWBIN 105 107 OPEN(IOUNIT_DUMP, file=filename, action='WRITE', status='REPLACE', form="unformatted", access="stream") 106 108 #endif 107 109 108 110 … … 111 113 112 114 CALL fpio(IOUNIT_DUMP, ncid, 'DUMP', cm_index) 115 116 #ifdef RAWBIN 113 117 CLOSE(IOUNIT_DUMP) 118 #endif 114 119 115 120 PRINT *, 'Closing NC4 file...' … … 133 138 CALL SYSTEM_CLOCK(millisecs_start, count_rate, count_max) 134 139 135 print *, "Opening nc file for reading" 136 ncretval = nf90_open(filename // ".nc4", NF90_NOWRITE, ncid) 137 138 139 140 PRINT *, "filename: ", filename 141 PRINT *, "Opening nc file for reading: ", filename 142 ncretval = nf90_open(filename, NF90_NOWRITE, ncid) 143 call handle_nf90_err(ncretval) 144 PRINT *, 'OPENED NC4 FILE FOR READING...' 145 146 147 148 #ifdef RAWBIN 140 149 OPEN(IOUNIT_LOAD, file=filename, action='READ', status='OLD', form="unformatted", access="stream") 150 #endif 151 141 152 CALL fpio(IOUNIT_LOAD, ncid, 'LOAD', cm_index) 153 154 #ifdef RAWBIN 142 155 CLOSE(IOUNIT_LOAD) 156 #endif 157 158 143 159 CALL SYSTEM_CLOCK(millisecs_stop, count_rate, count_max) 144 160 !PRINT *, 'Load walltime secs: ', (millisecs_stop-millisecs_start)/1000.0 … … 352 368 353 369 ! Write the preprocessing format version string 370 ! NEED TO FILL THIS IN FOR NC4 371 372 373 #ifdef RAWBIN 354 374 WRITE (iounit) PREPROC_FORMAT_VERSION_STR 375 376 #endif 355 377 356 378 ! Write the compiled max dimensions from par_mod - these are 357 379 ! not meant to be reassigned during a LOAD, but used as "header" 358 380 ! information to provide the structure of arrays 381 382 #ifdef RAWBIN 359 383 WRITE (iounit) nxmax, nymax, nzmax, nuvzmax, nwzmax 384 #endif 385 360 386 361 387 ncret = nf90_def_dim(ncid, 'nxmax', nxmax, nxmax_dimid) … … 392 418 393 419 ! Scalar values 420 421 422 #ifdef RAWBIN 394 423 WRITE(iounit) nx, ny, nxmin1, nymin1, nxfield 395 424 WRITE(iounit) nuvz, nwz, nz, nmixz, nlev_ec 396 425 WRITE(iounit) dx, dy, xlon0, ylat0, dxconst, dyconst 426 #endif 397 427 398 428 ncret = nf90_def_var(ncid, 'nx', NF90_INT, ncvarid) … … 479 509 480 510 ! Fixed fields, static in time 511 512 513 #ifdef RAWBIN 481 514 WRITE(iounit) oro, excessoro, lsm, xlanduse, height 515 #endif 482 516 483 517 dim2dids = (/nxmax_dimid, nymax_dimid/) … … 550 584 551 585 ! 3d fields 586 587 588 589 #ifdef RAWBIN 552 590 WRITE(iounit) uu(:,:,:,cm_index) 553 591 WRITE(iounit) vv(:,:,:,cm_index) … … 565 603 WRITE(iounit) clouds(:,:,:,cm_index) 566 604 WRITE(iounit) cloudsh(:,:,cm_index) 605 #endif 606 607 567 608 568 609 dim3dids = (/nxmax_dimid, nymax_dimid, nzmax_dimid/) … … 766 807 767 808 ! 2d fields 809 810 811 #ifdef RAWBIN 768 812 WRITE(iounit) ps(:,:,:,cm_index) 769 813 WRITE(iounit) sd(:,:,:,cm_index) … … 786 830 WRITE(iounit) diffk(:,:,:,cm_index) 787 831 WRITE(iounit) vdep(:,:,:,cm_index) 832 #endif 833 834 788 835 789 836 dim2dids = (/nxmax_dimid, nymax_dimid/) … … 1043 1090 1044 1091 ! 1d fields 1092 1093 1094 1095 #ifdef RAWBIN 1045 1096 WRITE(iounit) z0(:) 1046 1097 WRITE(iounit) akm(:) … … 1050 1101 WRITE(iounit) aknew(:) 1051 1102 WRITE(iounit) bknew(:) 1103 #endif 1052 1104 1053 1105 dim1dids = (/numclass_dimid/) … … 1161 1213 call handle_nf90_err(ncret) 1162 1214 1215 1216 #ifdef RAWBIN 1163 1217 WRITE(iounit) nxn(:) 1164 1218 WRITE(iounit) nyn(:) … … 1167 1221 WRITE(iounit) xlon0n(:) 1168 1222 WRITE(iounit) ylat0n(:) 1223 #endif 1169 1224 1170 1225 ! Nested, scalar values (for each nest) … … 1307 1362 1308 1363 ! 3d nested fields 1364 1365 1366 1367 #ifdef RAWBIN 1309 1368 WRITE(iounit) uun(:,:,:,cm_index,:) 1310 1369 WRITE(iounit) vvn(:,:,:,cm_index,:) … … 1319 1378 WRITE(iounit) tthn(:,:,:,cm_index,:) 1320 1379 WRITE(iounit) qvhn(:,:,:,cm_index,:) 1321 1380 #endif 1322 1381 1323 1382 dim4dids = (/nxmaxn_dimid, nymaxn_dimid, nzmax_dimid, maxnests_dimid/) … … 1492 1551 1493 1552 ! 2d nested fields 1553 1554 1555 #ifdef RAWBIN 1494 1556 WRITE(iounit) psn(:,:,:,cm_index,:) 1495 1557 WRITE(iounit) sdn(:,:,:,cm_index,:) … … 1512 1574 WRITE(iounit) diffkn(:,:,:,cm_index,:) 1513 1575 WRITE(iounit) vdepn(:,:,:,cm_index,:) 1576 #endif 1577 1514 1578 1515 1579 dim3dids = (/nxmaxn_dimid, nymaxn_dimid, maxnests_dimid/) … … 1771 1835 1772 1836 ! Auxiliary variables for nests 1837 1838 #ifdef RAWBIN 1773 1839 WRITE(iounit) xresoln(:) 1774 1840 WRITE(iounit) yresoln(:) … … 1777 1843 WRITE(iounit) xrn(:) 1778 1844 WRITE(iounit) yrn(:) 1845 #endif 1846 1779 1847 1780 1848 dim1dids = (/zero_to_maxnests_dimid/) … … 1860 1928 1861 1929 ! Variables for polar stereographic projection 1930 1931 1932 1933 #ifdef RAWBIN 1862 1934 WRITE(iounit) xglobal, sglobal, nglobal 1863 1935 WRITE(iounit) switchnorthg, switchsouthg 1864 1936 WRITE(iounit) southpolemap(:) 1865 1937 WRITE(iounit) northpolemap(:) 1866 1938 #endif 1867 1939 1868 1940 … … 1925 1997 1926 1998 ! Variables declared in conv_mod (convection) 1999 2000 2001 #ifdef RAWBIN 1927 2002 WRITE(iounit) pconv(:) 1928 2003 WRITE(iounit) phconv(:) … … 1942 2017 WRITE(iounit) psconv, tt2conv, td2conv 1943 2018 WRITE(iounit) nconvlev, nconvtop 2019 #endif 1944 2020 1945 2021 … … 2133 2209 ! Read the preprocessed format version string and insure it 2134 2210 ! matches this version 2211 2212 2213 #ifdef RAWBIN 2135 2214 READ (iounit) temp_preproc_format_version_str 2136 2215 PRINT *, 'Reading preprocessed file format version: ', & … … 2148 2227 STOP 2149 2228 END IF 2229 #endif 2230 2231 2232 2150 2233 2151 2234 ! Read the compiled max dimensions that were dumped from par_mod … … 2153 2236 ! current FLEXPART dimensions - they need to be the same, or else 2154 2237 ! we abort. 2238 2239 2240 2241 #ifdef RAWBIN 2155 2242 READ (iounit) temp_nxmax, temp_nymax, temp_nzmax, & 2156 2243 & temp_nuvzmax, temp_nwzmax 2157 2244 #endif 2245 2246 2247 2248 2249 PRINT *, 'GET DIMENSIONS' 2158 2250 ! Get dimensions 2159 2251 ncret = nf90_inq_dimid(ncid, 'nxmax', nxmax_dimid) 2160 2252 call handle_nf90_err(ncret) 2253 PRINT *, 'GOT nxmax_dimid' 2161 2254 ncret = nf90_inquire_dimension(ncid, nxmax_dimid, nxmax_dimname, & 2162 2255 & temp_nxmax) … … 2164 2257 PRINT *, 'temp_nxmax: ', temp_nxmax 2165 2258 2259 PRINT *, 'GOT temp_nxmax' 2260 2166 2261 ncret = nf90_inq_dimid(ncid, 'nymax', nymax_dimid) 2167 2262 call handle_nf90_err(ncret) … … 2207 2302 2208 2303 2304 2305 PRINT *, 'CHECK DIMENSIONS' 2209 2306 2210 2307 IF ( (temp_nxmax == nxmax) .AND. (temp_nymax == nymax) .AND. & … … 2234 2331 2235 2332 ! Scalar values 2333 2334 2335 #ifdef RAWBIN 2236 2336 READ(iounit) nx, ny, nxmin1, nymin1, nxfield 2237 2337 READ(iounit) nuvz, nwz, nz, nmixz, nlev_ec 2238 2338 READ(iounit) dx, dy, xlon0, ylat0, dxconst, dyconst 2239 2240 2339 #endif 2340 2341 2342 2343 2344 PRINT *, 'GET SCALARS' 2241 2345 2242 2346 ! Get the varid , then read into scalar variable … … 2327 2431 2328 2432 ! Fixed fields, static in time 2433 2434 #ifdef RAWBIN 2329 2435 READ(iounit) oro, excessoro, lsm, xlanduse, height 2436 #endif 2330 2437 2331 2438 ncret = nf90_inq_varid(ncid, 'oro', ncvarid) … … 2358 2465 2359 2466 ! 3d fields 2467 2468 2469 2470 #ifdef RAWBIN 2360 2471 READ(iounit) uu(:,:,:,cm_index) 2361 2472 READ(iounit) vv(:,:,:,cm_index) … … 2373 2484 READ(iounit) clouds(:,:,:,cm_index) 2374 2485 READ(iounit) cloudsh(:,:,cm_index) 2375 2486 #endif 2376 2487 2377 2488 … … 2430 2541 ncret = nf90_inq_varid(ncid, 'clouds', ncvarid) 2431 2542 call handle_nf90_err(ncret) 2432 ncret = nf90_get_var(ncid, ncvarid, clouds(0:nxmax-1,0:n zmax-1,1:nzmax,cm_index))2543 ncret = nf90_get_var(ncid, ncvarid, clouds(0:nxmax-1,0:nymax-1,1:nzmax,cm_index)) 2433 2544 call handle_nf90_err(ncret) 2434 2545 … … 2466 2577 2467 2578 ! 2d fields 2579 2580 2581 #ifdef RAWBIN 2468 2582 READ(iounit) ps(:,:,:,cm_index) 2469 2583 READ(iounit) sd(:,:,:,cm_index) … … 2486 2600 READ(iounit) diffk(:,:,:,cm_index) 2487 2601 READ(iounit) vdep(:,:,:,cm_index) 2602 #endif 2603 2604 2488 2605 2489 2606 ! Get the varid and read the variable into the array … … 2603 2720 2604 2721 ! 1d fields 2722 2723 #ifdef RAWBIN 2605 2724 READ(iounit) z0(:) 2606 2725 READ(iounit) akm(:) … … 2610 2729 READ(iounit) aknew(:) 2611 2730 READ(iounit) bknew(:) 2612 2731 #endif 2613 2732 2614 2733 ncret = nf90_inq_varid(ncid, 'z0', ncvarid) … … 2701 2820 2702 2821 ! Nested, scalar values (for each nest) 2822 2823 2824 2825 2826 #ifdef RAWBIN 2703 2827 READ(iounit) nxn(:) 2704 2828 READ(iounit) nyn(:) … … 2707 2831 READ(iounit) xlon0n(:) 2708 2832 READ(iounit) ylat0n(:) 2833 #endif 2709 2834 2710 2835 … … 2742 2867 2743 2868 ! Nested fields, static over time 2869 2870 #ifdef RAWBIN 2744 2871 READ(iounit) oron, excessoron, lsmn, xlandusen 2872 #endif 2745 2873 2746 2874 ncret = nf90_inq_varid(ncid, 'oron', ncvarid) … … 2771 2899 2772 2900 ! 3d nested fields 2901 2902 #ifdef RAWBIN 2773 2903 READ(iounit) uun(:,:,:,cm_index,:) 2774 2904 READ(iounit) vvn(:,:,:,cm_index,:) … … 2783 2913 READ(iounit) tthn(:,:,:,cm_index,:) 2784 2914 READ(iounit) qvhn(:,:,:,cm_index,:) 2785 2915 #endif 2786 2916 2787 2917 ncret = nf90_inq_varid(ncid, 'uun', ncvarid) … … 2856 2986 2857 2987 ! 2d nested fields 2988 2989 2990 #ifdef RAWBIN 2858 2991 READ(iounit) psn(:,:,:,cm_index,:) 2859 2992 READ(iounit) sdn(:,:,:,cm_index,:) … … 2876 3009 READ(iounit) diffkn(:,:,:,cm_index,:) 2877 3010 READ(iounit) vdepn(:,:,:,cm_index,:) 3011 #endif 3012 2878 3013 2879 3014 ncret = nf90_inq_varid(ncid, 'psn', ncvarid) … … 2987 3122 2988 3123 ! Auxiliary variables for nests 3124 3125 3126 #ifdef RAWBIN 2989 3127 READ(iounit) xresoln(:) 2990 3128 READ(iounit) yresoln(:) … … 2993 3131 READ(iounit) xrn(:) 2994 3132 READ(iounit) yrn(:) 3133 #endif 3134 2995 3135 2996 3136 ncret = nf90_inq_varid(ncid, 'xresoln', ncvarid) … … 3032 3172 3033 3173 ! Variables for polar stereographic projection 3174 3175 3176 #ifdef RAWBIN 3034 3177 READ(iounit) xglobal, sglobal, nglobal 3035 3178 READ(iounit) switchnorthg, switchsouthg 3036 3179 READ(iounit) southpolemap(:) 3037 3180 READ(iounit) northpolemap(:) 3038 3181 #endif 3039 3182 3040 3183 ncret = nf90_inq_varid(ncid, 'southpolemap', ncvarid) … … 3089 3232 3090 3233 ! Variables declared in conv_mod (convection) 3234 3235 3236 #ifdef RAWBIN 3091 3237 READ(iounit) pconv(:) 3092 3238 READ(iounit) phconv(:) … … 3106 3252 READ(iounit) psconv, tt2conv, td2conv 3107 3253 READ(iounit) nconvlev, nconvtop 3254 #endif 3255 3256 3108 3257 3109 3258 ncret = nf90_inq_varid(ncid, 'pconv', ncvarid)
Note: See TracChangeset
for help on using the changeset viewer.