FV3 Bundle
ncdc_cli_process.F90
Go to the documentation of this file.
4 
5  implicit none
6 
7  contains
8  subroutine ncdc_usage(err)
9  character(len=*), intent(in), optional :: err
10 
11  if (present(err)) then
12  write(*, "(A)") " ** ERROR: " // err
13  end if
14 
15  call get_command_argument(0, prgm_name)
16  write (*, "(A)") " nc_diag_cat v1.0"
17  write (*, "(A)") " NetCDF Diag File Concatenator"
18  write (*, "(A)") " Usage: " // trim(prgm_name) // " -o OUTPUT_FILE FILES..."
19  write (*, "(A)") " Concatenate the NetCDF files listed in FILES into OUTPUT_FILE."
20  write (*, "(A)") " At least 2 input files must be specified in order for this tool"
21  write (*, "(A)") " to run. The resulting file will be compressed."
22  stop
23  end subroutine ncdc_usage
24 
25  subroutine nc_diag_cat_process_args
26  cli_arg_count = command_argument_count()
27 
28  if (cli_arg_count < 4) then
29  call ncdc_usage
30  end if
31 
32  ! Check for -o.
33  ! We enforce this so that people really know what they're putting
34  ! into this program!
35  call get_command_argument(1, dummy_arg)
36 
37  if (trim(dummy_arg) /= "-o") then
38  call ncdc_usage("Invalid option - '-o' must be specified in the 1st argument.")
39  end if
40 
41  ! Grab output file argument
42  call get_command_argument(2, output_file)
43 
44  if (len_trim(output_file) <= 0) then
45  call ncdc_usage("Invalid output file name.")
46  end if
47 
48  ! Grab first input file argument
49  call get_command_argument(3, input_file)
50 
51  if (len_trim(input_file) <= 0) then
52  call ncdc_usage("Invalid first input file name.")
53  end if
54 
55  ! Grab second input file argument
56  call get_command_argument(4, input_file)
57 
58  if (len_trim(input_file) <= 0) then
59  call ncdc_usage("Invalid second input file name.")
60  end if
61 
62  ! Sanity checks done!
63  end subroutine nc_diag_cat_process_args
64 end module ncdc_cli_process
character(len=10000000) output_file
Definition: ncdc_state.F90:11
subroutine nc_diag_cat_process_args
integer(i_long) cli_arg_count
Definition: ncdc_state.F90:12
character(len=10000000) prgm_name
Definition: ncdc_state.F90:11
subroutine ncdc_usage(err)
character(len=10000000) dummy_arg
Definition: ncdc_state.F90:11
character(len=10000000) input_file
Definition: ncdc_state.F90:11