12.12.1-3 baseline

Former-commit-id: c999505fba [formerly c999505fba [formerly 8481c91f9918a61631198331c324c4c5a76aac0f]]
Former-commit-id: b3b5e6d28f
Former-commit-id: 2797cbcdd0
This commit is contained in:
Steve Harris 2012-11-13 17:27:04 -06:00
parent 96a4a4f3f5
commit 314495dc8e
19 changed files with 648 additions and 291 deletions

View file

@ -308,6 +308,8 @@ public class AutoDailyQC {
} }
} }
num_period_qc=5;
//for the 6 hours periods
for (int l = 0; l < 5; l++) { for (int l = 0; l < 5; l++) {
if (DailyQcUtils.pdata[i].used[l] == 0) { if (DailyQcUtils.pdata[i].used[l] == 0) {
continue; continue;
@ -343,6 +345,79 @@ public class AutoDailyQC {
WriteQPFGrids wq = new WriteQPFGrids(); WriteQPFGrids wq = new WriteQPFGrids();
wq.write_qpf_grids(dbuf); wq.write_qpf_grids(dbuf);
/* output grid to file in grib format */
// create netCDF file from data, write it out then call
// nc2grib against it making a grib file, when done
// remove the unneeded netCDF file.
if (DailyQcUtils.mpe_dqc_save_grib == true) {
WriteDQCNetCDFGrids wng = new WriteDQCNetCDFGrids();
String ncfile = String.format("%s.nc", dbuf);
wng.write_dqc_netcdf_grids(ncfile, 0, 1, 1,
ga.getCommonGridAttributes(), datavals);
WriteDQCGribGrids wgg = new WriteDQCGribGrids();
String fname_grib = String.format("%s.grb", dbuf);
int status = wgg.write_dqc_grib_grids(ncfile,
fname_grib, 1);
File nfile = new File(ncfile);
nfile.delete();
nfile = null;
if (status != 0) {
System.out
.println(String
.format("\n problem with writing GRIB file in write_dqc_grib_grids. status=%d\n",
status));
}
}
int num;
if (l < 4) {
num = i * 4 + 3 - l;
} else {
num = i + 40;
}
/* create the MAP */
CreateMap cm = new CreateMap();
cm.create_map(num);
}
//for (int l = 0; l < 5; l++) {
for (int l = 0; l < num_period_qc; l++) {
if (DailyQcUtils.pdata[i].used[l] == 0) {
continue;
}
if (l < 2) {
otime.setTime(DailyQcUtils.pdata[i].data_time);
otime.add(Calendar.SECOND, -86400);
} else {
otime.setTime(DailyQcUtils.pdata[i].data_time);
}
int ll;
if (l < 4) {
ll = 0;
} else {
ll = 1;
}
RenderPcp rp = new RenderPcp();
rp.render_pcp(i, l, ll,
DailyQcUtils.precip_stations.size(),
DailyQcUtils.precip_stations,
DailyQcUtils.getHrap_grid(),
DailyQcUtils.pdata, DailyQcUtils.pcp_in_use);
/* output grid to file in Ascii format */
dbuf = String.format("%s%s_%04d%02d%02d",
DailyQcUtils.grid_file,
DailyQcUtils.timefile[2][l],
otime.get(Calendar.YEAR),
otime.get(Calendar.MONTH) + 1,
otime.get(Calendar.DAY_OF_MONTH));
WriteQPFGrids wq = new WriteQPFGrids();
wq.write_qpf_grids(dbuf);
/* output grid to file in NetCDF format */ /* output grid to file in NetCDF format */
if (DailyQcUtils.mpe_dqc_save_netcdf == true) { if (DailyQcUtils.mpe_dqc_save_netcdf == true) {
WriteDQCNetCDFGrids wng = new WriteDQCNetCDFGrids(); WriteDQCNetCDFGrids wng = new WriteDQCNetCDFGrids();
@ -351,42 +426,6 @@ public class AutoDailyQC {
ga.getCommonGridAttributes(), datavals); ga.getCommonGridAttributes(), datavals);
} }
/* output grid to file in grib format */
// create netCDF file from data, write it out then call
// nc2grib against it making a grib file, when done
// remove the unneeded netCDF file.
if (DailyQcUtils.mpe_dqc_save_grib == true) {
WriteDQCNetCDFGrids wng = new WriteDQCNetCDFGrids();
String ncfile = String.format("%s.nc", dbuf);
wng.write_dqc_netcdf_grids(ncfile, 0, 1, 1,
ga.getCommonGridAttributes(), datavals);
WriteDQCGribGrids wgg = new WriteDQCGribGrids();
String fname_grib = String.format("%s.grb", dbuf);
int status = wgg.write_dqc_grib_grids(ncfile,
fname_grib, 1);
File nfile = new File(ncfile);
nfile.delete();
nfile = null;
if (status != 0) {
System.out
.println(String
.format("\n problem with writing GRIB file in write_dqc_grib_grids. status=%d\n",
status));
}
}
int num;
if (l < 4) {
num = i * 4 + 3 - l;
} else {
num = i + 40;
}
/* create the MAP */
CreateMap cm = new CreateMap();
cm.create_map(num);
} }
} }

View file

