Changeset 951 for palm/trunk/SOURCE/netcdf.f90
- Timestamp:
- Jul 19, 2012 2:22:52 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/netcdf.f90
r772 r951 7 7 ! Current revisions: 8 8 ! ------------------ 9 ! cross_profiles, profile_rows, profile_columns are written to NetCDF header 9 10 ! 10 11 ! Former revisions: … … 113 114 CHARACTER (LEN=10) :: netcdf_var_name, precision, var 114 115 CHARACTER (LEN=80) :: time_average_text 115 CHARACTER (LEN=2000) :: var_list, var_list_old 116 117 INTEGER :: av, file_id, i, id_x, id_y, id_z, j, ns, ns_old, nz_old 116 CHARACTER (LEN=2000) :: char_cross_profiles, var_list, & 117 var_list_old 118 119 CHARACTER (LEN=100), DIMENSION(1:crmax) :: cross_profiles_adj, & 120 cross_profiles_char 121 122 INTEGER :: av, cross_profiles_count, cross_profiles_maxi, delim, & 123 delim_old, file_id, i, id_last, id_x, id_y, id_z, j, & 124 k, ns, ns_old, nz_old 118 125 119 126 INTEGER, DIMENSION(1) :: id_dim_time_old, id_dim_x_yz_old, & … … 122 129 id_dim_zu_mask_old 123 130 124 LOGICAL :: found 131 INTEGER, DIMENSION(1:crmax) :: cross_profiles_numb 132 133 LOGICAL :: cross_profiles_log, found 125 134 126 135 LOGICAL, INTENT (INOUT) :: extend … … 132 141 REAL, DIMENSION(:), ALLOCATABLE :: netcdf_data 133 142 REAL, DIMENSION(:,:), ALLOCATABLE :: netcdf_data_2d 134 135 136 143 137 144 ! … … 3132 3139 3133 3140 ! 3141 !-- Write columns and rows of cross_profiles to netcdf header. 3142 !-- This information can be used by palmplot. 3143 3144 nc_stat = NF90_PUT_ATT( id_set_pr, NF90_GLOBAL, & 3145 'no_rows', & 3146 profile_rows ) 3147 CALL handle_netcdf_error( 'netcdf', 519 ) 3148 3149 nc_stat = NF90_PUT_ATT( id_set_pr, NF90_GLOBAL, & 3150 'no_columns', & 3151 profile_columns ) 3152 CALL handle_netcdf_error( 'netcdf', 520 ) 3153 3154 3155 cross_profiles_adj = ADJUSTL( cross_profiles ) 3156 cross_profiles_numb = 999999 3157 3158 k = 1 3159 3160 ! 3161 !-- Each profile defined in cross_profiles is written to a array 3162 !-- (cross_profiles_char). The number of its cross is assigned in a 3163 !-- second array (cross_profiles_numb). 3164 3165 DO i = 1, crmax 3166 IF ( TRIM( cross_profiles_adj(i) ) == ' ' ) EXIT 3167 delim_old = 0 3168 DO j = 1, 100 3169 delim = INDEX( cross_profiles_adj(i)(delim_old+1:), ' ' ) 3170 IF (delim .EQ. 1) EXIT 3171 cross_profiles_char(k) = cross_profiles_adj(i)(delim_old+1: & 3172 delim_old+delim-1) 3173 cross_profiles_numb(k) = i 3174 k = k+1 3175 cross_profiles_maxi = i 3176 delim_old = delim_old + delim 3177 ENDDO 3178 ENDDO 3179 3180 cross_profiles_count = k-1 3181 3182 ! 3183 !-- Check if all profiles defined in cross_profiles are defined in 3184 !-- data_output_pr. If not, they will be skipped. 3185 3186 cross_profiles_log = .FALSE. 3187 message_string = ' ' 3188 3189 DO i = 1, cross_profiles_count 3190 DO j = 1, dopr_n 3191 IF ( TRIM(cross_profiles_char(i)) == TRIM(data_output_pr(j)) ) & 3192 EXIT 3193 IF ( j == dopr_n) THEN 3194 cross_profiles_numb(i) = 999999 3195 cross_profiles_log = .TRUE. 3196 message_string = TRIM(message_string) // ', ' // & 3197 TRIM(cross_profiles_char(i)) 3198 ENDIF 3199 ENDDO 3200 ENDDO 3201 3202 IF (cross_profiles_log) THEN 3203 message_string = TRIM(message_string(2:)) // ' is/are not' // & 3204 ' defined in data_output_pr.' 3205 CALL message( 'define_netcdf_header', 'PA0352', 0, 0, 0, 6, 0 ) 3206 ENDIF 3207 3208 ! 3209 !-- Check if all profiles defined in data_output_pr are defined in 3210 !-- cross_profiles. If not, they will be added to cross_profiles. 3211 3212 cross_profiles_log = .FALSE. 3213 message_string = ' ' 3214 3215 DO i = 1, dopr_n 3216 DO j = 1, cross_profiles_count 3217 IF ( TRIM( cross_profiles_char(j) ) == TRIM( data_output_pr(i)) )& 3218 EXIT 3219 IF ( j == cross_profiles_count ) THEN 3220 cross_profiles_count = cross_profiles_count + 1 3221 cross_profiles_maxi = cross_profiles_maxi + 1 3222 cross_profiles_char( cross_profiles_count ) = & 3223 TRIM( data_output_pr(i) ) 3224 cross_profiles_numb(cross_profiles_count) = cross_profiles_maxi 3225 cross_profiles_log = .TRUE. 3226 message_string = TRIM( message_string ) // ', ' // & 3227 TRIM( data_output_pr(i) ) 3228 ENDIF 3229 ENDDO 3230 ENDDO 3231 3232 IF ( cross_profiles_log ) THEN 3233 message_string = TRIM(message_string(2:)) // ' has/have been' // & 3234 ' added to cross_profiles.' 3235 CALL message( 'define_netcdf_header', 'PA0353', 0, 0, 0, 6, 0 ) 3236 ENDIF 3237 3238 ! 3239 !-- Writing cross_profiles to netcdf header. This information can be 3240 !-- used by palmplot. Each profile is separated by ",", each cross is 3241 !-- separated by ";". 3242 3243 char_cross_profiles = ';' 3244 id_last = 1 3245 3246 DO i = 1, cross_profiles_count 3247 IF ( cross_profiles_numb(i) /= 999999 ) THEN 3248 IF ( TRIM( char_cross_profiles ) == ';' ) THEN 3249 char_cross_profiles = TRIM( char_cross_profiles ) // & 3250 TRIM( cross_profiles_char(i) ) 3251 ELSEIF ( id_last == cross_profiles_numb(i) ) THEN 3252 char_cross_profiles = TRIM( char_cross_profiles ) // & 3253 ',' // TRIM( cross_profiles_char(i) ) 3254 ELSE 3255 char_cross_profiles = TRIM( char_cross_profiles ) // & 3256 ';' // TRIM( cross_profiles_char(i) ) 3257 ENDIF 3258 id_last = cross_profiles_numb(i) 3259 ENDIF 3260 ENDDO 3261 3262 char_cross_profiles = TRIM( char_cross_profiles ) // ';' 3263 3264 nc_stat = NF90_PUT_ATT( id_set_pr, NF90_GLOBAL, 'cross_profiles', & 3265 TRIM( char_cross_profiles ) ) 3266 CALL handle_netcdf_error( 'netcdf', 521 ) 3267 3268 ! 3134 3269 !-- Define time coordinate for profiles (unlimited dimension) 3135 3270 nc_stat = NF90_DEF_DIM( id_set_pr, 'time', NF90_UNLIMITED, & … … 3403 3538 TRIM( time_average_text ) ) 3404 3539 CALL handle_netcdf_error( 'netcdf', 248 ) 3540 3405 3541 nc_stat = NF90_ENDDEF( id_set_pr ) 3406 3542 CALL handle_netcdf_error( 'netcdf', 438 )
Note: See TracChangeset
for help on using the changeset viewer.