Changeset 1551 for palm/trunk/SOURCE/netcdf.f90
- Timestamp:
- Mar 3, 2015 2:18:16 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/netcdf.f90
r1354 r1551 23 23 ! Current revisions: 24 24 ! ------------------ 25 ! 25 ! Added support for land surface model and radiation model output. In the course 26 ! of this action a new vertical grid zs (soil) was introduced. 26 27 ! 27 28 ! Former revisions: … … 97 98 ! In case of extend = .TRUE.: 98 99 ! Find out if dimensions and variables of an existing file match the values 99 ! of the actual run. If so, get all necessary information s(ids, etc.) from100 ! of the actual run. If so, get all necessary information (ids, etc.) from 100 101 ! this file. 101 102 ! … … 130 131 131 132 USE kinds 133 134 USE land_surface_model_mod, & 135 ONLY: land_surface, nzb_soil, nzt_soil, id_dim_zs_xy, id_dim_zs_xz, & 136 id_dim_zs_yz, id_dim_zs_3d, id_dim_zs_mask, id_var_zs_xy, & 137 id_var_zs_xz, id_var_zs_yz ,id_var_zs_3d, id_var_zs_mask, & 138 nzs, zs 132 139 133 140 USE pegrid … … 181 188 INTEGER(iwp) :: kk !: 182 189 INTEGER(iwp) :: ns !: 190 INTEGER(iwp) :: ns_do !: actual value of ns for soil model data 183 191 INTEGER(iwp) :: ns_old !: 184 192 INTEGER(iwp) :: ntime_count !: … … 439 447 ! 440 448 !-- In case of non-flat topography define 2d-arrays containing the height 441 !-- information s449 !-- information 442 450 IF ( TRIM( topography ) /= 'flat' ) THEN 443 451 ! … … 478 486 479 487 ENDIF 480 488 489 IF ( land_surface ) THEN 490 ! 491 !-- Define vertical coordinate grid (zw grid) 492 nc_stat = NF90_DEF_DIM( id_set_mask(mid,av), 'zs_3d', & 493 mask_size(mid,3), id_dim_zs_mask(mid,av) ) 494 CALL handle_netcdf_error( 'netcdf', 536 ) 495 496 nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'zs_3d', NF90_DOUBLE, & 497 id_dim_zs_mask(mid,av), & 498 id_var_zs_mask(mid,av) ) 499 CALL handle_netcdf_error( 'netcdf', 536 ) 500 501 nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), id_var_zs_mask(mid,av), & 502 'units', 'meters' ) 503 CALL handle_netcdf_error( 'netcdf', 537 ) 504 505 ENDIF 481 506 482 507 ! … … 521 546 grid_y = 'y' 522 547 grid_z = 'zw' 548 ! 549 !-- soil grid 550 CASE ( 't_soil', 'm_soil' ) 551 552 grid_x = 'x' 553 grid_y = 'y' 554 grid_z = 'zs' 523 555 524 556 CASE DEFAULT … … 548 580 ELSEIF ( grid_z == 'zw' ) THEN 549 581 id_z = id_dim_zw_mask(mid,av) 582 ELSEIF ( grid_z == "zs" ) THEN 583 id_z = id_dim_zs_mask(mid,av) 550 584 ENDIF 551 585 … … 692 726 693 727 ENDIF 728 729 IF ( land_surface ) THEN 730 ! 731 !-- Write zs data (vertical axes for soil model), use negative values 732 !-- to indicate soil depth 733 ALLOCATE( netcdf_data(mask_size(mid,3)) ) 734 735 netcdf_data = zs( mask_k_global(mid,:mask_size(mid,3)) ) 736 737 nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), id_var_zs_mask(mid,av), & 738 netcdf_data, start = (/ 1 /), & 739 count = (/ mask_size(mid,3) /) ) 740 CALL handle_netcdf_error( 'netcdf', 538 ) 741 742 DEALLOCATE( netcdf_data ) 743 744 ENDIF 745 694 746 ! 695 747 !-- restore original parameter file_id (=formal parameter av) into av … … 982 1034 ! 983 1035 !-- In case of non-flat topography define 2d-arrays containing the height 984 !-- information s1036 !-- information 985 1037 IF ( TRIM( topography ) /= 'flat' ) THEN 986 1038 ! … … 1016 1068 ENDIF 1017 1069 1070 IF ( land_surface ) THEN 1071 ! 1072 !-- Define vertical coordinate grid (zs grid) 1073 nc_stat = NF90_DEF_DIM( id_set_3d(av), 'zs_3d', nzt_soil-nzb_soil+1, & 1074 id_dim_zs_3d(av) ) 1075 CALL handle_netcdf_error( 'netcdf', 70 ) 1076 1077 nc_stat = NF90_DEF_VAR( id_set_3d(av), 'zs_3d', NF90_DOUBLE, & 1078 id_dim_zs_3d(av), id_var_zs_3d(av) ) 1079 CALL handle_netcdf_error( 'netcdf', 71 ) 1080 1081 nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_zs_3d(av), 'units', & 1082 'meters' ) 1083 CALL handle_netcdf_error( 'netcdf', 72 ) 1084 1085 ENDIF 1018 1086 1019 1087 ! … … 1058 1126 grid_y = 'y' 1059 1127 grid_z = 'zw' 1128 ! 1129 !-- soil grid 1130 CASE ( 't_soil', 'm_soil' ) 1131 1132 grid_x = 'x' 1133 grid_y = 'y' 1134 grid_z = 'zs' 1060 1135 1061 1136 CASE DEFAULT … … 1085 1160 ELSEIF ( grid_z == 'zw' ) THEN 1086 1161 id_z = id_dim_zw_3d(av) 1162 ELSEIF ( grid_z == 'zs' ) THEN 1163 id_z = id_dim_zs_3d(av) 1087 1164 ENDIF 1088 1165 … … 1239 1316 1240 1317 ENDIF 1318 1319 IF ( land_surface ) THEN 1320 ! 1321 !-- Write zs grid 1322 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zs_3d(av), & 1323 - zs(nzb_soil:nzt_soil), start = (/ 1 /), & 1324 count = (/ nzt_soil-nzb_soil+1 /) ) 1325 CALL handle_netcdf_error( 'netcdf', 86 ) 1326 ENDIF 1327 1241 1328 ENDIF 1242 1329 … … 1496 1583 CALL handle_netcdf_error( 'netcdf', 107 ) 1497 1584 1585 1586 IF ( land_surface ) THEN 1587 1588 ns_do = 0 1589 DO WHILE ( section(ns_do+1,1) < nzs ) 1590 ns_do = ns_do + 1 1591 ENDDO 1592 ! 1593 !-- Define vertical coordinate grid (zs grid) 1594 nc_stat = NF90_DEF_DIM( id_set_xy(av), 'zs_xy', ns_do, id_dim_zs_xy(av) ) 1595 CALL handle_netcdf_error( 'netcdf', 539 ) 1596 1597 nc_stat = NF90_DEF_VAR( id_set_xy(av), 'zs_xy', NF90_DOUBLE, & 1598 id_dim_zs_xy(av), id_var_zs_xy(av) ) 1599 CALL handle_netcdf_error( 'netcdf', 540 ) 1600 1601 nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_zs_xy(av), 'units', & 1602 'meters' ) 1603 CALL handle_netcdf_error( 'netcdf', 541 ) 1604 1605 ENDIF 1606 1498 1607 ! 1499 1608 !-- Define a pseudo vertical coordinate grid for the surface variables … … 1577 1686 ! 1578 1687 !-- In case of non-flat topography define 2d-arrays containing the height 1579 !-- information s1688 !-- information 1580 1689 IF ( TRIM( topography ) /= 'flat' ) THEN 1581 1690 ! … … 1611 1720 ENDIF 1612 1721 1613 1614 1722 ! 1615 1723 !-- Define the variables … … 1671 1779 grid_y = 'y' 1672 1780 grid_z = 'zw' 1781 ! 1782 !-- soil grid 1783 CASE ( 't_soil_xy', 'm_soil_xy' ) 1784 grid_x = 'x' 1785 grid_y = 'y' 1786 grid_z = 'zs' 1673 1787 1674 1788 CASE DEFAULT … … 1698 1812 ELSEIF ( grid_z == 'zw' ) THEN 1699 1813 id_z = id_dim_zw_xy(av) 1814 ELSEIF ( grid_z == 'zs' ) THEN 1815 id_z = id_dim_zs_xy(av) 1700 1816 ENDIF 1701 1817 … … 1813 1929 1814 1930 ! 1931 !-- Write zs data 1932 IF ( land_surface ) THEN 1933 ns_do = 0 1934 DO i = 1, ns 1935 IF( section(i,1) == -1 ) THEN 1936 netcdf_data(i) = 1.0_wp ! section averaged along z 1937 ns_do = ns_do + 1 1938 ELSEIF ( section(i,1) < nzs ) THEN 1939 netcdf_data(i) = - zs( section(i,1) ) 1940 ns_do = ns_do + 1 1941 ENDIF 1942 ENDDO 1943 1944 nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zs_xy(av), & 1945 netcdf_data(1:ns_do), start = (/ 1 /), & 1946 count = (/ ns_do /) ) 1947 CALL handle_netcdf_error( 'netcdf', 124 ) 1948 1949 ENDIF 1950 1951 ! 1815 1952 !-- Write gridpoint number data 1816 1953 netcdf_data(1:ns) = section(1:ns,1) … … 1894 2031 1895 2032 ENDIF 2033 2034 2035 1896 2036 ENDIF 1897 2037 … … 2240 2380 2241 2381 ! 2242 !-- Define the t wo z-axes (zu and zw)2382 !-- Define the three z-axes (zu, zw, and zs) 2243 2383 nc_stat = NF90_DEF_DIM( id_set_xz(av), 'zu', nz+2, id_dim_zu_xz(av) ) 2244 2384 CALL handle_netcdf_error( 'netcdf', 153 ) … … 2263 2403 CALL handle_netcdf_error( 'netcdf', 158 ) 2264 2404 2405 IF ( land_surface ) THEN 2406 2407 nc_stat = NF90_DEF_DIM( id_set_xz(av), 'zs', nzs, id_dim_zs_xz(av) ) 2408 CALL handle_netcdf_error( 'netcdf', 542 ) 2409 2410 nc_stat = NF90_DEF_VAR( id_set_xz(av), 'zs', NF90_DOUBLE, & 2411 id_dim_zs_xz(av), id_var_zs_xz(av) ) 2412 CALL handle_netcdf_error( 'netcdf', 543 ) 2413 2414 nc_stat = NF90_PUT_ATT( id_set_xz(av), id_var_zs_xz(av), 'units', & 2415 'meters' ) 2416 CALL handle_netcdf_error( 'netcdf', 544 ) 2417 2418 ENDIF 2265 2419 2266 2420 ! … … 2308 2462 grid_y = 'y' 2309 2463 grid_z = 'zw' 2464 2465 ! 2466 !-- soil grid 2467 CASE ( 't_soil_xz', 'm_soil_xz' ) 2468 2469 grid_x = 'x' 2470 grid_y = 'y' 2471 grid_z = 'zs' 2310 2472 2311 2473 CASE DEFAULT … … 2335 2497 ELSEIF ( grid_z == 'zw' ) THEN 2336 2498 id_z = id_dim_zw_xz(av) 2499 ELSEIF ( grid_z == 'zs' ) THEN 2500 id_z = id_dim_zs_xz(av) 2337 2501 ENDIF 2338 2502 … … 2514 2678 count = (/ nz+2 /) ) 2515 2679 CALL handle_netcdf_error( 'netcdf', 167 ) 2680 2681 ! 2682 !-- Write zs data 2683 IF ( land_surface ) THEN 2684 netcdf_data(0:nzs-1) = - zs(nzb_soil:nzt_soil) 2685 nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_zs_xz(av), & 2686 netcdf_data(0:nzs), start = (/ 1 /), & 2687 count = (/ nzt_soil-nzb_soil+1 /) ) 2688 CALL handle_netcdf_error( 'netcdf', 548 ) 2689 ENDIF 2690 2516 2691 2517 2692 DEALLOCATE( netcdf_data ) … … 2903 3078 CALL handle_netcdf_error( 'netcdf', 197 ) 2904 3079 3080 IF ( land_surface ) THEN 3081 3082 nc_stat = NF90_DEF_DIM( id_set_yz(av), 'zs', nzs, id_dim_zs_yz(av) ) 3083 CALL handle_netcdf_error( 'netcdf', 545 ) 3084 3085 nc_stat = NF90_DEF_VAR( id_set_yz(av), 'zs', NF90_DOUBLE, & 3086 id_dim_zs_yz(av), id_var_zs_yz(av) ) 3087 CALL handle_netcdf_error( 'netcdf', 546 ) 3088 3089 nc_stat = NF90_PUT_ATT( id_set_yz(av), id_var_zs_yz(av), 'units', & 3090 'meters' ) 3091 CALL handle_netcdf_error( 'netcdf', 547 ) 3092 3093 ENDIF 3094 2905 3095 2906 3096 ! … … 2948 3138 grid_y = 'y' 2949 3139 grid_z = 'zw' 3140 ! 3141 !-- soil grid 3142 CASE ( 't_soil_yz', 'm_soil_yz' ) 3143 3144 grid_x = 'x' 3145 grid_y = 'y' 3146 grid_z = 'zs' 2950 3147 2951 3148 CASE DEFAULT … … 2975 3172 ELSEIF ( grid_z == 'zw' ) THEN 2976 3173 id_z = id_dim_zw_yz(av) 3174 ELSEIF ( grid_z == 'zs' ) THEN 3175 id_z = id_dim_zs_yz(av) 2977 3176 ENDIF 2978 3177
Note: See TracChangeset
for help on using the changeset viewer.