@ -71,6 +71,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Apr 13, 2012 #14691 Qinglu lin Added code for two more fe_area: er and nr. * Apr 13, 2012 #14691 Qinglu lin Added code for two more fe_area: er and nr.
* May 4, 2012 #14887 Qinglu lin Changed 0.25 to 0.60 for DEFAULT_PORTION_TOLERANCE; * May 4, 2012 #14887 Qinglu lin Changed 0.25 to 0.60 for DEFAULT_PORTION_TOLERANCE;
* added code to pass a Envelope calculatePortion(). * added code to pass a Envelope calculatePortion().
* Nov 9, 2012 DR 15430 D. Friedman Extracted method converFeAreaToPartList.
* *
* </pre> * </pre>
* *
@ -229,67 +230,7 @@ public class Area {
.get(parentAreaField)); .get(parentAreaField));
String feArea = (String) regionFeature.attributes String feArea = (String) regionFeature.attributes
.get("FE_AREA"); .get("FE_AREA");
final List<String> partList = new ArrayList<String>(); area.partOfParentRegion = converFeAreaToPartList(feArea);
if (feArea == null) {
// Marine warnings
partList.add("");
} else {
if (feArea.equals("pa"))
partList.add("PA");
else if (feArea.equals("mi"))
partList.add("MI");
else if (feArea.equals("pd"))
partList.add("PD");
else if (feArea.equals("up"))
partList.add("UP");
else if (feArea.equals("bb"))
partList.add("BB");
else if (feArea.equals("er"))
partList.add("ER");
else if (feArea.equals("eu"))
partList.add("EU");
else if (feArea.equals("sr"))
partList.add("SR");
else if (feArea.equals("nr"))
partList.add("NR");
else if (feArea.equals("wu"))
partList.add("WU");
else if (feArea.equals("ds"))
partList.add("DS");
else if (feArea.equals("ne"))
partList.add("NE");
else if (feArea.equals("nw"))
partList.add("NW");
else if (feArea.equals("se"))
partList.add("SE");
else if (feArea.equals("sw"))
partList.add("SW");
else {
for (int i = 0; i < feArea.length(); i++) {
char c = feArea.charAt(i);
switch (c) {
case 'c':
partList.add("CENTRAL");
break;
case 'w':
partList.add("WEST");
break;
case 'n':
partList.add("NORTH");
break;
case 'e':
partList.add("EAST");
break;
case 's':
partList.add("SOUTH");
break;
default:
break;
}
}
}
}
area.partOfParentRegion = partList;
} }
// Search against point matches // Search against point matches
@ -390,5 +331,69 @@ public class Area {
} }
return retVal; return retVal;
} }
public static List<String> converFeAreaToPartList(String feArea) {
final List<String> partList = new ArrayList<String>();
if (feArea == null) {
// Marine warnings
partList.add("");
} else {
if (feArea.equals("pa"))
partList.add("PA");
else if (feArea.equals("mi"))
partList.add("MI");
else if (feArea.equals("pd"))
partList.add("PD");
else if (feArea.equals("up"))
partList.add("UP");
else if (feArea.equals("bb"))
partList.add("BB");
else if (feArea.equals("er"))
partList.add("ER");
else if (feArea.equals("eu"))
partList.add("EU");
else if (feArea.equals("sr"))
partList.add("SR");
else if (feArea.equals("nr"))
partList.add("NR");
else if (feArea.equals("wu"))
partList.add("WU");
else if (feArea.equals("ds"))
partList.add("DS");
else if (feArea.equals("ne"))
partList.add("NE");
else if (feArea.equals("nw"))
partList.add("NW");
else if (feArea.equals("se"))
partList.add("SE");
else if (feArea.equals("sw"))
partList.add("SW");
else {
for (int i = 0; i < feArea.length(); i++) {
char c = feArea.charAt(i);
switch (c) {
case 'c':
partList.add("CENTRAL");
break;
case 'w':
partList.add("WEST");
break;
case 'n':
partList.add("NORTH");
break;
case 'e':
partList.add("EAST");
break;
case 's':
partList.add("SOUTH");
break;
default:
break;
}
}
}
}
return partList;
}
} }

View file

@ -22,12 +22,10 @@ package com.raytheon.viz.warngen.template;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.io.StringWriter; import java.io.StringWriter;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -35,9 +33,11 @@ import java.util.Hashtable;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.TreeMap;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -45,14 +45,12 @@ import javax.measure.converter.UnitConverter;
import javax.measure.unit.NonSI; import javax.measure.unit.NonSI;
import javax.measure.unit.SI; import javax.measure.unit.SI;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
import org.apache.velocity.Template; import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext; import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity; import org.apache.velocity.app.Velocity;
import org.apache.velocity.app.VelocityEngine; import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.tools.generic.ListTool; import org.apache.velocity.tools.generic.ListTool;
import org.geotools.referencing.GeodeticCalculator;
import com.raytheon.uf.common.activetable.ActiveTableMode; import com.raytheon.uf.common.activetable.ActiveTableMode;
import com.raytheon.uf.common.activetable.ActiveTableRecord; import com.raytheon.uf.common.activetable.ActiveTableRecord;
@ -60,11 +58,11 @@ import com.raytheon.uf.common.activetable.GetActiveTableRequest;
import com.raytheon.uf.common.activetable.GetActiveTableResponse; import com.raytheon.uf.common.activetable.GetActiveTableResponse;
import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord; import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord;
import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction; import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction;
import com.raytheon.uf.common.dataplugin.warning.config.AreaSourceConfiguration;
import com.raytheon.uf.common.dataplugin.warning.config.AreaSourceConfiguration.AreaType;
import com.raytheon.uf.common.dataplugin.warning.config.WarngenConfiguration; import com.raytheon.uf.common.dataplugin.warning.config.WarngenConfiguration;
import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialData;
import com.raytheon.uf.common.dataplugin.warning.util.GeometryUtil; import com.raytheon.uf.common.dataplugin.warning.util.GeometryUtil;
import com.raytheon.uf.common.geospatial.ISpatialQuery.SearchMode;
import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
import com.raytheon.uf.common.geospatial.SpatialQueryResult;
import com.raytheon.uf.common.site.SiteMap; import com.raytheon.uf.common.site.SiteMap;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
@ -75,7 +73,6 @@ import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.edex.core.EdexException; import com.raytheon.uf.edex.core.EdexException;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.maps.rsc.DbMapQueryFactory;
import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.awipstools.ToolsDataManager; import com.raytheon.viz.awipstools.ToolsDataManager;
import com.raytheon.viz.awipstools.common.StormTrackData; import com.raytheon.viz.awipstools.common.StormTrackData;
@ -101,11 +98,11 @@ import com.raytheon.viz.warngen.util.FollowUpUtil;
import com.raytheon.viz.warngen.util.WarnGenMathTool; import com.raytheon.viz.warngen.util.WarnGenMathTool;
import com.raytheon.viz.warngen.util.WatchUtil; import com.raytheon.viz.warngen.util.WatchUtil;
import com.raytheon.viz.warngen.util.WeatherAdvisoryWatch; import com.raytheon.viz.warngen.util.WeatherAdvisoryWatch;
import com.raytheon.viz.warngen.util.WeatherAdvisoryWatch.Portion;
import com.raytheon.viz.warnings.DateUtil; import com.raytheon.viz.warnings.DateUtil;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.Polygon; import com.vividsolutions.jts.geom.Polygon;
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
import com.vividsolutions.jts.io.WKTReader; import com.vividsolutions.jts.io.WKTReader;
/** /**
@ -129,6 +126,7 @@ import com.vividsolutions.jts.io.WKTReader;
* Aug 29, 2011 15351 jsanchez Set the timezone for TML time. * Aug 29, 2011 15351 jsanchez Set the timezone for TML time.
* Sep 10, 2012 15295 snaples Added property setting for runtime log to createScript. * Sep 10, 2012 15295 snaples Added property setting for runtime log to createScript.
* Sep 18, 2012 15332 jsanchez Used a new warning text handler. * Sep 18, 2012 15332 jsanchez Used a new warning text handler.
* Nov 9, 1202 DR 15430 D. Friedman Improve watch inclusion.
* </pre> * </pre>
* *
* @author njensen * @author njensen
@ -742,7 +740,7 @@ public class TemplateRunner {
try { try {
t0 = System.currentTimeMillis(); t0 = System.currentTimeMillis();
WatchUtil watches = getWatches(warngenLayer, config, warnPolygon, WatchUtil watches = getWatches(warngenLayer, config, warnPolygon,
fourLetterSiteId); fourLetterSiteId, simulatedTime);
System.out.println("getWatches time: " System.out.println("getWatches time: "
+ (System.currentTimeMillis() - t0)); + (System.currentTimeMillis() - t0));
if (watches != null) { if (watches != null) {
@ -837,12 +835,13 @@ public class TemplateRunner {
* ([template_name_site.xml]) * ([template_name_site.xml])
* @param polygon * @param polygon
* The Geometry surrounded by the warning polygon. * The Geometry surrounded by the warning polygon.
* @param simulatedTime
* @return * @return
* @throws Exception * @throws Exception
*/ */
private static WatchUtil getWatches(WarngenLayer warngenLayer, private static WatchUtil getWatches(WarngenLayer warngenLayer,
WarngenConfiguration config, Geometry polygon, WarngenConfiguration config, Geometry polygon,
String fourLetterSiteId) throws Exception { String fourLetterSiteId, Date simulatedTime) throws Exception {
Validate.isTrue(config.getHatchedAreaSource() Validate.isTrue(config.getHatchedAreaSource()
.getIncludedWatchAreaBuffer() >= 0, .getIncludedWatchAreaBuffer() >= 0,
"IncludedWatchAreaBuffer can not be negative"); "IncludedWatchAreaBuffer can not be negative");
@ -877,8 +876,27 @@ public class TemplateRunner {
GetActiveTableResponse resp = (GetActiveTableResponse) ThriftClient GetActiveTableResponse resp = (GetActiveTableResponse) ThriftClient
.sendRequest(req); .sendRequest(req);
long t1 = System.currentTimeMillis(); long t1 = System.currentTimeMillis();
java.util.List<ActiveTableRecord> activeTable = resp java.util.List<ActiveTableRecord> respList = resp.getActiveTable();
.getActiveTable(); ArrayList<ActiveTableRecord> activeTable = new ArrayList<ActiveTableRecord>(
respList.size());
// Filter out entries representing non-active events.
for (ActiveTableRecord ar : respList) {
if ("CAN".equals(ar.getAct()) || "EXP".equals(ar.getAct()))
continue;
if (ar.getEndTime() == null) {
statusHandler.handle(Priority.ERROR, String.format(
"Watch %s has null end time; not included.",
ar.getVtecstr()));
continue;
}
// From A1 SELSparagraphs.C processWOU
if (simulatedTime.before(new Date(ar.getStartTime().getTime()
.getTime() - 180 * 1000))
|| simulatedTime.after(ar.getEndTime().getTime()))
continue;
activeTable.add(ar);
}
System.out.println("getWatches.getActiveTable time: " + (t1 - t0) System.out.println("getWatches.getActiveTable time: " + (t1 - t0)
+ ", found " + ", found "
@ -902,96 +920,293 @@ public class TemplateRunner {
t1 = System.currentTimeMillis(); t1 = System.currentTimeMillis();
System.out.println("getWatches.createWatchGeometry time: " System.out.println("getWatches.createWatchGeometry time: "
+ (t1 - t0)); + (t1 - t0));
SpatialQueryResult[] parentRegionFeatures = null;
try { t0 = System.currentTimeMillis();
String field = "the_geom"; rval = processATEntries(activeTable, warngenLayer);
t0 = System.currentTimeMillis(); System.out.println("getWatches.createPoritions time: "
List<Double> results = DbMapQueryFactory.getMapQuery( + (t1 - t0));
"mapdata.states", field).getLevels();
Collections.sort(results, Collections.reverseOrder());
Double decimationTolerance = null;
for (Double result : results) {
if (result <= 0.064) {
decimationTolerance = result;
}
}
if (decimationTolerance != null) {
DecimalFormat df = new DecimalFormat("0.######");
String suffix = "_"
+ StringUtils.replaceChars(df.format(results
.get(results.size() - 1)), '.', '_');
parentRegionFeatures = SpatialQueryFactory.create()
.query("states", field + suffix,
new String[] { "Name" }, watchArea,
null, false, SearchMode.INTERSECTS);
} else {
parentRegionFeatures = SpatialQueryFactory.create()
.query("states", new String[] { "Name" },
watchArea, null, false,
SearchMode.INTERSECTS);
}
t1 = System.currentTimeMillis();
System.out.println("getWatches.stateSpatialQuery time: "
+ (t1 - t0) + ", found "
+ parentRegionFeatures.length + " states");
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"Error querying state geometries", e);
return null;
}
rval = new WatchUtil();
WeatherAdvisoryWatch watch = null;
long cumulativeIntersect = 0;
long cumulativeCalcPortion = 0;
GeodeticCalculator gc = new GeodeticCalculator();
// For each State in our watchArea...
for (int j = 0; j < parentRegionFeatures.length; j++) {
Geometry parentGeom = parentRegionFeatures[j].geometry;
List<PreparedGeometry> prepGeoms = new ArrayList<PreparedGeometry>();
GeometryUtil.recursivePreparedGeometry(parentGeom,
prepGeoms);
for (ActiveTableRecord atr : activeTable) {
// Get the intersection of watchArea with State.
watch = new WeatherAdvisoryWatch();
watch.setEndTime(atr.getEndTime().getTime());
watch.setPhensig(atr.getPhensig());
// If State intersections intersects with out ATR
// record, add watch
t0 = System.currentTimeMillis();
boolean intersects = GeometryUtil.intersects(prepGeoms,
atr.getGeometry());
t1 = System.currentTimeMillis();
cumulativeIntersect = (t1 - t0);
if (intersects) {
watch.setParentRegion(parentRegionFeatures[j].attributes
.get("Name").toString());
t0 = System.currentTimeMillis();
watch.setPartOfParentRegion(GisUtil
.asStringList(GisUtil.calculatePortion(
parentGeom, atr.getGeometry(), gc)));
t1 = System.currentTimeMillis();
cumulativeCalcPortion = (t1 - t0);
rval.addWaw(watch);
}
}
}
System.out.println("getWatches.cumulativeIntersect: "
+ cumulativeIntersect);
System.out.println("getWatches.cumulativeCalcPortion: "
+ cumulativeCalcPortion);
} }
} }
return rval; return rval;
} }
private static class WatchWork {
public WeatherAdvisoryWatch waw;
public boolean valid;
public ArrayList<String> ugcZone = new ArrayList<String>();
public WatchWork(WeatherAdvisoryWatch waw) {
this.waw = waw;
}
}
/**
* Create the list of objects representing active watches that will be
* passed to the template context.
*
* @param activeTable
* List of entries for active watches
* @param warngenLayer
* @return
*/
private static WatchUtil processATEntries(
List<ActiveTableRecord> activeTable, WarngenLayer warngenLayer) {
WatchUtil rval = new WatchUtil();
TreeMap<WeatherAdvisoryWatch, WatchWork> map = new TreeMap<WeatherAdvisoryWatch, TemplateRunner.WatchWork>();
AreaSourceConfiguration asc = null;
for (AreaSourceConfiguration a : warngenLayer.getConfiguration()
.getAreaSources()) {
if (a.getType() == AreaType.HATCHING) {
asc = a;
break;
}
}
if (asc == null) {
statusHandler
.handle(Priority.ERROR,
"Cannot process watches: missing HATCHING area source configuration");
return rval;
}
GeospatialData[] geoData = warngenLayer.getGeodataFeatures(asc
.getAreaSource() + "." + warngenLayer.getLocalizedSite());
if (geoData == null || geoData.length == 0) {
statusHandler.handle(Priority.ERROR,
"Cannot process watches: cannot get geospatial data");
return rval;
}
// For each watch event, get the end time and list of active zones
for (ActiveTableRecord ar : activeTable) {
/*
* Currently reports all zones in the watch even if a given zone is
* not in the warning polygon. If the logic is changed to only show
* the portions of the watch near our warning polygon, perform the
* isEmpty check here.
*/
WeatherAdvisoryWatch waw = new WeatherAdvisoryWatch();
waw.setPhensig(ar.getPhensig());
try {
waw.setEventId(Integer.parseInt(ar.getEtn()));
} catch (RuntimeException e) {
statusHandler.handle(Priority.ERROR, String.format(
"Watch %s has null end time; not included.",
ar.getVtecstr()));
continue;
}
WatchWork work = map.get(waw);
if (work == null) {
waw.setEndTime(ar.getEndTime().getTime());
work = new WatchWork(waw);
map.put(waw, work);
}
// TODO: Building geometry just to perform this test is probably
// inefficient with the post-DR-15430 logic...
if (!ar.getGeometry().isEmpty())
work.valid = true;
work.ugcZone.add(ar.getUgcZone());
}
for (WatchWork work : map.values()) {
/*
* If none of the areas in the watch were neer our warning polygon,
* do not included it.
*/
if (!work.valid)
continue;
if (determineAffectedPortions(work.ugcZone, asc, geoData, work.waw));
rval.addWaw(work.waw);
}
return rval;
}
/**
* Given the list of counties in a watch, fill out the "portions" part of
* the given WeatherAdvisoryWatch
*
* @param ugcs
* @param asc
* @param geoData
* @param waw
*/
private static boolean determineAffectedPortions(List<String> ugcs,
AreaSourceConfiguration asc, GeospatialData[] geoData,
WeatherAdvisoryWatch waw) {
// Maps state abbreviation to unique fe_area values
HashMap<String, Set<String>> map = new HashMap<String, Set<String>>();
for (String ugc : ugcs) {
for (Entry<String, String[]> e : FipsUtil.parseCountyHeader(ugc).entrySet()) {
String stateAbbrev = e.getKey();
if (e.getValue().length != 1) // either zero or more than one
// would be wrong
statusHandler.handle(Priority.ERROR,
"Invalid ugczone in active table entry");
Set<String> feAreas = map.get(stateAbbrev);
if (feAreas == null) {
feAreas = new HashSet<String>();
map.put(stateAbbrev, feAreas);
}
try {
feAreas.add(getFeArea(stateAbbrev, e.getValue()[0], asc,
geoData));
} catch (RuntimeException exc) {
statusHandler.handle(Priority.ERROR, "Error generating included watches.", exc);
return false;
}
}
}
ArrayList<Portion> portions = new ArrayList<Portion>(map.size());
for (Entry<String, Set<String>> e : map.entrySet()) {
Portion portion = new Portion();
try {
portion.parentRegion = getStateName(e.getKey(), asc, geoData)
.toUpperCase();
} catch (RuntimeException exc) {
statusHandler.handle(Priority.ERROR, "Error generating included watches.", exc);
return false;
}
portion.partOfParentRegion = Area
.converFeAreaToPartList(mungeFeAreas(e.getValue()));
System.out.format("Munged %s to %s (%s)\n", e.getValue(),
mungeFeAreas(e.getValue()), portion.partOfParentRegion);
portions.add(portion);
}
waw.setPortions(portions);
// Set legacy values
if (portions.size() > 0) {
waw.setParentRegion(portions.get(0).parentRegion);
waw.setPartOfParentRegion(portions.get(0).partOfParentRegion);
}
return true;
}
// Based on AWIPS 1 SELSparagraphs.C SELSparagraphs::processWOU().
private static String mungeFeAreas(Set<String> feAreas) {
String abrev = "";
// If eight or more portions, don't qualify area of state
int m = feAreas.size();
if (m < 8) {
String partAbrev = "";
/*
* TODO: Unused variables should be removed if we are not going to
* improve this in A2.
*/
@SuppressWarnings("unused")
int nw, nc, ne, wc, cc, ec, sw, sc, se, pa;
int eee, www, nnn, sss, ee, ww, nn, ss;
// Identify individual sub areas of this state affected
nw = nc = ne = wc = cc = ec = sw = sc = se = pa = 0;
eee = www = nnn = sss = ee = ww = nn = ss = 0;
for (String part : feAreas) {
if ("pa".equals(part)) {
pa = 1;
continue;
} else if ("nn".equals(part))
nnn = nn = 1;
else if ("ss".equals(part))
sss = ss = 1;
else if ("ee".equals(part))
eee = ee = 1;
else if ("ww".equals(part))
www = ww = 1;
else if ("nw".equals(part))
nnn = www = nw = 1;
else if ("nc".equals(part))
nnn = nc = 1;
else if ("ne".equals(part))
nnn = eee = ne = 1;
else if ("wc".equals(part))
www = wc = 1;
else if ("cc".equals(part)) {
cc = 1;
continue;
} else if ("ec".equals(part))
eee = ec = 1;
else if ("sw".equals(part))
sss = www = sw = 1;
else if ("sc".equals(part))
sss = sc = 1;
else if ("se".equals(part))
sss = eee = se = 1;
partAbrev = part;
}
// decide how to describe these subareas.
if (ne > 0 && nw > 0)
nn = 1;
if (se > 0 && sw > 0)
ss = 1;
if (se > 0 && ne > 0)
ee = 1;
if (sw > 0 && nw > 0)
ww = 1;
if (nnn > 0 && sss > 0 && eee > 0 && www > 0)
return abrev;
if (nn > 0 && ss > 0 || ee > 0 && ww > 0)
return abrev;
if (nnn + sss + eee + www == 3) {
if (www == 0) {
abrev = "e";
} else if (eee == 0) {
abrev = "w";
} else if (nnn == 0) {
abrev = "s";
} else if (sss == 0) {
abrev = "n";
}
return abrev;
}
if (nnn == sss && eee == www || cc == m) {
abrev = "c";
return abrev;
}
if (pa != 0 && cc == 0) {
abrev = "pa";
if (--m <= 0) {
return abrev;
}
}
if (m == 1 + cc) {
abrev += partAbrev + " ";
return abrev;
}
if (nnn != sss) {
abrev += nnn != 0 ? "n" : "s";
}
if (eee != www) {
abrev += eee != 0 ? "e" : "w";
}
}
return abrev;
}
private static String getStateName(String key, AreaSourceConfiguration asc,
GeospatialData[] geoData) {
for (GeospatialData g : geoData) {
if (key.equals((String) g.attributes.get("STATE")))
return (String) g.parent.attributes.get("NAME");
}
return null;
}
private static String getFeArea(String stateAbbrev, String ugc,
AreaSourceConfiguration asc, GeospatialData[] geoData) {
for (GeospatialData g : geoData) {
if (stateAbbrev.equals((String) g.attributes.get("STATE"))
&& ((String) g.attributes.get(asc.getFipsField()))
.endsWith(ugc))
return (String) g.attributes.get(asc.getFeAreaField());
}
return null;
}
} }

