Issue #1358 fix forced basins and ffmp loading rfc ffg on startup.
Former-commit-id:5039e5fa08
[formerlyb536f26daa
[formerly 901c629add69ab263d041919c45316512718b72a]] Former-commit-id:b536f26daa
Former-commit-id:215f954d82
This commit is contained in:
parent
9b6bf382f7
commit
e6d005ec38
3 changed files with 58 additions and 40 deletions
|
@ -100,7 +100,7 @@ public class FFMPGuidanceBasin extends FFMPBasin implements ISerializableObject
|
|||
return Float.NaN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* purge out old entries
|
||||
*
|
||||
|
@ -178,14 +178,14 @@ public class FFMPGuidanceBasin extends FFMPBasin implements ISerializableObject
|
|||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets a Value for a FFG source
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
public Float getValue(String sourceName,
|
||||
public Float getValue(String sourceName,
|
||||
FFMPGuidanceInterpolation interpolation, long expiration) {
|
||||
Float dvalue = Float.NaN;
|
||||
|
||||
|
@ -209,23 +209,23 @@ public class FFMPGuidanceBasin extends FFMPBasin implements ISerializableObject
|
|||
*/
|
||||
public Float getValue(String sourceName, Date date,
|
||||
FFMPGuidanceInterpolation interpolation, long expiration) {
|
||||
|
||||
|
||||
Float dvalue = Float.NaN;
|
||||
Float value = Float.NaN;
|
||||
Date closestDate = getClosest(sourceName, date, expiration);
|
||||
|
||||
|
||||
if (closestDate != null) {
|
||||
value = getValue(closestDate, sourceName);
|
||||
}
|
||||
|
||||
|
||||
if (!value.isNaN()) {
|
||||
FFFGDataMgr dman = FFFGDataMgr.getInstance();
|
||||
if (dman.isExpired() == false) {
|
||||
|
||||
dvalue = dman.adjustValue(dvalue, sourceName, this.pfaf,
|
||||
dvalue = dman.adjustValue(value, sourceName, this.pfaf,
|
||||
this.countyFips);
|
||||
} else {
|
||||
dvalue = value;
|
||||
dvalue = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,30 +244,30 @@ public class FFMPGuidanceBasin extends FFMPBasin implements ISerializableObject
|
|||
Date rdate = null;
|
||||
|
||||
if (guidValues != null && guidValues.size() > 0) {
|
||||
|
||||
Date markerDate = guidValues.firstKey();
|
||||
|
||||
for (Date checkDate : guidValues.keySet()) {
|
||||
|
||||
if (guidValues.get(checkDate).containsKey(sourceName)) {
|
||||
float val = guidValues.get(checkDate).get(sourceName);
|
||||
if (val != FFMPUtils.MISSING) {
|
||||
|
||||
long time1 = markerDate.getTime();
|
||||
long time2 = checkDate.getTime();
|
||||
|
||||
if ((time1 - time2) < expiration) {
|
||||
rdate = checkDate;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Date markerDate = guidValues.firstKey();
|
||||
|
||||
for (Date checkDate : guidValues.keySet()) {
|
||||
|
||||
if (guidValues.get(checkDate).containsKey(sourceName)) {
|
||||
float val = guidValues.get(checkDate).get(sourceName);
|
||||
if (val != FFMPUtils.MISSING) {
|
||||
|
||||
long time1 = markerDate.getTime();
|
||||
long time2 = checkDate.getTime();
|
||||
|
||||
if ((time1 - time2) < expiration) {
|
||||
rdate = checkDate;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rdate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Closest Key
|
||||
*
|
||||
|
@ -284,14 +284,14 @@ public class FFMPGuidanceBasin extends FFMPBasin implements ISerializableObject
|
|||
|
||||
if (guidValues.containsKey(date)) {
|
||||
if (guidValues.get(date).containsKey(sourceName)) {
|
||||
|
||||
|
||||
float val = guidValues.get(date).get(sourceName);
|
||||
|
||||
|
||||
if (val != FFMPUtils.MISSING) {
|
||||
rdate = date;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rdate == null) {
|
||||
|
||||
|
|
|
@ -475,11 +475,12 @@ public class FFMPUtils {
|
|||
* @return
|
||||
*/
|
||||
public static FFMPCounty getCounty(Long pfaf, String mode) {
|
||||
|
||||
String ftxt = (pfaf>=10000 ? ""+pfaf : "0"+pfaf);// DR 15164
|
||||
|
||||
|
||||
String ftxt = (pfaf >= 10000 ? "" + pfaf : "0" + pfaf);// DR 15164
|
||||
|
||||
String sql = "SELECT county.countyname, county.state FROM "
|
||||
+ " mapdata.county WHERE county.fips = '" + ftxt/*pfaf*/ + "'";// DR 15164
|
||||
+ " mapdata.county WHERE county.fips = '" + ftxt/* pfaf */+ "'";// DR
|
||||
// 15164
|
||||
|
||||
ISpatialQuery sq = null;
|
||||
FFMPCounty county = new FFMPCounty();
|
||||
|
@ -627,10 +628,23 @@ public class FFMPUtils {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static ArrayList<?> getCountyInfo(Long fips, String mode) {
|
||||
String ftxt = (fips>=10000 ? ""+fips : "0"+fips);// DR 15108: add a leading 0 to 4-digit FIPS.
|
||||
String ftxt = (fips >= 10000 ? "" + fips : "0" + fips);// DR 15108: add
|
||||
// a leading 0 to
|
||||
// 4-digit FIPS.
|
||||
String sql1 = "SELECT county.gid from " + FFMPUtils.COUNTY_TABLE
|
||||
+ " WHERE county.fips = '" + ftxt/*fips*/ + "'";// DR 15108: use the 5-digit FIPS string.
|
||||
System.out.println("___FFMPUtils.getCountyInfo(): county FIPS: "+ftxt);//Not a debug statement but for Template generation.
|
||||
+ " WHERE county.fips = '" + ftxt/* fips */+ "'";// DR 15108:
|
||||
// use the
|
||||
// 5-digit FIPS
|
||||
// string.
|
||||
System.out
|
||||
.println("___FFMPUtils.getCountyInfo(): county FIPS: " + ftxt);// Not
|
||||
// a
|
||||
// debug
|
||||
// statement
|
||||
// but
|
||||
// for
|
||||
// Template
|
||||
// generation.
|
||||
ISpatialQuery sq1 = null;
|
||||
ArrayList<Long> gids = new ArrayList<Long>();
|
||||
|
||||
|
@ -914,13 +928,16 @@ public class FFMPUtils {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public static String getFFGDataURI(String parameter, String plugin) {
|
||||
public static String getFFGDataURI(String rfc, String parameter,
|
||||
String plugin) {
|
||||
|
||||
DbQueryRequest request = new DbQueryRequest();
|
||||
request.setEntityClass(GridRecord.class.getName());
|
||||
request.addRequestField("dataURI");
|
||||
request.addConstraint(GridConstants.PARAMETER_ABBREVIATION,
|
||||
new RequestConstraint(parameter));
|
||||
request.addConstraint(GridConstants.DATASET_ID, new RequestConstraint(
|
||||
"FFG-" + rfc.substring(1)));
|
||||
request.setOrderByField("dataTime.refTime", OrderMode.DESC);
|
||||
try {
|
||||
DbQueryResponse response = (DbQueryResponse) RequestRouter
|
||||
|
|
|
@ -1065,7 +1065,8 @@ public class FFMPGenerator extends CompositeProductGenerator implements
|
|||
|
||||
String plugin = getSourceConfig().getSource(source)
|
||||
.getPlugin();
|
||||
uris.add(FFMPUtils.getFFGDataURI(source, plugin));
|
||||
uris.add(FFMPUtils.getFFGDataURI(rfc, source,
|
||||
plugin));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue