Example #1
0
/*
 * HEADER:-1:code_table_4.230:inv:0:code table 4.230 chemical constituent type
 */
int f_code_table_4_230(ARG0) {
    int val;
    const char *string;
    static int error_count = 0;

    if (mode >= 0) {
        val = code_table_4_230(sec);
        if (val >= 0) {
            string = NULL;
	    if (GB2_MasterTable(sec) <= 4) {
		if (error_count++ <= 10) fprintf(stderr,
		    "Warning: if file made with ECMWF API, may be using incompatible chemistry table\n");
	    }
            switch(val) {
#include "CodeTable_4.230.dat"
            }
	    if (GB2_MasterTable(sec) <= 4 && GB2_Center(sec) == ECMWF) string = NULL;
	    
            if (string == NULL) sprintf(inv_out,"code table 4.230=%d", val);
            else sprintf(inv_out,"code table 4.230=%d %s", val, string);
        }
    }
    return 0;
}
Example #2
0
/*
 * HEADER:100:misc:inv:0:variable name qualifiers like chemical, ensemble, probability, etc
 */
int f_misc(ARG0) {

    const char *string;
    int need_space = 0;
    int pdt, val;
    static int error_count = 0;

    if (mode < 0) return 0;

    pdt = GB2_ProdDefTemplateNo(sec);
    inv_out += strlen(inv_out);

    f_ens(call_ARG0(inv_out,NULL) );
    if (strlen(inv_out)) {
	if (need_space) strcat(inv_out,":");
	need_space = 1;
    }
    inv_out += strlen(inv_out);

    f_prob(call_ARG0(inv_out,NULL));
    if (strlen(inv_out)) {
	if (need_space) strcat(inv_out,":");
	need_space = 1;
    }
    inv_out += strlen(inv_out);

    
    f_spatial_proc(call_ARG0(inv_out,NULL));
    if (strlen(inv_out)) {
	if (need_space) strcat(inv_out,":");
	need_space = 1;
    }
    inv_out += strlen(inv_out);

    f_wave_partition(call_ARG0(inv_out,NULL) );
    if (strlen(inv_out)) {
	if (need_space) strcat(inv_out,":");
	need_space = 1;
    }
    inv_out += strlen(inv_out);

    val = code_table_4_3(sec);
    if (val == 5) {
	if (need_space) strcat(inv_out,":");
	strcat(inv_out,"probability forecast");
    }
    else if (val == 6 || val == 7) {
	if (need_space) strcat(inv_out,":");
	strcat(inv_out,"analysis/forecast error");
	need_space = 1;
    }
    else if (val == 9) {
	if (need_space) strcat(inv_out,":");
	strcat(inv_out,"climatological");
	need_space = 1;
    }
    else if (GB2_Center(sec) == 7 && val == 192) {
	if (need_space) strcat(inv_out,":");
	strcat(inv_out,"Confidence Indicator");
	need_space = 1;
    }


    if (pdt == 7) {
	if (need_space) strcat(inv_out,":");
	strcat(inv_out,"analysis/forecast error");
	need_space = 1;
    }
    else if (pdt == 6 || pdt == 10) {
	if (need_space) strcat(inv_out,":");
        f_percent(call_ARG0(inv_out,NULL) );
	strcat(inv_out," level");
	need_space = 1;
   }

   if ( (val = code_table_4_230(sec)) != -1) {
	if (need_space) strcat(inv_out,":");
	strcat(inv_out,"chemical=");
        val = code_table_4_230(sec);
        if (val >= 0) {
            if (GB2_MasterTable(sec) <= 4) {
                if (error_count++ <= 10) {
		    if (GB2_Center(sec) == ECMWF) 
			fprintf(stderr, "Warning: possible incompatible chemistry table .. table turned off.\n");
		    else if (GB2_Center(sec) != NCEP)
			fprintf(stderr,
                    "Warning: if file made with ECMWF API, possible incompatible chemistry table\n");
		}
            }

            string = NULL;
            switch(val) {
#include "CodeTable_4.230.dat"
            }
            if (GB2_MasterTable(sec) <= 4 && GB2_Center(sec) == ECMWF) {
                string = NULL;
            }
            if (string != NULL)  strcat(inv_out,string);
            else {
		inv_out += strlen(inv_out);
		sprintf(inv_out,"chemical_%d",val);
	    }
	}
	need_space = 1;
    }

    if ( (val = code_table_4_233(sec)) != -1) {
	if (need_space) strcat(inv_out,":");
	strcat(inv_out,"aerosol=");
        val = code_table_4_233(sec);
        if (val >= 0) {
            string = NULL;
            switch(val) {
#include "CodeTable_4.233.dat"
            }
            if (string != NULL)  strcat(inv_out,string);
            else {
                inv_out += strlen(inv_out);
                sprintf(inv_out,"chemical_%d",val);
            }
        }
        need_space = 1;
    }

    if (pdt == 44) {
	if (need_space) strcat(inv_out,":");
	inv_out += strlen(inv_out);
        f_aerosol_size(call_ARG0(inv_out,NULL));
	need_space = 1;
    }
    if (pdt == 48) {
	if (need_space) strcat(inv_out,":");
	inv_out += strlen(inv_out);
        f_aerosol_size(call_ARG0(inv_out,NULL));
        strcat(inv_out,":");
	inv_out += strlen(inv_out);
        f_aerosol_wavelength(call_ARG0(inv_out,NULL));
	need_space = 1;
    }
    return 0;
}
Example #3
0
/*
 * HEADER:100:misc:inv:0:-ens -prob
 */
int f_misc(ARG0) {

    char *p, *string;
    char cbuffer[STRING_SIZE];
    int need_space = 0;
    int pdt, val;

    if (mode < 0) return 0;

    pdt = GB2_ProdDefTemplateNo(sec);
    inv_out += strlen(inv_out);
    p = inv_out;

    inv_out = cbuffer;
    inv_out[0] = 0;
    f_ens(CALL_ARG0);
    if (strlen(inv_out)) {
        if (need_space) strcat(p," ");
        strcat(p,inv_out);
        need_space = 1;
    }

    inv_out[0] = 0;
    f_prob(CALL_ARG0);
    if (strlen(inv_out)) {
        if (need_space) strcat(p," ");
        strcat(p,inv_out);
        need_space = 1;
    }

    inv_out[0] = 0;
    f_spatial_proc(CALL_ARG0);
    if (strlen(inv_out)) {
        if (need_space) strcat(p," ");
        strcat(p,inv_out);
        need_space = 1;
    }

    if (pdt == 7) {
        if (need_space) strcat(p," ");
        strcat(p,"analysis/forecast error");
        need_space = 1;
    }
    else if (pdt == 10) {
        if (need_space) strcat(p," ");
        strcat(p,"percent probability");
        need_space = 1;
    }
    else if (pdt == 40) {
        if (need_space) strcat(p," ");
        strcat(p,"chemical=");
        val = code_table_4_230(sec);
        if (val >= 0) {
            string = NULL;
            switch(val) {
#include "CodeTable_4.230.dat"
            }
            if (string != NULL)  strcat(p,string);
            else strcat(p,"??? see code 4.230");
        }
    }
    return 0;
}