View file

@ -31,6 +31,7 @@ import java.util.List;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jul 1, 2009 bwoodle Initial creation * Jul 1, 2009 bwoodle Initial creation
* Nov 9, 2012 DR 15430 D. Friedman Support proper watch inclusion language
* *
* </pre> * </pre>
* *
@ -39,13 +40,45 @@ import java.util.List;
*/ */
public class WeatherAdvisoryWatch implements Comparable<WeatherAdvisoryWatch> { public class WeatherAdvisoryWatch implements Comparable<WeatherAdvisoryWatch> {
public static class Portion {
public String parentRegion;
public List<String> partOfParentRegion;
public String getParentRegion() {
return parentRegion;
}
public void setParentRegion(String parentRegion) {
this.parentRegion = parentRegion;
}
public List<String> getPartOfParentRegion() {
return partOfParentRegion;
}
public void setPartOfParentRegion(List<String> partOfParentRegion) {
this.partOfParentRegion = partOfParentRegion;
}
}
/* TODO: NOTE: There is no site field. We currently only process
* WCNs for the site and not WOUs from the SPC.
*/
private String phensig; private String phensig;
private int eventId;
private Date endTime; private Date endTime;
private List<Portion> portions;
@Deprecated
private String parentRegion; private String parentRegion;
@Deprecated
private List<String> partOfParentRegion; private List<String> partOfParentRegion;
public String getPhensig() { public String getPhensig() {
@ -64,23 +97,59 @@ public class WeatherAdvisoryWatch implements Comparable<WeatherAdvisoryWatch> {
this.endTime = endTime; this.endTime = endTime;
} }
@Deprecated
public String getParentRegion() { public String getParentRegion() {
return parentRegion; return parentRegion;
} }
@Deprecated
public void setParentRegion(String parentRegion) { public void setParentRegion(String parentRegion) {
this.parentRegion = parentRegion; this.parentRegion = parentRegion;
} }
@Deprecated
public List<String> getPartOfParentRegion() { public List<String> getPartOfParentRegion() {
return partOfParentRegion; return partOfParentRegion;
} }
@Deprecated
public void setPartOfParentRegion(List<String> partOfParentRegion) { public void setPartOfParentRegion(List<String> partOfParentRegion) {
this.partOfParentRegion = partOfParentRegion; this.partOfParentRegion = partOfParentRegion;
} }
@Override
public boolean equals(Object obj) {
return obj instanceof WeatherAdvisoryWatch &&
this.compareTo((WeatherAdvisoryWatch) obj) == 0;
}
public int compareTo(WeatherAdvisoryWatch waw) { public int compareTo(WeatherAdvisoryWatch waw) {
return this.parentRegion.compareTo(waw.getParentRegion()); if (this.phensig == null)
return waw.phensig == null ? 0 : -1;
else if (waw.phensig == null)
return 1;
else {
int c = this.phensig.compareTo(waw.phensig);
if (c == 0)
return this.eventId - waw.eventId;
else
return c;
}
}
public int getEventId() {
return eventId;
}
public void setEventId(int eventId) {
this.eventId = eventId;
}
public List<Portion> getPortions() {
return portions;
}
public void setPortions(List<Portion> portions) {
this.portions = portions;
} }
} }

View file

@ -2,7 +2,8 @@
##### Qinglu Lin 04-04-2012 DR 14691. ##### Qinglu Lin 04-04-2012 DR 14691.
##### Qinglu Lin 06-18-2012 DR 15043. Use duration in secondBullet. ##### Qinglu Lin 06-18-2012 DR 15043. Use duration in secondBullet.
##### Qinglu Lin 07-31-2012 DR 15217. Use roundAndPad for movement direction in DEG. ##### Qinglu Lin 07-31-2012 DR 15217. Use roundAndPad for movement direction in DEG.
##### Qinglu Lin 08-13-2012 DR 14493. Use corToNewMarker and corEventtime. ##### Qinglu Lin 08-13-2012 DR 14493. Use corToNewMarker and corEventtime.
##### D. Friedman 11-09-2012 DR 15430. Rework included watches.
#################################################################################################### ####################################################################################################
Mile Marker Test Code Mile Marker Test Code
macro "mmarkers" use (called out of VM_global_library.vm): macro "mmarkers" use (called out of VM_global_library.vm):
@ -146,52 +147,66 @@ ${drainage.name}##
#macro(inserttorwatches $watches $list $secondtimezone $dateUtil $timeFormat) #macro(inserttorwatches $watches $list $secondtimezone $dateUtil $timeFormat)
#set($torWatches = ${watches.getTorWatches()}) #set($torWatches = ${watches.getTorWatches()})
#if(${list.size($torWatches)} > 0) #set($torWatchAlso = "")
A TORNADO WATCH REMAINS IN EFFECT UNTIL ${dateUtil.format(${watches.getLatestTorTime()}, ${timeFormat.plain}, 15, ${localtimezone})}## #set($torWatchFirst = 1)
#foreach(${watch} in ${torWatches})
#if($torWatchFirst)
#set($torWatchFirst = 0)
##
#end
A TORNADO WATCH ${torWatchAlso}REMAINS IN EFFECT UNTIL ${dateUtil.format(${watch.getEndTime()}, ${timeFormat.plain}, 15, ${localtimezone})}##
${dateUtil.period(${watches.getLatestTorTime()},${timeFormat.plain}, 15, ${localtimezone})}## ${dateUtil.period(${watches.getLatestTorTime()},${timeFormat.plain}, 15, ${localtimezone})}##
#if(${secondtimezone}) #if(${secondtimezone})
/${dateUtil.format(${list.get($torWatches, 0).endTime}, ${timeFormat.plain}, 15, ${secondtimezone})}/## /${dateUtil.format(${watch.getEndTime()}, ${timeFormat.plain}, 15, ${secondtimezone})}/##
#end #end
FOR ## FOR ##
#set($numWatches = ${list.size($torWatches)}) #set($numPortions = ${list.size(${watch.getPortions()})})
#set($count = 0) #set($count = 0)
#foreach(${watch} in ${torWatches}) #foreach(${portion} in ${watch.getPortions()})
#set($count = $count + 1) #set($count = $count + 1)
#areaFormat(${watch.partOfParentRegion} true false) ${watch.parentRegion}## #areaFormat(${portion.partOfParentRegion} true false) ${portion.parentRegion}##
#if($count == $numWatches - 1) #if($count == $numPortions - 1)
AND ## AND ##
#elseif($count < $numWatches) #elseif($count < $numPortions)
...## ...##
#end #end
#end #end
. #set($torWatchAlso = "ALSO ")
.##
#end #end
#end #end
#macro(insertsvrwatches $watches $list $secondtimezone $dateUtil $timeFormat) #macro(insertsvrwatches $watches $list $secondtimezone $dateUtil $timeFormat)
#set($svrWatches = ${watches.getSvrWatches()}) #set($svrWatches = ${watches.getSvrWatches()})
#if(${list.size($svrWatches)} > 0) #set($svrWatchAlso = "")
A SEVERE THUNDERSTORM WATCH REMAINS IN EFFECT UNTIL ${dateUtil.format(${watches.getLatestSvrTime()}, ${timeFormat.plain}, 15, ${localtimezone})}## #set($svrWatchFirst = 1)
#foreach(${watch} in ${svrWatches})
#if($svrWatchFirst)
#set($svrWatchFirst = 0)
##
#end
A SEVERE THUNDERSTORM WATCH ${svrWatchAlso}REMAINS IN EFFECT UNTIL ${dateUtil.format(${watch.getEndTime()}, ${timeFormat.plain}, 15, ${localtimezone})}##
${dateUtil.period(${watches.getLatestSvrTime()},${timeFormat.plain}, 15, ${localtimezone})}## ${dateUtil.period(${watches.getLatestSvrTime()},${timeFormat.plain}, 15, ${localtimezone})}##
#if(${secondtimezone}) #if(${secondtimezone})
/${dateUtil.format(${list.get($svrWatches, 0).endTime}, ${timeFormat.plain}, 15, ${secondtimezone})}/## /${dateUtil.format(${watch.getEndTime()}, ${timeFormat.plain}, 15, ${secondtimezone})}/##
#end #end
FOR ## FOR ##
#set($numWatches = ${list.size($svrWatches)}) #set($numPortions = ${list.size(${watch.getPortions()})})
#set($count = 0) #set($count = 0)
#foreach(${watch} in ${svrWatches}) #foreach(${portion} in ${watch.getPortions()})
#set($count = $count + 1) #set($count = $count + 1)
#areaFormat(${watch.partOfParentRegion} true false) ${watch.parentRegion}## #areaFormat(${portion.partOfParentRegion} true false) ${portion.parentRegion}##
#if($count == $numWatches - 1) #if($count == $numPortions - 1)
AND ## AND ##
#elseif($count < $numWatches) #elseif($count < $numPortions)
...## ...##
#end #end
#end #end
. #set($svrWatchAlso = "ALSO ")
.##
#end #end
#end #end
#macro(printcoords $coordinates $list) #macro(printcoords $coordinates $list)

View file

@ -21,8 +21,8 @@
<polarStereoGridCoverage> <polarStereoGridCoverage>
<name>250160</name> <name>250160</name>
<description>QPF Grid for TIR (Ohio Basin RFC Wilmington, Ohio)</description> <description>QPF Grid for TIR (Ohio Basin RFC Wilmington, Ohio)</description>
<la1>36.19</la1> <la1>36.203</la1>
<lo1>-91.347</lo1> <lo1>-91.320</lo1>
<firstGridPointCorner>LowerLeft</firstGridPointCorner> <firstGridPointCorner>LowerLeft</firstGridPointCorner>
<nx>250</nx> <nx>250</nx>
<ny>260</ny> <ny>260</ny>

View file

@ -21,13 +21,13 @@
<polarStereoGridCoverage> <polarStereoGridCoverage>
<name>240161</name> <name>240161</name>
<description>HRAP Grid for ALR (Southeast RFC Peachtree, Georgia)</description> <description>HRAP Grid for ALR (Southeast RFC Peachtree, Georgia)</description>
<la1>27.033</la1> <la1>27.045</la1>
<lo1>-91.417</lo1> <lo1>-91.395</lo1>
<firstGridPointCorner>LowerLeft</firstGridPointCorner> <firstGridPointCorner>LowerLeft</firstGridPointCorner>
<nx>335</nx> <nx>335</nx>
<ny>412</ny> <ny>412</ny>
<dx>4.762</dx> <dx>4.7625</dx>
<dy>4.762</dy> <dy>4.7625</dy>
<spacingUnit>km</spacingUnit> <spacingUnit>km</spacingUnit>
<minorAxis>6371229.0</minorAxis> <minorAxis>6371229.0</minorAxis>
<majorAxis>6371229.0</majorAxis> <majorAxis>6371229.0</majorAxis>

View file

@ -21,13 +21,13 @@
<polarStereoGridCoverage> <polarStereoGridCoverage>
<name>240162</name> <name>240162</name>
<description>HRAP Grid for WFR (West Gulf RFC Fort Worth, Texas)</description> <description>HRAP Grid for WFR (West Gulf RFC Fort Worth, Texas)</description>
<la1>24.852</la1> <la1>24.869</la1>
<lo1>-108.99</lo1> <lo1>-108.973</lo1>
<firstGridPointCorner>LowerLeft</firstGridPointCorner> <firstGridPointCorner>LowerLeft</firstGridPointCorner>
<nx>425</nx> <nx>425</nx>
<ny>390</ny> <ny>390</ny>
<dx>4.762</dx> <dx>4.7625</dx>
<dy>4.762</dy> <dy>4.7625</dy>
<spacingUnit>km</spacingUnit> <spacingUnit>km</spacingUnit>
<minorAxis>6371229.0</minorAxis> <minorAxis>6371229.0</minorAxis>
<majorAxis>6371229.0</majorAxis> <majorAxis>6371229.0</majorAxis>

View file

@ -21,13 +21,13 @@
<polarStereoGridCoverage> <polarStereoGridCoverage>
<name>240156</name> <name>240156</name>
<description>HRAP Grid for KRF (Missouri Basin RFC Pleasant Hill, Missouri)</description> <description>HRAP Grid for KRF (Missouri Basin RFC Pleasant Hill, Missouri)</description>
<la1>37.275</la1> <la1>37.296</la1>
<lo1>-112.71</lo1> <lo1>-112.690</lo1>
<firstGridPointCorner>LowerLeft</firstGridPointCorner> <firstGridPointCorner>LowerLeft</firstGridPointCorner>
<nx>485</nx> <nx>485</nx>
<ny>325</ny> <ny>325</ny>
<dx>4.762</dx> <dx>4.7625</dx>
<dy>4.762</dy> <dy>4.7625</dy>
<spacingUnit>km</spacingUnit> <spacingUnit>km</spacingUnit>
<minorAxis>6371229.0</minorAxis> <minorAxis>6371229.0</minorAxis>
<majorAxis>6371229.0</majorAxis> <majorAxis>6371229.0</majorAxis>

View file

@ -21,13 +21,13 @@
<polarStereoGridCoverage> <polarStereoGridCoverage>
<name>240157</name> <name>240157</name>
<description>HRAP Grid for MSR (North Central RFC Chanhassen, Minnesota)</description> <description>HRAP Grid for MSR (North Central RFC Chanhassen, Minnesota)</description>
<la1>37.87</la1> <la1>37.889</la1>
<lo1>-105.515</lo1> <lo1>-105.492</lo1>
<firstGridPointCorner>LowerLeft</firstGridPointCorner> <firstGridPointCorner>LowerLeft</firstGridPointCorner>
<nx>450</nx> <nx>450</nx>
<ny>350</ny> <ny>350</ny>
<dx>4.762</dx> <dx>4.7625</dx>
<dy>4.762</dy> <dy>4.7625</dy>
<spacingUnit>km</spacingUnit> <spacingUnit>km</spacingUnit>
<minorAxis>6371229.0</minorAxis> <minorAxis>6371229.0</minorAxis>
<majorAxis>6371229.0</majorAxis> <majorAxis>6371229.0</majorAxis>

View file

@ -21,13 +21,13 @@
<polarStereoGridCoverage> <polarStereoGridCoverage>
<name>240154</name> <name>240154</name>
<description>HRAP Grid for ORN (Lower Mississippi RFC Slidel, Louisiana)</description> <description>HRAP Grid for ORN (Lower Mississippi RFC Slidel, Louisiana)</description>
<la1>28.686</la1> <la1>28.701</la1>
<lo1>-98.791</lo1> <lo1>-98.770</lo1>
<firstGridPointCorner>LowerLeft</firstGridPointCorner> <firstGridPointCorner>LowerLeft</firstGridPointCorner>
<nx>419</nx> <nx>419</nx>
<ny>419</ny> <ny>419</ny>
<dx>4.762</dx> <dx>4.7625</dx>
<dy>4.762</dy> <dy>4.7625</dy>
<spacingUnit>km</spacingUnit> <spacingUnit>km</spacingUnit>
<minorAxis>6371229.0</minorAxis> <minorAxis>6371229.0</minorAxis>
<majorAxis>6371229.0</majorAxis> <majorAxis>6371229.0</majorAxis>

View file

@ -21,13 +21,13 @@
<polarStereoGridCoverage> <polarStereoGridCoverage>
<name>240159</name> <name>240159</name>
<description>HRAP Grid for PTR (Northwest RFC Portland, Oregon)</description> <description>HRAP Grid for PTR (Northwest RFC Portland, Oregon)</description>
<la1>37.952</la1> <la1>38.00</la1>
<lo1>-124.207</lo1> <lo1>-124.179</lo1>
<firstGridPointCorner>LowerLeft</firstGridPointCorner> <firstGridPointCorner>LowerLeft</firstGridPointCorner>
<nx>400</nx> <nx>400</nx>
<ny>378</ny> <ny>378</ny>
<dx>4.762</dx> <dx>4.7625</dx>
<dy>4.762</dy> <dy>4.7625</dy>
<spacingUnit>km</spacingUnit> <spacingUnit>km</spacingUnit>
<minorAxis>6371229.0</minorAxis> <minorAxis>6371229.0</minorAxis>
<majorAxis>6371229.0</majorAxis> <majorAxis>6371229.0</majorAxis>

View file

@ -21,13 +21,13 @@
<polarStereoGridCoverage> <polarStereoGridCoverage>
<name>240155</name> <name>240155</name>
<description>HRAP Grid for RHA (Middle Atlantic RFC State College, PA)</description> <description>HRAP Grid for RHA (Middle Atlantic RFC State College, PA)</description>
<la1>38.025</la1> <la1>38.035</la1>
<lo1>-83.346</lo1> <lo1>-83.315</lo1>
<firstGridPointCorner>LowerLeft</firstGridPointCorner> <firstGridPointCorner>LowerLeft</firstGridPointCorner>
<nx>200</nx> <nx>200</nx>
<ny>200</ny> <ny>200</ny>
<dx>4.762</dx> <dx>4.7625</dx>
<dy>4.762</dy> <dy>4.7625</dy>
<spacingUnit>km</spacingUnit> <spacingUnit>km</spacingUnit>
<minorAxis>6371229.0</minorAxis> <minorAxis>6371229.0</minorAxis>
<majorAxis>6371229.0</majorAxis> <majorAxis>6371229.0</majorAxis>

View file

@ -21,13 +21,13 @@
<polarStereoGridCoverage> <polarStereoGridCoverage>
<name>240153</name> <name>240153</name>
<description>HRAP Grid for RSA (California-Nevada RFC Sacramento, California)</description> <description>HRAP Grid for RSA (California-Nevada RFC Sacramento, California)</description>
<la1>30.91</la1> <la1>30.931</la1>
<lo1>-120.872</lo1> <lo1>-120.858</lo1>
<firstGridPointCorner>LowerLeft</firstGridPointCorner> <firstGridPointCorner>LowerLeft</firstGridPointCorner>
<nx>235</nx> <nx>235</nx>
<ny>335</ny> <ny>335</ny>
<dx>4.762</dx> <dx>4.7625</dx>
<dy>4.762</dy> <dy>4.7625</dy>
<spacingUnit>km</spacingUnit> <spacingUnit>km</spacingUnit>
<minorAxis>6371229.0</minorAxis> <minorAxis>6371229.0</minorAxis>
<majorAxis>6371229.0</majorAxis> <majorAxis>6371229.0</majorAxis>

View file

@ -21,13 +21,13 @@
<polarStereoGridCoverage> <polarStereoGridCoverage>
<name>240152</name> <name>240152</name>
<description>HRAP Grid for STR (Colorado Basin RFC Salt Lake City, Utah)</description> <description>HRAP Grid for STR (Colorado Basin RFC Salt Lake City, Utah)</description>
<la1>30.027</la1> <la1>30.047</la1>
<lo1>-114.429</lo1> <lo1>-114.413</lo1>
<firstGridPointCorner>LowerLeft</firstGridPointCorner> <firstGridPointCorner>LowerLeft</firstGridPointCorner>
<nx>260</nx> <nx>260</nx>
<ny>360</ny> <ny>360</ny>
<dx>4.762</dx> <dx>4.7625</dx>
<dy>4.762</dy> <dy>4.7625</dy>
<spacingUnit>km</spacingUnit> <spacingUnit>km</spacingUnit>
<minorAxis>6371229.0</minorAxis> <minorAxis>6371229.0</minorAxis>
<majorAxis>6371229.0</majorAxis> <majorAxis>6371229.0</majorAxis>

View file

@ -21,13 +21,13 @@
<polarStereoGridCoverage> <polarStereoGridCoverage>
<name>240158</name> <name>240158</name>
<description>HRAP Grid for TAR (Northeast RFC Taunton, Massachusetts)</description> <description>HRAP Grid for TAR (Northeast RFC Taunton, Massachusetts)</description>
<la1>42.057</la1> <la1>42.066</la1>
<lo1>-80.004</lo1> <lo1>-79.970</lo1>
<firstGridPointCorner>LowerLeft</firstGridPointCorner> <firstGridPointCorner>LowerLeft</firstGridPointCorner>
<nx>180</nx> <nx>180</nx>
<ny>235</ny> <ny>235</ny>
<dx>4.762</dx> <dx>4.7625</dx>
<dy>4.762</dy> <dy>4.7625</dy>
<spacingUnit>km</spacingUnit> <spacingUnit>km</spacingUnit>
<minorAxis>6371229.0</minorAxis> <minorAxis>6371229.0</minorAxis>
<majorAxis>6371229.0</majorAxis> <majorAxis>6371229.0</majorAxis>

View file

@ -21,13 +21,13 @@
<polarStereoGridCoverage> <polarStereoGridCoverage>
<name>240150</name> <name>240150</name>
<description>HRAP Grid for TUA (Arkansas-Red River RFC Tulsa, Oklahoma)</description> <description>HRAP Grid for TUA (Arkansas-Red River RFC Tulsa, Oklahoma)</description>
<la1>33.603</la1> <la1>33.621</la1>
<lo1>-106.455</lo1> <lo1>-106.434</lo1>
<firstGridPointCorner>LowerLeft</firstGridPointCorner> <firstGridPointCorner>LowerLeft</firstGridPointCorner>
<nx>335</nx> <nx>335</nx>
<ny>159</ny> <ny>159</ny>
<dx>4.762</dx> <dx>4.7625</dx>
<dy>4.762</dy> <dy>4.7625</dy>
<spacingUnit>km</spacingUnit> <spacingUnit>km</spacingUnit>
<minorAxis>6371229.0</minorAxis> <minorAxis>6371229.0</minorAxis>
<majorAxis>6371229.0</majorAxis> <majorAxis>6371229.0</majorAxis>

View file

@ -45,6 +45,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 14, 2010 chammack Initial creation * Jan 14, 2010 chammack Initial creation
* *
* 10/30/2012 15448 Xiaochuan Check if container != null first in from().
*
* </pre> * </pre>
* *
* @author chammack * @author chammack
@ -156,36 +158,40 @@ public class PointDataThriftContainer implements ISerializableObject {
List<FloatPointDataObject> floatTypes = new ArrayList<FloatPointDataObject>(); List<FloatPointDataObject> floatTypes = new ArrayList<FloatPointDataObject>();
List<StringPointDataObject> stringTypes = new ArrayList<StringPointDataObject>(); List<StringPointDataObject> stringTypes = new ArrayList<StringPointDataObject>();
List<LongPointDataObject> longTypes = new ArrayList<LongPointDataObject>(); List<LongPointDataObject> longTypes = new ArrayList<LongPointDataObject>();
for (Map.Entry<String, AbstractPointDataObject<?>> v : container.pointDataTypes if( container != null )
.entrySet()) { {
AbstractPointDataObject<?> o = v.getValue(); for (Map.Entry<String, AbstractPointDataObject<?>> v : container.pointDataTypes
if (o instanceof IntPointDataObject) { .entrySet()) {
intTypes.add((IntPointDataObject) o); AbstractPointDataObject<?> o = v.getValue();
} else if (o instanceof FloatPointDataObject) { if (o instanceof IntPointDataObject) {
floatTypes.add((FloatPointDataObject) o); intTypes.add((IntPointDataObject) o);
} else if (o instanceof StringPointDataObject) { } else if (o instanceof FloatPointDataObject) {
stringTypes.add((StringPointDataObject) o); floatTypes.add((FloatPointDataObject) o);
} else if (o instanceof LongPointDataObject) { } else if (o instanceof StringPointDataObject) {
longTypes.add((LongPointDataObject) o); stringTypes.add((StringPointDataObject) o);
} else { } else if (o instanceof LongPointDataObject) {
throw new UnsupportedOperationException("Got type: " longTypes.add((LongPointDataObject) o);
} else {
throw new UnsupportedOperationException("Got type: "
+ o.getClass().getName() + o.getClass().getName()
+ ". Code must be updated to support new type"); + ". Code must be updated to support new type");
} }
}
pdtc.intData = intTypes
.toArray(new IntPointDataObject[intTypes.size()]);
pdtc.floatData = floatTypes.toArray(new FloatPointDataObject[floatTypes
.size()]);
pdtc.stringData = stringTypes
.toArray(new StringPointDataObject[stringTypes.size()]);
pdtc.longData = longTypes.toArray(new LongPointDataObject[longTypes
.size()]);
pdtc.size = container.getAllocatedSz();
} }
pdtc.intData = intTypes
.toArray(new IntPointDataObject[intTypes.size()]);
pdtc.floatData = floatTypes.toArray(new FloatPointDataObject[floatTypes
.size()]);
pdtc.stringData = stringTypes
.toArray(new StringPointDataObject[stringTypes.size()]);
pdtc.longData = longTypes.toArray(new LongPointDataObject[longTypes
.size()]);
pdtc.size = container.getAllocatedSz();
return pdtc; return pdtc;
} }

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<purgeRuleSet>
<defaultRule>
<versionsToKeep>24</versionsToKeep>
<delta>=00-01:00:00</delta>
<round>00-01:00:00</round>
</defaultRule>
</purgeRuleSet>