Skip to content
Snippets Groups Projects
Commit 64f9032a authored by WAUTELET Philippe's avatar WAUTELET Philippe
Browse files

Philippe 31/05/2018: lfi2cdf: add runmode option + use script in bin_tools/

parent 9ba94c99
No related branches found
No related tags found
No related merge requests found
bin_tools/cdf2cdf
bin_tools/cdf2lfi
bin_tools/lfi2cdf
conf/profile_mesonh
conf/profile_mesonh-*
exe/*
......
......@@ -8,12 +8,12 @@ module mode_options
implicit none
integer,parameter :: nbavailoptions = 8
integer,parameter :: nbavailoptions = 9
integer,parameter :: MODEUNDEF = -11, MODECDF2CDF = 11, MODELFI2CDF = 12, MODECDF2LFI = 13
integer,parameter :: OPTCOMPRESS = 1, OPTHELP = 2, OPTLIST = 3
integer,parameter :: OPTMERGE = 4, OPTOUTPUT = 5, OPTREDUCE = 6
integer,parameter :: OPTSPLIT = 7, OPTVAR = 8
integer,parameter :: OPTSPLIT = 7, OPTVAR = 8, OPTMODE = 9
type option
logical :: set = .false.
......@@ -58,8 +58,6 @@ subroutine read_commandline(options,hinfile,houtfile,runmode)
runmode = MODELFI2CDF
case default
runmode = MODEUNDEF
print *,'Error: program started with unknown command: ',command
call help()
end select
deallocate(command,fullcommand)
......@@ -146,6 +144,11 @@ subroutine init_options(options)
options(OPTVAR)%has_argument = .true.
options(OPTVAR)%type = TYPECHAR
options(OPTMODE)%long_name = "runmode"
options(OPTMODE)%short_name = 'R'
options(OPTMODE)%has_argument = .true.
options(OPTMODE)%type = TYPECHAR
end subroutine init_options
subroutine get_option(options,finished)
......@@ -228,7 +231,7 @@ subroutine check_options(options,infile,runmode)
type(option),dimension(:),intent(inout) :: options
character(len=:),allocatable,intent(in) :: infile
integer,intent(in) :: runmode
integer,intent(inout) :: runmode
integer :: idx1, idx2
......@@ -237,6 +240,26 @@ subroutine check_options(options,infile,runmode)
call help()
end if
!Check runmode
if (options(OPTMODE)%set) then
select case (options(OPTMODE)%cvalue)
case ('cdf2cdf')
runmode = MODECDF2CDF
case ('lfi2cdf')
runmode = MODELFI2CDF
case ('cdf2lfi')
runmode = MODECDF2LFI
case default
print *,'Error: invalid runmode option'
call help()
end select
else
if(runmode==MODEUNDEF) then
print *,'Error: program started with unknown command'
call help()
end if
end if
!Check compression level
if (options(OPTCOMPRESS)%set) then
if (options(OPTCOMPRESS)%ivalue < 1 .OR. options(OPTCOMPRESS)%ivalue > 9 ) then
......@@ -302,11 +325,13 @@ subroutine help()
!TODO: -l option for cdf2cdf and cdf2lfi
print *,"Usage : lfi2cdf [-h --help] [-l] [-v --var var1[,...]] [-r --reduce-precision]"
print *," [-m --merge number_of_z_levels] [-s --split] [-o --output output-file.nc]"
print *," [-R --runmode mode]"
print *," [-c --compress compression_level] input-file.lfi"
print *," cdf2cdf [-h --help] [-v --var var1[,...]] [-r --reduce-precision]"
print *," [-m --merge number_of_split_files] [-s --split] [-o --output output-file.nc]"
print *," [-R --runmode mode]"
print *," [-c --compress compression_level] input-file.nc"
print *," cdf2lfi [-o --output output-file.lfi] input-file.nc"
print *," cdf2lfi [-o --output output-file.lfi] [-R --runmode mode] input-file.nc"
print *,""
print *,"Options:"
print *," --compress, -c compression_level"
......@@ -322,6 +347,8 @@ subroutine help()
print *," Name of file for the output"
print *," --reduce-precision, -r"
print *," Reduce the precision of the floating point variables to single precision (cdf2cdf and lfi2cdf only)"
print *," --runmode, -R"
print *," Force runmode (lfi2cdf, cdf2cdf or cdf2lfi)"
print *," --split, -s"
print *," Split variables specified with the -v option (one per file) (cdf2cdf and lfi2cdf only)"
print *," --var, -v var1[,...]"
......
#!/bin/bash
${SRC_MESONH}/exe/LFI2CDF${XYZ} --runmode cdf2cdf $*
#!/bin/bash
${SRC_MESONH}/exe/LFI2CDF${XYZ} --runmode cdf2lfi $*
#!/bin/bash
${SRC_MESONH}/exe/LFI2CDF${XYZ} --runmode lfi2cdf $*
......@@ -385,7 +385,7 @@ ifdef PROG_LIST
prog : lib $(LIB_GRIBEX)
@$(MAKE) -I$(B)$(OBJDIR) DEP=YES $(PROG_LIST)
install : $(patsubst %,%-${ARCH_XYZ},$(PROG_LIST)) install_tools
install : $(patsubst %,%-${ARCH_XYZ},$(PROG_LIST))
$(PROG_LIST) : OBJ_PROG=$(shell find $(PROG_DIR) -follow -type f -name "spll_*.f*" \
......@@ -405,13 +405,6 @@ else
endif
rm -f $(SRC_MESONH)/exe/$(*F)_${ARCH_XYZ}~
install_tools :
ifdef MNH_TOOLS
ln -sf $(OBJDIR)/LFI2CDF $(SRC_MESONH)/bin_tools/lfi2cdf
ln -sf $(OBJDIR)/LFI2CDF $(SRC_MESONH)/bin_tools/cdf2cdf
ln -sf $(OBJDIR)/LFI2CDF $(SRC_MESONH)/bin_tools/cdf2lfi
endif
##########################################################
# #
# EXAMPLES RULES #
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment