This is an automated email from the git hooks/post-receive script. sebastic pushed a commit to branch master in repository ncview.
commit 720a8b6e93f7cadca95c8e09135ab96e99001ac9 Author: Bas Couwenberg <sebas...@xs4all.nl> Date: Sat Oct 31 10:15:57 2015 +0100 Imported Upstream version 2.1.6+ds --- src/calcalcs.c | 12 ++++++++---- src/calcalcs.h | 4 ++-- src/file_netcdf.c | 19 ++++++++++++++++--- src/ncview.c | 5 +++++ src/ncview.defines.h | 5 +++-- src/udu.c | 5 +++++ src/utCalendar2_cal.c | 36 ++++++++++++++++++++++++++++-------- src/view.c | 4 ++++ 8 files changed, 71 insertions(+), 19 deletions(-) diff --git a/src/calcalcs.c b/src/calcalcs.c index 763ddd7..a18efd2 100644 --- a/src/calcalcs.c +++ b/src/calcalcs.c @@ -1,10 +1,14 @@ /* The CalCalcs routines, a set of C-language routines to perform - calendar calculations. + calendar calculations with an emphasis on calendars used by + global climate models, including "noleap", "365_day", "360_day", + "proleptic_gregorian", and "standard" calendars. Support is + also provided for what I call "year 0" calendars, which is to + say calendars that have a valid year 0, unlike the real calendar. - Version 1.0, released 7 January 2010 + Version 1.2, released 8 June 2014 - Copyright (C) 2010 David W. Pierce, dpie...@ucsd.edu + Copyright (C) 2010-2014, David W. Pierce, dpie...@ucsd.edu This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -321,7 +325,7 @@ calcalcs_cal *ccs_init_calendar( const char *calname ) else { fprintf( stderr, "Error, ccs_init_calendar called with unknown calendar name: %s\n", calname ); - exit(-1); + return( NULL ); } return( retval ); diff --git a/src/calcalcs.h b/src/calcalcs.h index b93068c..b7e42b3 100644 --- a/src/calcalcs.h +++ b/src/calcalcs.h @@ -2,9 +2,9 @@ The CalCalcs routines, a set of C-language routines to perform calendar calculations. - Version 1.0, released 7 January 2010 + Version 1.2, released 16 June 2014 - Copyright (C) 2010 David W. Pierce, dpie...@ucsd.edu + Copyright (C) 2010-2014 David W. Pierce, dpie...@ucsd.edu This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/file_netcdf.c b/src/file_netcdf.c index edc8ef5..a3752a8 100644 --- a/src/file_netcdf.c +++ b/src/file_netcdf.c @@ -1554,6 +1554,7 @@ void netcdf_fill_value( int file_id, char *var_name, float *v, NetCDFOptions *au { int err, varid, foundit, gid; char var_name_ng[MAX_NC_NAME]; + nc_type vartype; if( options.debug ) fprintf( stderr, "Checking %s for a missing value...\n", @@ -1619,10 +1620,22 @@ void netcdf_fill_value( int file_id, char *var_name, float *v, NetCDFOptions *au return; } - /* default behavior, if no specified "_FillValue" attribute */ - *v = FILL_FLOAT; + /* default behavior, if no specified "_FillValue" attribute. + * Thanks to Heiko Klein <heiko.kl...@met.no> for the suggestion & code. + */ + if ( nc_inq_vartype( file_id, varid, &vartype) == NC_NOERR ) { + switch (vartype) { + case NC_BYTE: *v = (float) NC_FILL_BYTE; break; + case NC_SHORT: *v = (float) NC_FILL_SHORT; break; + case NC_INT: *v = (float) NC_FILL_INT; break; + case NC_FLOAT: *v = NC_FILL_FLOAT; break; + case NC_DOUBLE: *v = (float) NC_FILL_DOUBLE; break; + default: *v = NC_FILL_FLOAT; + } + } + if( options.debug ) - fprintf( stderr, "setting fillvalue to default=%g\n", + fprintf( stderr, "setting fillvalue to default for var type=%g\n", *v ); } diff --git a/src/ncview.c b/src/ncview.c index ec00f12..4c6900f 100644 --- a/src/ncview.c +++ b/src/ncview.c @@ -218,6 +218,9 @@ parse_options( int argc, char *argv[] ) else if( strncmp( argv[i], "-beep", 5 ) == 0 ) options.beep_on_restart = TRUE; + else if( strncmp( argv[i], "-pause_on_restart", 17 ) == 0 ) + options.stop_on_restart = TRUE; + else if( strncmp( argv[i], "-fra", 4 ) == 0 ) options.dump_frames = TRUE; @@ -370,6 +373,7 @@ initialize_misc() options.show_sel = FALSE; options.want_extra_info = FALSE; options.beep_on_restart = FALSE; + options.stop_on_restart = FALSE; options.small = FALSE; options.blowup_type = DEFAULT_BLOWUP_TYPE; options.save_frames = DEFAULT_SAVEFRAMES; @@ -789,6 +793,7 @@ fprintf( stderr, " -calendar: Specify time calendar to use, overriding value in fprintf( stderr, " -private: Use a private colormap.\n" ); fprintf( stderr, " -debug: Print lots of debugging info.\n" ); fprintf( stderr, " -beep: Ring the bell when the movie restarts at frame zero.\n" ); +fprintf( stderr, " -pause_on_restart: Pause playback when the movie restarts at frame zero.\n" ); fprintf( stderr, " -extra: Put some extra information on the display window.\n" ); fprintf( stderr, " -mtitle: My title to use on the display window.\n" ); fprintf( stderr, " -noautoflip: Do not automatically flip image, even\n" ); diff --git a/src/ncview.defines.h b/src/ncview.defines.h index 2773d38..749a8ae 100644 --- a/src/ncview.defines.h +++ b/src/ncview.defines.h @@ -31,8 +31,8 @@ #include <udunits2.h> #endif -#define PROGRAM_ID "Ncview 2.1.5 David W. Pierce 18 Mar 2015" -#define PROGRAM_VERSION_STRING "2.1.5" +#define PROGRAM_ID "Ncview 2.1.6 David W. Pierce 29 Oct 2015" +#define PROGRAM_VERSION_STRING "2.1.6" #define APP_RES_VERSION 1.93 #ifndef TRUE @@ -516,6 +516,7 @@ typedef struct { listsel_max, /* if # of vars is more than this, auto switch from VARSEL_LIST to VARSEL_MENU */ color_by_ndims, /* if 1, then button is color coded by # of effective dims */ beep_on_restart, + stop_on_restart, auto_overlay, /* if 1, then tries to figure out if coastlines should automatically be added */ blowup, maxsize_pct, /* -1 if a width/height pair specified instead */ diff --git a/src/udu.c b/src/udu.c index 4411321..ffd6a89 100644 --- a/src/udu.c +++ b/src/udu.c @@ -241,6 +241,11 @@ void udu_fmt_time( char *temp_string, size_t temp_string_len, double new_dimval, fprintf( stderr, "units: >%s<\n", dim->units ); exit( -1 ); } + + if( debug ) { + fprintf( stderr, "udu_fmt_time: dimval=%lf units=%s calendar=%s utCalendar2_cal returns: year=%d month=%d day=%d hour=%d minute=%d second=%lf\n", + new_dimval, dim->units, dim->calendar, year, month, day, hour, minute, second ); + } if( include_granularity ) { switch( dim->tgran ) { diff --git a/src/utCalendar2_cal.c b/src/utCalendar2_cal.c index 5427369..4ccbb4b 100644 --- a/src/utCalendar2_cal.c +++ b/src/utCalendar2_cal.c @@ -3,9 +3,9 @@ The CalCalcs routines, a set of C-language routines to perform calendar calculations. - Version 1.0, released 7 January 2010 + Version 1.2, released 8 June 2014 - Copyright (C) 2010 David W. Pierce, dpie...@ucsd.edu + Copyright (C) 2010-2014 David W. Pierce, dpie...@ucsd.edu This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* #define DEBUG */ +/* #define DEBUG */ #include <stdio.h> #include <unistd.h> @@ -50,7 +50,7 @@ static ut_unit *udu_ref_date; in seconds, so, for example, 1.e-3 means round up to 1 second if the value is 0.999 seconds or greater, and 1.e-6 means round up to 1 second if the value is 0.999999 seconds or greater. */ -static double sec_rounding_value = 1.e-8; +static double sec_rounding_value = 1.e-6; /* Internal to this file only */ static void initialize( const char *ut_read_xml_arg ); @@ -273,11 +273,11 @@ fuckyou = (char *)ccs_err_str((int)ierr); *second = tot_extra_seconds; /* Handle the rouding issues */ -#ifdef DEBUG - fprintf( stderr, "utCalendar2_cal: handling rounding issues\n" ); -#endif iorig = *second; /* Integer conversion */ iround = *second + sec_rounding_value; +#ifdef DEBUG + fprintf( stderr, "utCalendar2_cal: handling rounding issues; orig second=%lf orig+rounding value:%lf\n", *second, *second + sec_rounding_value ); +#endif if( iround > iorig ) { #ifdef DEBUG printf( "rounding alg invoked, orig date: %04d-%02d-%02d %02d:%02d:%.20lf\n", *year, *month, *day, *hour, *minute, *second ); @@ -612,6 +612,26 @@ static void initialize( const char *ut_read_xml_arg ) } /*======================================================================================== + * We already have routine ccs_date2doy, so why do we need this one? It can be convenient + * to supply this functionality to Fortran, which does not have the ability to easily + * initialize or use calendars, and only identify them by a character-string name. So, + * provide an interface that gives the ccs_date2doy functionality given only a character + * string calendar name. + */ +int ccs_date2doy_calname( char *calendar_name, int year, int month, int day, int *doy ) +{ + calcalcs_cal *cal2use; + + cal2use = getcal( calendar_name ); + if( cal2use == NULL ) { + unknown_cal_emit_warning( calendar_name ); + cal2use = getcal( "Standard" ); + } + + return( ccs_date2doy( cal2use, year, month, day, doy )); +} + +/*======================================================================================== * Returns NULL if the passed calendar name is both not found and not creatable */ static calcalcs_cal *getcal( const char *name ) @@ -691,7 +711,7 @@ static int inferred_origin_year( const char *s ) /* printf( "loc that string 'since' starts: %d\n", loc_since_start ); */ ifnbss = loc_since_start + 5; /* ifnbss = "i first non blank since since" */ - while( (ifnbss < sl) && isblank( *(s+ifnbss) ) && (*(s+ifnbss) != '\0')) + while( isblank( *(s+ifnbss) ) && (*(s+ifnbss) != '\0') && (ifnbss < sl)) ifnbss++; /* printf( "i first non blank since since:%d\n", ifnbss ); */ diff --git a/src/view.c b/src/view.c index f3633d6..db784d4 100644 --- a/src/view.c +++ b/src/view.c @@ -486,6 +486,10 @@ change_view( int delta, int interpretation ) place = 0L; if( options.beep_on_restart ) beep(); + if( options.stop_on_restart ) { + do_pause( MOD_1 ); + return(0); + } } /* Have we decremented below the minimum allowed value? */ -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/ncview.git _______________________________________________ Pkg-grass-devel mailing list Pkg-grass-devel@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel