Save the input file in the NetCDF file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | file_id |
NetCDF ID of the file to write to |
subroutine save_input(file_id)
#ifdef NETCDF
use file_utils, only: num_input_lines, get_input_unit
use neasyf, only: neasyf_write
#endif
implicit none
!> NetCDF ID of the file to write to
integer, intent(in) :: file_id
#ifdef NETCDF
integer, parameter :: line_length = 200
character(line_length), dimension(:), allocatable :: input_file_array
integer :: n, unit
allocate(input_file_array(max(1, num_input_lines)))
input_file_array(1) = ""
call get_input_unit(unit)
rewind (unit=unit)
do n = 1, num_input_lines
read (unit=unit, fmt="(a)") input_file_array(n)
end do
call neasyf_write(file_id, "input_file", input_file_array, &
long_name="Input file", dim_names=["char200", "nlines "])
#endif
end subroutine save_input