write_esri_ascii_file Subroutine

public subroutine write_esri_ascii_file(filename_ascii_sub, ncols_sub, nrows_sub, cellsize_sub, val_array, x_array, y_array)

Arguments

Type IntentOptional Attributes Name
character(len=*) :: filename_ascii_sub
integer :: ncols_sub
integer :: nrows_sub
real :: cellsize_sub
real :: val_array(ncols_sub,nrows_sub)
real :: x_array(ncols_sub,nrows_sub)
real :: y_array(ncols_sub,nrows_sub)

Called by

proc~~write_esri_ascii_file~~CalledByGraph proc~write_esri_ascii_file write_esri_ascii_file proc~uemep_aggregate_proxy_emission_in_emep_grid uEMEP_aggregate_proxy_emission_in_EMEP_grid proc~uemep_aggregate_proxy_emission_in_emep_grid->proc~write_esri_ascii_file proc~uemep_save_netcdf_control uEMEP_save_netcdf_control proc~uemep_save_netcdf_control->proc~write_esri_ascii_file program~uemep uEMEP program~uemep->proc~uemep_save_netcdf_control

Source Code

    subroutine write_esri_ascii_file(filename_ascii_sub, ncols_sub, nrows_sub, cellsize_sub, val_array, x_array,y_array)
        character(*) :: filename_ascii_sub
        integer :: ncols_sub, nrows_sub
        real :: cellsize_sub
        real :: val_array(ncols_sub,nrows_sub)
        real :: x_array(ncols_sub,nrows_sub)
        real :: y_array(ncols_sub,nrows_sub)

        ! Local variables
        integer :: ii,jj
        real :: xllcorner
        real :: yllcorner
        real :: NODATA_value = -999.0
        integer :: unit_in = 20
        character(len=:), allocatable :: fmt

        xllcorner = x_array(1,1) - cellsize_sub/2.0
        yllcorner = y_array(1,1) - cellsize_sub/2.0
        open(unit_in, file=filename_ascii_sub, access='sequential', form='formatted', status='unknown')
        write(unit_in,*) 'ncols', ncols_sub
        write(unit_in,*) 'nrows', nrows_sub
        write(unit_in,*) 'xllcorner', xllcorner
        write(unit_in,*) 'yllcorner', yllcorner
        write(unit_in,*) 'cellsize', cellsize_sub
        write(unit_in,*) 'NODATA_value', NODATA_value

        do jj = nrows_sub, 1, -1
            write(fmt, '(A,I0,A)') '(', ncols_sub, 'es12.3)'
            write(unit_in,fmt) (val_array(ii,jj), ii = 1, ncols_sub)
        end do
        close(unit_in)
    end subroutine write_esri_ascii_file