V3FIT
wout_converter.f
Go to the documentation of this file.
1 !*******************************************************************************
6 !*******************************************************************************
7 !-------------------------------------------------------------------------------
11 !-------------------------------------------------------------------------------
13  USE read_wout_mod
14  USE v3_utilities
15 
16  IMPLICIT NONE
17 
18 ! local variables
19  CHARACTER (len=100) :: filename
20  INTEGER :: num_cl_args
21  INTEGER :: i, status
22 
23 ! Start of executable code
24  num_cl_args = iargc()
25 
26  IF (num_cl_args .lt. 1) THEN
27  CALL err_fatal('Expected wout filename for argument.')
28  END IF
29 
30  CALL getarg(1, filename)
31 
32  CALL read_wout_file(filename, status)
33  CALL assert_eq(0, status, 'Failed to load wout file ' // filename)
34 
35  IF (filename(1:5) .eq. 'wout_') THEN
36  filename = trim(filename(6:len_trim(filename)))
37  END IF
38 
39  i = index(filename, '.nc', back=.true.)
40 
41  IF (i .gt. 0) THEN
42  filename = filename(1:i - 1)
43  END IF
44 
45  CALL write_wout_text(filename, status)
46  CALL assert_eq(0, status, 'Failed to write wout file')
47 
48  END PROGRAM
49 
50 
wout_converter
program wout_converter
wout_converter main program.
Definition: wout_converter.f:12
v3_utilities::assert_eq
Definition: v3_utilities.f:62