Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated meteo_proc mds #80

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion oneflux_steps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ SW_IN_POT_OBJ := $(SW_IN_POT_SRC:.c=.o)
SW_IN_POT_BIN := $(join ${TGTDIR}, sw_in_pot)

METEO_PROC_DIR := $(join ${SRCDIR}, meteo_proc/src/)
METEO_PROC_SRC := dataset.c main.c
METEO_PROC_SRC := dataset.c main.c defs.c mds_vars.c
METEO_PROC_OBJ := $(METEO_PROC_SRC:.c=.o)
METEO_PROC_BIN := $(join ${TGTDIR}, meteo_proc)

Expand Down
48 changes: 46 additions & 2 deletions oneflux_steps/common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ static const char filter[] = "*.*";
static const char dd_field_delimiter[] = ",\r\n";
static const char *dds[DETAILS_SIZE] = { "site", "year", "lat", "lon", "timezone", "htower", "timeres", "sc_negl", "notes" };
static const char *timeress[TIMERES_SIZE] = { "spot", "quaterhourly", "halfhourly", "hourly", "daily", "monthly" };
static const char variadic[] = "variadic";

/* error strings */
static const char err_unable_open_path[] = "unable to open path: %s\n\n";
Expand All @@ -64,6 +65,7 @@ static const char err_path_too_big[] = "specified path \"%s\" is too big.\n\n";
static const char err_filename_too_big[] = "filename \"%s\" is too big.\n\n";
static const char err_empty_argument[] = "empty argument\n";
static const char err_unknown_argument[] = "unknown argument: \"%s\"\n\n";
static const char err_too_long_arg[] = "too long argument\n";
static const char err_gf_too_less_values[] = "too few valid values to apply gapfilling\n";
static const char err_wildcards_with_no_extension_used[] = "wildcards with no extension used\n";

Expand Down Expand Up @@ -815,8 +817,50 @@ int parse_arguments(int argc, char *argv[], const ARGUMENT *const args, const in

/* */
if ( !ok ) {
printf(err_unknown_argument, argv[1]+1);
return 0;
for ( i = 0; i < arg_count; i++ ) {
if ( !string_compare_i(args[i].name, variadic) ) {
#define ARG_MAX_LEN 31

char arg[ARG_MAX_LEN+1] = { 0 };
int n = (int)strlen(argv[1]);

param = strrchr(argv[1], '=');
if ( param ) {
n = param - argv[1];
++param;
}
--n; /* we keep '-' in case of no param or '=' out */

if ( n > ARG_MAX_LEN ) {
printf(err_too_long_arg);
return 0;
}
strncpy(arg, argv[1]+1, n);

/* check if function is present */
assert(args[i].f);

/* call function */
ok = args[i].f(arg, param, args[i].p);
if ( ! ok ) {
return 0;
}

/* in this way we can alert about unknown argument */
if ( -1 == ok ) {
i = arg_count;
}

break;

#undef ARG_MAX_LEN
}
}

if ( i == arg_count ) {
printf(err_unknown_argument, argv[1]+1);
return 0;
}
}

/* */
Expand Down
1 change: 1 addition & 0 deletions oneflux_steps/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#endif

/* includes */
#include <stdio.h>
#include <math.h>

/* defines stolen to http://www.gnu.org/software/libtool/manual/autoconf/Function-Portability.html */
Expand Down
12 changes: 10 additions & 2 deletions oneflux_steps/meteo_proc/meteo_proc.vcproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="meteo_proc"
ProjectGUID="{F9FBC974-D3DE-4913-8A1D-2D8C8B20C0E9}"
RootNamespace="meteo_proc"
Expand All @@ -25,7 +25,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_swc_hh.txt $(ProjectDir)src info_swc_hh&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_swc_dd_ww_mm_yy.txt $(ProjectDir)src info_swc_dd_ww_mm_yy&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_ts_hh.txt $(ProjectDir)src info_ts_hh&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_ts_dd_ww_mm_yy.txt $(ProjectDir)src info_ts_dd_ww_mm_yy&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_hh.txt $(ProjectDir)src info_hh&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_dd.txt $(ProjectDir)src info_dd&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_ww.txt $(ProjectDir)src info_ww&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_mm.txt $(ProjectDir)src info_mm&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_yy.txt $(ProjectDir)src info_yy&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_nights_days_dd.txt $(ProjectDir)src info_nights_days_dd&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_nights_days_ww_mm.txt $(ProjectDir)src info_nights_days_ww_mm"
CommandLine="$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_swc_hh.txt $(ProjectDir)src info_swc_hh&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_swc_dd_ww_mm_yy.txt $(ProjectDir)src info_swc_dd_ww_mm_yy&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_ts_hh.txt $(ProjectDir)src info_ts_hh&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_ts_dd_ww_mm_yy.txt $(ProjectDir)src info_ts_dd_ww_mm_yy&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_hh.txt $(ProjectDir)src info_hh&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_dd.txt $(ProjectDir)src info_dd&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_ww.txt $(ProjectDir)src info_ww&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_mm.txt $(ProjectDir)src info_mm&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_yy.txt $(ProjectDir)src info_yy&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_nights_days_dd.txt $(ProjectDir)src info_nights_days_dd&#x0D;&#x0A;$(SolutionDir)..\releases\tools\txt2h\txt2h.exe $(ProjectDir)info\info_nights_days_ww_mm.txt $(ProjectDir)src info_nights_days_ww_mm&#x0D;&#x0A;"
/>
<Tool
Name="VCCustomBuildTool"
Expand Down Expand Up @@ -181,10 +181,18 @@
RelativePath=".\src\dataset.c"
>
</File>
<File
RelativePath=".\src\defs.c"
>
</File>
<File
RelativePath=".\src\main.c"
>
</File>
<File
RelativePath=".\src\mds_vars.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Expand Down
Loading