23 LOGICAL :: metfile_exists
25 INTEGER :: num_optional_vars, num_vars
26 INTEGER,
PARAMETER :: deflate_level = 2
27 CHARACTER(LEN=512) :: met_filepath, netcdf4_filepath
28 CHARACTER,
DIMENSION(:),
ALLOCATABLE :: vars_list
30 INTEGER :: metdata_format = unknown_metdata
36 print *,
'Usage: grib2netcdf4 <inpath> <outpath> [optional varnames]'
39 CALL getarg(1, met_filepath)
41 CALL getarg(2, netcdf4_filepath)
51 num_optional_vars = iargc() - 2
56 num_vars = num_optional_vars + 3
57 ALLOCATE( vars_list(num_vars) )
64 DO i=1,num_optional_vars
65 CALL getarg( i+2, vars_list(i+3) )
72 print *,
'The variables list has an invalid variable...'
73 print *,
'Valid variables: '
77 print *,
'Your vars_list:'
89 INQUIRE( file=met_filepath, exist=metfile_exists )
90 IF ( metfile_exists )
THEN
92 wfname(1) = met_filepath
94 print *,
'Unable to find metfile: ', trim(met_filepath)
100 IF (metdata_format == ecmwf_metdata)
THEN
101 print *, (
"ECMWF met data detected...")
102 ELSEIF (metdata_format == gfs_metdata)
THEN
103 print *, (
"NCEP met data detected...")
105 print *, (
"Unknown met data detected...")
115 memtime(i) = 999999999
128 print *,
'Calling processmetfields()...'
131 print *,
'Calling fp2nc4io_dump()...'
132 call
fp2nc4io_dump( netcdf4_filepath, num_vars, vars_list, deflate_level)
134 print *,
'End of grib2nc4'
logical function fp2nc4io_vars_are_valid(num_vars, dump_vars)
subroutine fp2nc4io_print_valid_vars
subroutine fp2nc4io_dump(nc4_filepath, num_vars, dump_vars, deflate_level)
subroutine gridcheck_ecmwf
subroutine processmetfields(ind, metdata_format)