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

lfi2cdf: new option: "-s or --split" to split the variables in different files

         WARNING: not yet implemented! (the option is just recognized)
parent 40b96f8a
No related branches found
No related tags found
No related merge requests found
subroutine LFI2CDFMAIN(hinfile,iiflen,ooutname,houtfile,ioflen,hvarlist,ivlen,olfi2cdf,olfilist,ohdf5,omerge,nb_levels,& subroutine LFI2CDFMAIN(hinfile,iiflen,ooutname,houtfile,ioflen,hvarlist,ivlen,olfi2cdf,olfilist,ohdf5,omerge,nb_levels,&
oreduceprecision,ocompress,compress_level) oreduceprecision,osplit,ocompress,compress_level)
USE mode_util USE mode_util
IMPLICIT NONE IMPLICIT NONE
INTEGER :: iiflen, ioflen, ivlen INTEGER :: iiflen, ioflen, ivlen
...@@ -7,7 +7,7 @@ subroutine LFI2CDFMAIN(hinfile,iiflen,ooutname,houtfile,ioflen,hvarlist,ivlen,o ...@@ -7,7 +7,7 @@ subroutine LFI2CDFMAIN(hinfile,iiflen,ooutname,houtfile,ioflen,hvarlist,ivlen,o
CHARACTER(LEN=iiflen) :: hinfile CHARACTER(LEN=iiflen) :: hinfile
CHARACTER(LEN=ioflen) :: houtfile CHARACTER(LEN=ioflen) :: houtfile
CHARACTER(LEN=ivlen) :: hvarlist CHARACTER(LEN=ivlen) :: hvarlist
LOGICAL :: ooutname, olfi2cdf, olfilist, ohdf5, omerge, oreduceprecision, ocompress LOGICAL :: ooutname, olfi2cdf, olfilist, ohdf5, omerge, oreduceprecision, osplit, ocompress
INTEGER :: compress_level INTEGER :: compress_level
INTEGER :: ibuflen INTEGER :: ibuflen
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#define BUFSIZE 4096 #define BUFSIZE 4096
extern lfi2cdfmain_(char*, int*, int *, char*, int*, char*, int*, int*, int*, int*, int*, int*, int*, int*, int*); extern lfi2cdfmain_(char*, int*, int *, char*, int*, char*, int*, int*, int*, int*, int*, int*, int*, int*, int*, int*);
char *cleancomma(char *varlist) char *cleancomma(char *varlist)
{ {
...@@ -34,6 +34,7 @@ int main(int argc, char **argv) ...@@ -34,6 +34,7 @@ int main(int argc, char **argv)
int reduceprecision_flag; int reduceprecision_flag;
int outname_flag; int outname_flag;
int compress_flag, compress_level; int compress_flag, compress_level;
int split_flag;
char *cmd, *infile; char *cmd, *infile;
int c; int c;
char buff[BUFSIZE]; char buff[BUFSIZE];
...@@ -72,11 +73,12 @@ int main(int argc, char **argv) ...@@ -72,11 +73,12 @@ int main(int argc, char **argv)
{"merge", required_argument, 0, 'm' }, {"merge", required_argument, 0, 'm' },
{"output", required_argument, 0, 'o' }, {"output", required_argument, 0, 'o' },
{"reduce-precision", no_argument, 0, 'r' }, {"reduce-precision", no_argument, 0, 'r' },
{"split", no_argument, 0, 's' },
{"var", required_argument, 0, 'v' }, {"var", required_argument, 0, 'v' },
{0, 0, 0, 0 } {0, 0, 0, 0 }
}; };
c = getopt_long(argc, argv, "4c:lm:o:rv:", c = getopt_long(argc, argv, "4c:lm:o:rsv:",
long_options, &option_index); long_options, &option_index);
if (c == -1) if (c == -1)
break; break;
...@@ -114,6 +116,9 @@ int main(int argc, char **argv) ...@@ -114,6 +116,9 @@ int main(int argc, char **argv)
case 'r': case 'r':
reduceprecision_flag = 1; reduceprecision_flag = 1;
break; break;
case 's':
split_flag = 1;
break;
case 'v': case 'v':
if (l2c_flag) { if (l2c_flag) {
lenopt = strlen(optarg); lenopt = strlen(optarg);
...@@ -135,7 +140,7 @@ int main(int argc, char **argv) ...@@ -135,7 +140,7 @@ int main(int argc, char **argv)
} }
if (optind == argc) { if (optind == argc) {
printf("usage : lfi2cdf [--cdf4 -4] [-l] [-v --var var1[,...]] [-r --reduce-precision] [-m --merge number_of_z_levels] [-o --output output-file.nc] [-c --compress compression_level] input-file.lfi\n"); printf("usage : lfi2cdf [--cdf4 -4] [-l] [-v --var var1[,...]] [-r --reduce-precision] [-m --merge number_of_z_levels] [-s --split] [-o --output output-file.nc] [-c --compress compression_level] input-file.lfi\n");
printf(" cdf2lfi [-o --output output-file.lfi] input-file.nc\n"); printf(" cdf2lfi [-o --output output-file.lfi] input-file.nc\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
...@@ -178,8 +183,15 @@ int main(int argc, char **argv) ...@@ -178,8 +183,15 @@ int main(int argc, char **argv)
infile, ilen, outfile, olen, varlist, varlistlen); infile, ilen, outfile, olen, varlist, varlistlen);
*/ */
/* Split flag only supported if -v is set */
if (varlistlen==0) {
split_flag = 0;
printf("Warning: split option is forced to disable.\n");
}
lfi2cdfmain_(infile, &ilen, &outname_flag, outfile, &olen, varlist, &varlistlen, &l2c_flag, &list_flag, &hdf5_flag, &merge_flag, lfi2cdfmain_(infile, &ilen, &outname_flag, outfile, &olen, varlist, &varlistlen, &l2c_flag, &list_flag, &hdf5_flag, &merge_flag,
&nb_levels, &reduceprecision_flag, &compress_flag, &compress_level); &nb_levels, &reduceprecision_flag, &split_flag, &compress_flag, &compress_level);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
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