Commit cf19267d authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Added function cdo_read_timestepmask().

parent 7a7d7280
......@@ -12,6 +12,7 @@ libcdo_la_SOURCES = \
cdo_task.c \
cdo_task.h \
cdo_history.c \
cdo_read.c \
cdi_uuid.h \
cmortable_parser.c \
after_sptrans.c \
......
......@@ -105,29 +105,30 @@ am__dirstamp = $(am__leading_dot)dirstamp
am_libcdo_la_OBJECTS = libcdo_la-array.lo libcdo_la-cdo_pthread.lo \
libcdo_la-cdo_vlist.lo libcdo_la-cdo_getopt.lo \
libcdo_la-cdo_task.lo libcdo_la-cdo_history.lo \
libcdo_la-cmortable_parser.lo libcdo_la-after_sptrans.lo \
libcdo_la-after_fctrans.lo libcdo_la-after_dvtrans.lo \
libcdo_la-after_vertint.lo libcdo_la-after_namelist.lo \
libcdo_la-afterburnerlib.lo libcdo_la-constants.lo \
libcdo_la-color.lo libcdo_la-commandline.lo \
libcdo_la-convert_units.lo libcdo_la-datetime.lo \
libcdo_la-ecacore.lo libcdo_la-ecautil.lo \
libcdo_la-exception.lo libcdo_la-expr.lo libcdo_la-expr_fun.lo \
libcdo_la-expr_lex.lo libcdo_la-expr_yacc.lo \
libcdo_la-features.lo libcdo_la-field.lo libcdo_la-field2.lo \
libcdo_la-fieldc.lo libcdo_la-fieldmem.lo \
libcdo_la-fieldmer.lo libcdo_la-fieldzon.lo \
libcdo_la-gradsdeslib.lo libcdo_la-grid.lo \
libcdo_la-grid_area.lo libcdo_la-grid_define.lo \
libcdo_la-grid_gme.lo libcdo_la-grid_lcc.lo \
libcdo_la-grid_rot.lo libcdo_la-grid_from_name.lo \
libcdo_la-grid_read.lo libcdo_la-grid_read_pingo.lo \
libcdo_la-grid_print.lo libcdo_la-gridreference.lo \
libcdo_la-griddes.lo libcdo_la-griddes_h5.lo \
libcdo_la-griddes_nc.lo libcdo_la-hetaeta.lo \
libcdo_la-institution.lo libcdo_la-interpol.lo \
libcdo_la-job.lo libcdo_la-juldate.lo libcdo_la-grid_search.lo \
libcdo_la-listarray.lo libcdo_la-list.lo libcdo_la-listbuf.lo \
libcdo_la-cdo_read.lo libcdo_la-cmortable_parser.lo \
libcdo_la-after_sptrans.lo libcdo_la-after_fctrans.lo \
libcdo_la-after_dvtrans.lo libcdo_la-after_vertint.lo \
libcdo_la-after_namelist.lo libcdo_la-afterburnerlib.lo \
libcdo_la-constants.lo libcdo_la-color.lo \
libcdo_la-commandline.lo libcdo_la-convert_units.lo \
libcdo_la-datetime.lo libcdo_la-ecacore.lo \
libcdo_la-ecautil.lo libcdo_la-exception.lo libcdo_la-expr.lo \
libcdo_la-expr_fun.lo libcdo_la-expr_lex.lo \
libcdo_la-expr_yacc.lo libcdo_la-features.lo \
libcdo_la-field.lo libcdo_la-field2.lo libcdo_la-fieldc.lo \
libcdo_la-fieldmem.lo libcdo_la-fieldmer.lo \
libcdo_la-fieldzon.lo libcdo_la-gradsdeslib.lo \
libcdo_la-grid.lo libcdo_la-grid_area.lo \
libcdo_la-grid_define.lo libcdo_la-grid_gme.lo \
libcdo_la-grid_lcc.lo libcdo_la-grid_rot.lo \
libcdo_la-grid_from_name.lo libcdo_la-grid_read.lo \
libcdo_la-grid_read_pingo.lo libcdo_la-grid_print.lo \
libcdo_la-gridreference.lo libcdo_la-griddes.lo \
libcdo_la-griddes_h5.lo libcdo_la-griddes_nc.lo \
libcdo_la-hetaeta.lo libcdo_la-institution.lo \
libcdo_la-interpol.lo libcdo_la-job.lo libcdo_la-juldate.lo \
libcdo_la-grid_search.lo libcdo_la-listarray.lo \
libcdo_la-list.lo libcdo_la-listbuf.lo \
libcdo_la-merge_sort2.lo libcdo_la-modules.lo \
libcdo_la-namelist.lo libcdo_la-namelist_parser.lo \
libcdo_la-normal.lo libcdo_la-nth_element.lo \
......@@ -510,26 +511,27 @@ top_srcdir = @top_srcdir@
noinst_LTLIBRARIES = libcdo.la
libcdo_la_SOURCES = array.h array.c cdo_int.h compare.h cdo_pthread.c \
cdo_vlist.c cdo_getopt.c cdo_getopt.h cdo_task.c cdo_task.h \
cdo_history.c cdi_uuid.h cmortable_parser.c after_sptrans.c \
after_fctrans.c after_dvtrans.c after_vertint.c \
after_vertint.h after_namelist.c afterburnerlib.c \
afterburner.h vct_l191.h calendar.h constants.h constants.c \
color.c color.h commandline.c const.h convert_units.c \
convert_units.h counter.h datetime.c datetime.h dmemory.h \
ecacore.c ecacore.h ecautil.c ecautil.h error.h etopo.h temp.h \
mask.h exception.c expr.c expr.h expr_fun.c expr_fun.h \
expr_lex.c expr_yacc.c expr_yacc.h features.c field.c field.h \
field2.c fieldc.c fieldmem.c fieldmer.c fieldzon.c functs.h \
gradsdeslib.c gradsdeslib.h grid.c grid.h grid_area.c \
grid_define.c grid_gme.c grid_lcc.c grid_rot.c \
grid_from_name.c grid_read.c grid_read_pingo.c grid_print.c \
gridreference.c griddes.c griddes.h griddes_h5.c griddes_nc.c \
hetaeta.c hetaeta.h institution.c interpol.c interpol.h job.c \
juldate.c grid_search.c grid_search.h listarray.c listarray.h \
list.c list.h listbuf.c listbuf.h merge_sort2.c merge_sort2.h \
modules.c modules.h namelist.c namelist.h namelist_parser.c \
normal.c nth_element.c nth_element.h operator_help.h par_io.c \
par_io.h parse_literal.c percentiles_hist.c percentiles_hist.h \
cdo_history.c cdo_read.c cdi_uuid.h cmortable_parser.c \
after_sptrans.c after_fctrans.c after_dvtrans.c \
after_vertint.c after_vertint.h after_namelist.c \
afterburnerlib.c afterburner.h vct_l191.h calendar.h \
constants.h constants.c color.c color.h commandline.c const.h \
convert_units.c convert_units.h counter.h datetime.c \
datetime.h dmemory.h ecacore.c ecacore.h ecautil.c ecautil.h \
error.h etopo.h temp.h mask.h exception.c expr.c expr.h \
expr_fun.c expr_fun.h expr_lex.c expr_yacc.c expr_yacc.h \
features.c field.c field.h field2.c fieldc.c fieldmem.c \
fieldmer.c fieldzon.c functs.h gradsdeslib.c gradsdeslib.h \
grid.c grid.h grid_area.c grid_define.c grid_gme.c grid_lcc.c \
grid_rot.c grid_from_name.c grid_read.c grid_read_pingo.c \
grid_print.c gridreference.c griddes.c griddes.h griddes_h5.c \
griddes_nc.c hetaeta.c hetaeta.h institution.c interpol.c \
interpol.h job.c juldate.c grid_search.c grid_search.h \
listarray.c listarray.h list.c list.h listbuf.c listbuf.h \
merge_sort2.c merge_sort2.h modules.c modules.h namelist.c \
namelist.h namelist_parser.c normal.c nth_element.c \
nth_element.h operator_help.h par_io.c par_io.h \
parse_literal.c percentiles_hist.c percentiles_hist.h \
percentiles.c percentiles.h pipe.c pipe.h pmlist.c pmlist.h \
sellist.c sellist.h pragma_omp_atomic_update.h printinfo.h \
process.c process.h pstream.c pstream.h pstream_write.h \
......@@ -1020,6 +1022,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-cdo_getopt.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-cdo_history.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-cdo_pthread.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-cdo_read.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-cdo_task.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-cdo_vlist.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcdo_la-cmortable_parser.Plo@am__quote@
......@@ -1186,6 +1189,13 @@ libcdo_la-cdo_history.lo: cdo_history.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdo_la-cdo_history.lo `test -f 'cdo_history.c' || echo '$(srcdir)/'`cdo_history.c
 
