Changeset 4123 for palm/trunk/UTIL


Ignore:
Timestamp:
Jul 26, 2019 1:45:03 PM (5 years ago)
Author:
gronemeier
Message:

bugfix: do not assue that output arrays start with index 0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/UTIL/binary_to_netcdf.f90

    r4107 r4123  
    781781   INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  data_count_per_dimension  !< data count of variable per dimension
    782782   INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  bounds_start              !< lower bounds of variable
    783    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  bounds_end                !< upper bounds of variable
    784783   INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  bounds_origin             !< lower bounds of dimensions in output file
    785784
     
    866865
    867866            ALLOCATE( bounds_start(1:n_dim) )
    868             ALLOCATE( bounds_end(1:n_dim) )
    869867            ALLOCATE( bounds_origin(1:n_dim) )
    870868            ALLOCATE( start_positions(1:n_dim) )
     
    872870
    873871            READ( bin_file_unit ) ( bounds_start(i), i = 1, n_dim )
    874             READ( bin_file_unit ) ( bounds_end(i), i = 1, n_dim )
     872            READ( bin_file_unit ) ( data_count_per_dimension(i), i = 1, n_dim )
    875873            READ( bin_file_unit ) ( bounds_origin(i), i = 1, n_dim )
    876874
     
    878876            CALL internal_message( 'debug', routine_name // &
    879877                                   ': bounds_start = ' // TRIM( temp_string ) )
    880             WRITE( temp_string, * ) bounds_end
     878            WRITE( temp_string, * ) data_count_per_dimension
    881879            CALL internal_message( 'debug', routine_name // &
    882                                    ': bounds_end = ' // TRIM( temp_string ) )
     880                                   ': data_count_per_dimension = ' // TRIM( temp_string ) )
    883881            WRITE( temp_string, * ) bounds_origin
    884882            CALL internal_message( 'debug', routine_name // &
     
    888886
    889887            DO  i = 1, n_dim
    890                data_count = data_count * ( bounds_end(i) - bounds_start(i) + 1 )
     888               data_count = data_count * data_count_per_dimension(i)
    891889               start_positions(i) = bounds_start(i) - bounds_origin(i) + 1
    892                data_count_per_dimension(i) = bounds_end(i) - bounds_start(i) + 1
    893890            ENDDO
    894891
     
    981978            DEALLOCATE( data_count_per_dimension )
    982979            DEALLOCATE( bounds_start )
    983             DEALLOCATE( bounds_end )
    984980            DEALLOCATE( bounds_origin )
    985981
Note: See TracChangeset for help on using the changeset viewer.