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