if ( g is "CAVOK") {
    rename(g,cavokTrend1); 
    group g : dump; non_alpha na;
		constant isCavokTrend1=1;
		constant ceilingAndVisibilityOKTrend1="true";
} else {
		constant ceilingAndVisibilityOKTrend1="false";
		constant isCavokTrend1=0;
		if (g is "//" || g is "///" || g is "////" || g is "/////" || g is "//////") {
				rename(g,missingVisibilityField1Trend1);
				group g : dump; non_alpha na;
		} 
		if (g is "//" || g is "///" || g is "////" || g is "/////" || g is "//////") {
				rename(g,missingVisibilityField2Trend1);
				group g : dump; non_alpha na;
		} 
		if (substr(g,-3,3) is "NDV" || is_integer(g,0,4)  ) {
				rename(g,visibilityInMetresTrend1);
		    group g : dump; non_alpha na;
				visibilityTrend1=to_integer(visibilityInMetresTrend1,0,4);
		}
		if (g is "NDV") {
				rename(g,ndvTrend1);
				modify ndv : hidden;
		    group g : dump; non_alpha na;
		}
		if (substr(g,-2,2) is "KM"  ) {
				rename(g,visibilityInKMTrend1);
		    group g : dump; non_alpha na;
				visibilityInKilometresTrend1=to_integer(visibilityInKMTrend1,0,4);
				meta visibilityTrend1 evaluate(visibilityInKilometresTrend1 * 1000);
		}
		if (is_integer(g,0,1)) {
				rename(g,visibilityIntegerTrend1);
		    group g : dump; non_alpha na;
		} 
		if (substr(g, -2 ,2) is "SM" ) {
        rename(g,visibilityInStatuteMilesTrend1);
        group g : dump; non_alpha na;
		}
		if ( ( substr(g,4,1) is "N" || substr(g,4,1) is "S" || substr(g,4,1) is "E" || substr(g,4,1) is "W" 
				||
				substr(g,4,2) is "NE" || substr(g,4,2) is "SE" || substr(g,4,2) is "NW" || substr(g,4,2) is "SW" 
				||
				substr(g,4,1) is "/" )
				&&
				is_integer(g,0,4)
				) {
				rename(g,directionalVariationInVisibilityTrend1);
				group g : dump; non_alpha na;
				variationOfVisibilityTrend1=to_integer(directionalVariationInVisibilityTrend1);
				variationOfVisibilityDirectionTrend1=dict_search("metar/direction.table",1);
		}
} 