libcdo_la-cdo_read.lo: cdo_read.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdo_la-cdo_read.lo -MD -MP -MF $(DEPDIR)/libcdo_la-cdo_read.Tpo -c -o libcdo_la-cdo_read.lo `test -f 'cdo_read.c' || echo '$(srcdir)/'`cdo_read.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcdo_la-cdo_read.Tpo $(DEPDIR)/libcdo_la-cdo_read.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cdo_read.c' object='libcdo_la-cdo_read.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libcdo_la-cdo_read.lo `test -f 'cdo_read.c' || echo '$(srcdir)/'`cdo_read.c
libcdo_la-cmortable_parser.lo: cmortable_parser.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcdo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libcdo_la-cmortable_parser.lo -MD -MP -MF $(DEPDIR)/libcdo_la-cmortable_parser.Tpo -c -o libcdo_la-cmortable_parser.lo `test -f 'cmortable_parser.c' || echo '$(srcdir)/'`cmortable_parser.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcdo_la-cmortable_parser.Tpo $(DEPDIR)/libcdo_la-cmortable_parser.Plo
......
......@@ -29,6 +29,8 @@
double datestr_to_double(const char *datestr, int opt);
bool *cdo_read_timestepmask(const char *maskfile, int *n);
static
void write_const_vars(int streamID2, int vlistID2, int nvars, double **vardata2)
{
......@@ -124,9 +126,21 @@ void *Select(void *argument)
SELLIST_ADD_WORD(enddate, "End date");
SELLIST_ADD_WORD(season, "Season");
SELLIST_ADD_WORD(date, "Date");
SELLIST_ADD_WORD(timestepmask, "Timestep mask");
if ( cdoVerbose ) sellist_print(sellist);
if ( SELLIST_NVAL(timestepmask) )
{
if ( SELLIST_NVAL(timestep) ) cdoAbort("Parameter timestep and timestepmask can't be combined!");
SELLIST_GET_VAL(timestepmask, 0, &timestepmask);
printf("mask: %s\n", timestepmask);
int n = 0;
bool *imask = cdo_read_timestepmask(timestepmask, &n);
for ( int i = 0; i < n; ++i ) printf("%d %d\n", i+1, imask[i]);
Free(imask);
}
sellist_verify(sellist);
int streamCnt = cdoStreamCnt();
......
......@@ -66,13 +66,12 @@ int get_tunits(const char *unit, int *incperiod, int *incunit, int *tunit)
static
void shifttime(int calendar, int tunit, int ijulinc, int *pdate, int *ptime)
{
int year, month, day;
int vdate = *pdate;
int vtime = *ptime;
juldate_t juldate;
if ( tunit == TUNIT_MONTH || tunit == TUNIT_YEAR )
{
int year, month, day;
cdiDecodeDate(vdate, &year, &month, &day);
month += ijulinc;
......@@ -86,6 +85,7 @@ void shifttime(int calendar, int tunit, int ijulinc, int *pdate, int *ptime)
}
else
{
juldate_t juldate;
juldate = juldate_encode(calendar, vdate, vtime);
juldate = juldate_add_seconds(ijulinc, juldate);
juldate_decode(calendar, juldate, &vdate, &vtime);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment