VLab Issue #4867 - UAIR display performance improvement
Change-Id: I2065da34f46cf396bbc167822d79aef53092aaa4 Former-commit-id:3714f23401
[formerly3714f23401
[formerly 7b372387492fb00f91956d83ab03a702cbc407b7]] Former-commit-id:d0545c54c1
Former-commit-id:490f2c7a41
This commit is contained in:
parent
a00b252fff
commit
45cbb5c461
4 changed files with 96 additions and 28 deletions
|
@ -15,6 +15,8 @@
|
|||
* 10/2011 S. Gurung Added changes related to getting stid/lat/lon/elev
|
||||
* from database instead of snstns.xml file
|
||||
* 6/2014 T.Lee Added support XXAA, XXBB, XXCC, XXDD
|
||||
* 10/2014 B. Hebbard Allow subsetting XXAA/TTAA params only for faster
|
||||
* retrieval in cases where other params not needed
|
||||
* </pre>
|
||||
*
|
||||
* This code has been developed by the SIB for use in the AWIPS2 system.
|
||||
|
@ -68,7 +70,7 @@ public class NcUairToRecord {
|
|||
HDR_PARAMS_LIST = sb.toString();
|
||||
}
|
||||
|
||||
public static final String MAN_PARAMS_LIST;
|
||||
public static final String AA_ONLY_PARAMS_LIST;
|
||||
static {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(HDR_PARAMS_LIST);
|
||||
|
@ -80,7 +82,22 @@ public class NcUairToRecord {
|
|||
sb.append("TTAA_SPED,");
|
||||
sb.append("TTAA_HGHT,");
|
||||
// -------------------------
|
||||
sb.append("numTTBB,");
|
||||
sb.append("numXXAA,");
|
||||
sb.append("XXAA_PRES,");
|
||||
sb.append("XXAA_TEMP,");
|
||||
sb.append("XXAA_DWPT,");
|
||||
sb.append("XXAA_DRCT,");
|
||||
sb.append("XXAA_SPED,");
|
||||
sb.append("XXAA_HGHT");
|
||||
AA_ONLY_PARAMS_LIST = sb.toString();
|
||||
}
|
||||
|
||||
public static final String MAN_PARAMS_LIST;
|
||||
static {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(AA_ONLY_PARAMS_LIST);
|
||||
// -------------------------
|
||||
sb.append(",numTTBB,");
|
||||
sb.append("TTBB_PRES,");
|
||||
sb.append("TTBB_TEMP,");
|
||||
sb.append("TTBB_DWPT,");
|
||||
|
@ -152,14 +169,6 @@ public class NcUairToRecord {
|
|||
sb.append("TTBB_HI_MEAN_DRCT,");
|
||||
sb.append("TTBB_HI_MEAN_SPED,");
|
||||
// -------------------------
|
||||
sb.append("numXXAA,");
|
||||
sb.append("XXAA_PRES,");
|
||||
sb.append("XXAA_TEMP,");
|
||||
sb.append("XXAA_DWPT,");
|
||||
sb.append("XXAA_DRCT,");
|
||||
sb.append("XXAA_SPED,");
|
||||
sb.append("XXAA_HGHT,");
|
||||
// -------------------------
|
||||
sb.append("numXXBB,");
|
||||
sb.append("XXBB_PRES,");
|
||||
sb.append("XXBB_TEMP,");
|
||||
|
|
|
@ -238,7 +238,7 @@ public class MergeSounding2 implements ISerializableObject {
|
|||
sndata.clear();
|
||||
sndata.add(sl);
|
||||
// System.out
|
||||
// .println("return manatory level without merging!");
|
||||
// .println("return mandatory level without merging!");
|
||||
// printOut(sndata);
|
||||
return sndata;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,9 @@ package gov.noaa.nws.ncep.edex.uengine.tasks.profile;
|
|||
* 06/25/2014 Chin Chen support dropsonde
|
||||
* 07/23/2014 Chin Chen Support PW
|
||||
* 08/26/2014 Chin Chen index out of bound bug
|
||||
* 10/03/2014 B. Hebbard Performance improvement: Pass level and pwRequired params to
|
||||
* ObservedSoundingQuery.getObservedSndNcUairDataGeneric( ) so
|
||||
* it can decide whether it can economize on DB params it needs
|
||||
* </pre>
|
||||
* Python Script example to query multiple locations at one request:
|
||||
* The following 3 query examples, returns same results.
|
||||
|
@ -1107,7 +1110,7 @@ public class NcSoundingDrv {
|
|||
long t003 = System.currentTimeMillis();
|
||||
uairRecordArrList = ObservedSoundingQuery
|
||||
.getObservedSndNcUairDataGeneric(coordinateArray, stnIdArr,
|
||||
rangeTimeStringLst, rangeTimeArr);
|
||||
rangeTimeStringLst, rangeTimeArr, level, pwRequired);
|
||||
long t004 = System.currentTimeMillis();
|
||||
System.out.println("getObservedSndNcUairDataGeneric query took "
|
||||
+ (t004 - t003) + "ms");
|
||||
|
@ -1442,8 +1445,9 @@ public class NcSoundingDrv {
|
|||
// }
|
||||
|
||||
returnedObject = cube;
|
||||
// long t02 = System.currentTimeMillis();
|
||||
// System.out.println("getSoundingData2Generic query took "+(t02-t01)+" ms in total");
|
||||
long t02 = System.currentTimeMillis();
|
||||
System.out.println("getSoundingData2Generic query took " + (t02 - t01)
|
||||
+ " ms in total");
|
||||
|
||||
return returnedObject;
|
||||
}
|
||||
|
@ -1470,18 +1474,23 @@ public class NcSoundingDrv {
|
|||
}
|
||||
|
||||
List<NcUairRecord[]> uairRecordArrList;
|
||||
// long t003 = System.currentTimeMillis();
|
||||
long t003 = System.currentTimeMillis();
|
||||
uairRecordArrList = ObservedSoundingQuery
|
||||
.getObservedSndNcUairDataGeneric(coordinateArray, stnIdArr,
|
||||
rangeTimeStringLst, rangeTimeArr);
|
||||
// long t004 = System.currentTimeMillis();
|
||||
// System.out.println("getObservedSndNcUairDataGeneric API call took "+(t004-t003)+"ms");
|
||||
rangeTimeStringLst, rangeTimeArr, level, pwRequired);
|
||||
long t004 = System.currentTimeMillis();
|
||||
System.out.println("getObservedSndNcUairDataGeneric API call took "
|
||||
+ (t004 - t003) + "ms");
|
||||
if (uairRecordArrList != null && uairRecordArrList.size() > 0) {
|
||||
// long t005 = System.currentTimeMillis();
|
||||
long t005 = System.currentTimeMillis();
|
||||
soundingProfileList = processQueryReturnedNcUairData(
|
||||
uairRecordArrList, useNcSoundingLayer2);
|
||||
// long t006 = System.currentTimeMillis();
|
||||
// System.out.println("getSoundingDataGeneric total sounding time merging for "+uairRecordArrList.size()+" profiles took "+(t006-t005)+"ms");
|
||||
long t006 = System.currentTimeMillis();
|
||||
System.out
|
||||
.println("getSoundingDataGeneric total sounding time merging for "
|
||||
+ uairRecordArrList.size()
|
||||
+ " profiles took "
|
||||
+ (t006 - t005) + "ms");
|
||||
}
|
||||
|
||||
} else if (sndType.equals(PfcSndType.NAMSND.toString())
|
||||
|
|
|
@ -67,6 +67,9 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Jul 19, 2013 1992 bsteffen Remove redundant time columns from bufrua.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* June, 2014 Chin Chen Retrieved observed sounding with reftime
|
||||
* Oct 03, 2014 B. Hebbard Performance improvement: getObservedSndNcUairDataGeneric( )
|
||||
* limits DB param set to retrieve, in cases where possible
|
||||
* (mandatory level and no PW-for-full-sounding)
|
||||
* </pre>
|
||||
*
|
||||
* @author Chin Chen
|
||||
|
@ -949,7 +952,8 @@ public class ObservedSoundingQuery {
|
|||
*/
|
||||
public static List<NcUairRecord[]> getObservedSndNcUairDataGeneric(
|
||||
Coordinate[] coordArray, String[] stnIdArray,
|
||||
List<String> soundingTimeStrList, long[] soundTimeLongArr) {
|
||||
List<String> soundingTimeStrList, long[] soundTimeLongArr,
|
||||
String level, int pwRequired) {
|
||||
// List<NcSoundingProfile> soundingProfileList= new
|
||||
// ArrayList<NcSoundingProfile>();
|
||||
PointDataQuery request = null;
|
||||
|
@ -963,8 +967,31 @@ public class ObservedSoundingQuery {
|
|||
boolean queryByStn;
|
||||
try {
|
||||
request = new PointDataQuery("ncuair");
|
||||
// If a mandatory level is being requested, then we
|
||||
// can speed things up significantly by getting only the
|
||||
// TTAA/XXAA parameters from the datastore. Exceptions
|
||||
// to this are made (a) if we need precipitable water for
|
||||
// the entire sounding whose algorithm requires all data
|
||||
// types, OR (b) we're only requesting data for a single
|
||||
// station (as for Cloud Height) in which case performance
|
||||
// isn't an issue.
|
||||
boolean multipleStationsRequested = (coordArray != null && coordArray.length > 1)
|
||||
|| (stnIdArray != null && stnIdArray.length > 1);
|
||||
if (isMandatoryLevel(level) && pwRequired == 0
|
||||
&& multipleStationsRequested) {
|
||||
request.setParameters(NcUairToRecord.AA_ONLY_PARAMS_LIST);
|
||||
// ...otherwise, we'd better grab the whole set
|
||||
} else {
|
||||
request.setParameters(NcUairToRecord.MAN_PARAMS_LIST);
|
||||
}
|
||||
request.addParameter("nil", String.valueOf(false), "=");
|
||||
// The following may look wasteful if we only need one level,
|
||||
// but requesting a specific level (1) requires spelling out
|
||||
// parameters to which it applies, and more importantly
|
||||
// (2) saves NO time on the resulting IDataStore request,
|
||||
// because all levels are retrieved there anyway(!). See note
|
||||
// in PointDataPluginDao.getPointData( ): "...for now, we
|
||||
// will retrieve all levels and then post-process the result"
|
||||
request.requestAllLevels();
|
||||
String d = "";
|
||||
for (String timeStr : soundingTimeStrList) {
|
||||
|
@ -1006,8 +1033,10 @@ public class ObservedSoundingQuery {
|
|||
long t001 = System.currentTimeMillis();
|
||||
result = request.execute();
|
||||
long t002 = System.currentTimeMillis();
|
||||
// totalRqTime=totalRqTime+(t002-t001);
|
||||
// System.out.println("getObservedSndNcUairDataGeneric data query alone took "+(t002-t001)+"ms");
|
||||
// totalRqTime = totalRqTime + (t002 - t001);
|
||||
System.out
|
||||
.println("getObservedSndNcUairDataGeneric data query alone took "
|
||||
+ (t002 - t001) + "ms");
|
||||
|
||||
if (result != null) {
|
||||
long t003 = System.currentTimeMillis();
|
||||
|
@ -1181,7 +1210,8 @@ public class ObservedSoundingQuery {
|
|||
.add(pickedUairRecords
|
||||
.toArray(new NcUairRecord[pickedUairRecords
|
||||
.size()]));
|
||||
// System.out.println("getObservedSndNcUairDataGeneric Number of records in PF="
|
||||
// System.out
|
||||
// .println("getObservedSndNcUairDataGeneric Number of records in PF="
|
||||
// + pickedUairRecords.size());
|
||||
}
|
||||
}
|
||||
|
@ -1189,16 +1219,36 @@ public class ObservedSoundingQuery {
|
|||
|
||||
}
|
||||
long t004 = System.currentTimeMillis();
|
||||
// System.out.println(" sorting return records took "+(t004-t003)+"ms");
|
||||
System.out.println(" sorting return records took "
|
||||
+ (t004 - t003) + "ms");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// System.out.println("getObservedSndNcUairDataGeneric Number profiles (record[]s) in finalRecordArrayList="+finalRecordArrayList.size());
|
||||
// System.out
|
||||
// .println("getObservedSndNcUairDataGeneric Number profiles (record[]s) in finalRecordArrayList="
|
||||
// + finalRecordArrayList.size());
|
||||
return finalRecordArrayList;
|
||||
}
|
||||
|
||||
private static boolean isMandatoryLevel(String level) {
|
||||
if (level == null) {
|
||||
return false;
|
||||
}
|
||||
// alternate: final String mandatoryLevels =
|
||||
// ".surface.1000.925.850.700.500.400.300.250.200.150.100.mb";
|
||||
// return mandatoryLevels.contains/* IgnoreCase */("." + level + ".");
|
||||
final String[] mandatoryLevels = { /* "surface", */"1000", "925",
|
||||
"850", "700", "500", "400", "300", "250", "200", "150", "100" };
|
||||
for (String s : mandatoryLevels) {
|
||||
if (s.equals/* IgnoreCase */(level)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* This method query ONE station's specific one dataType data only
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue