updates from dev baseline master_18.1.1
This commit is contained in:
parent
50ac8032f9
commit
821523c859
4 changed files with 105 additions and 27 deletions
|
@ -89,6 +89,8 @@ import com.vividsolutions.jts.geom.GeometryFactory;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 24, 2009 2258 mpduff Initial creation.
|
||||
* Mar 14, 2017 18417 snaples Updated loadData to handle trace precip color mapping properly.
|
||||
* Sep 04, 2018 20694 mporricelli Updated loadData and updateXmrg to properly
|
||||
* display trace precip.
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
|
@ -367,12 +369,21 @@ public class XmrgResource extends
|
|||
}
|
||||
}
|
||||
sampleData = new ArrayList<Float>(data.length);
|
||||
|
||||
for (short s : data) {
|
||||
float f = (float) Math.floor(cvt.convert(s));
|
||||
buf.put(f);
|
||||
// mm/100 to inch
|
||||
sampleData.add(s * 0.03937f / 100);
|
||||
// Map <0 and 0 to the first two color segments of the color scale, respectively
|
||||
if (s < 0) {
|
||||
buf.put(0.0f);
|
||||
sampleData.add(0.0f);
|
||||
} else if (s == 0) {
|
||||
buf.put(1.0f);
|
||||
sampleData.add(0.0f);
|
||||
} else {
|
||||
// Map values >0 to appropriate color bar segment
|
||||
float f = (float) Math.floor(cvt.convert(s));
|
||||
buf.put(f);
|
||||
// mm/100 to inch
|
||||
sampleData.add(s * 0.03937f / 100);
|
||||
}
|
||||
}
|
||||
buf.rewind();
|
||||
|
||||
|
@ -408,15 +419,13 @@ public class XmrgResource extends
|
|||
buf = FloatBuffer.allocate(data.length);
|
||||
sampleData = new ArrayList<Float>(data.length);
|
||||
for (short s : data) {
|
||||
// Map <0 and 0 to the first two color segments of the color scale, respectively
|
||||
if (s < 0) {
|
||||
buf.put(0.0f);
|
||||
sampleData.add(0.0f);
|
||||
} else if (s > 0 && s < 25) {
|
||||
short ns = 10;
|
||||
float f = (short) cvt.convert(ns);
|
||||
buf.put(f);
|
||||
// mm/100 to inch
|
||||
sampleData.add(s * 0.03937f / 100);
|
||||
} else if (s == 0) {
|
||||
buf.put(1.0f);
|
||||
sampleData.add(0.0f);
|
||||
} else {
|
||||
float f = (float) Math.floor(cvt.convert(s));
|
||||
buf.put(f);
|
||||
|
@ -621,9 +630,22 @@ public class XmrgResource extends
|
|||
data = xmrg.getData();
|
||||
}
|
||||
buf = FloatBuffer.allocate(data.length);
|
||||
sampleData = new ArrayList<Float>(data.length);
|
||||
for (short s : data) {
|
||||
float f = (float) Math.floor(cvt.convert(s));
|
||||
buf.put(f);
|
||||
// Map <0 and 0 to the first two color segments of the color scale, respectively
|
||||
if (s < 0) {
|
||||
buf.put(0.0f);
|
||||
sampleData.add(0.0f);
|
||||
} else if (s == 0){
|
||||
buf.put(1.0f);
|
||||
sampleData.add(0.0f);
|
||||
} else {
|
||||
// Map values >0 to appropriate color bar segment
|
||||
float f = (float) Math.floor(cvt.convert(s));
|
||||
buf.put(f);
|
||||
// mm/100 to inch
|
||||
sampleData.add(s * 0.03937f / 100);
|
||||
}
|
||||
}
|
||||
buf.rewind();
|
||||
Rectangle extent = xmrg.getHrapExtent();
|
||||
|
|
|
@ -106,6 +106,7 @@
|
|||
# 04/03/2018 DR20656 arivera Missing comma: "Dune Erosion Probability" in optionalParmsDict['marine']
|
||||
# 05/09/2018 DR20715 arivera Missing comma: groups['marineSites'] after 'AVAK'
|
||||
# 06/18/2018 16729 ryu Remove tpHPC element from RFCQPF model and the smart init for the model.
|
||||
# 09/04/2018 20874 wkwock Haines and Fosberg are 6 hours accumulative.
|
||||
#
|
||||
####################################################################################################
|
||||
|
||||
|
@ -2893,7 +2894,8 @@ modelDict['NamDNG'] = {
|
|||
modelDict['NationalBlend'] = {
|
||||
'D2DAccumulativeElements': ["pop12hr", "pop", "pop6hr", "tp", "ppi1hr", "ppi6hr",
|
||||
"tp1hr", "tp6hr", "thp3hr", "thp6hr",
|
||||
"totsn1hr", "totsn6hr", "ficeac1hr", "ficeac6hr"],
|
||||
"totsn1hr", "totsn6hr", "ficeac1hr", "ficeac6hr",
|
||||
"TstmPrb12", "Haines", "FosBerg"],
|
||||
'D2DMODELS': 'NationalBlend',
|
||||
'DB': ('NationalBlend', 'GRID', '', NO, NO, 7, 0),
|
||||
'INITMODULES': 'NationalBlend',
|
||||
|
@ -2903,11 +2905,10 @@ modelDict['NationalBlend'] = {
|
|||
([SnowLevel,MaxTwAloft,ProbIcePresent, ProbRefreezeSleet,SnowRatio],TC1),
|
||||
([PositiveEnergyAloft, NegativeEnergyLowLevel],TC1),
|
||||
([MixHgt, TransWind, LLWS, VentRate, LLWSHgt, Radar,
|
||||
SigWaveHgt, Weather, Haines, FosBerg,
|
||||
SnowAmt01, IceAccum01, TstmPrb1],TC1),
|
||||
SigWaveHgt, Weather, SnowAmt01, IceAccum01, TstmPrb1],TC1),
|
||||
([TstmPrb3, DryTstmPrb],TC3NG),
|
||||
([TstmPrb6, QPF, PoP6, PPI06, SnowAmt, IceAccum,
|
||||
QPF10Prcntl, QPF50Prcntl, QPF90Prcntl],TC6NG),
|
||||
QPF10Prcntl, QPF50Prcntl, QPF90Prcntl, Haines, FosBerg],TC6NG),
|
||||
([MaxT], MaxTTC), ([MinT], MinTTC),
|
||||
([MaxRH], MaxRHTC), ([MinRH], MinRHTC),([PoP, TstmPrb12],TC12NG),
|
||||
],
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.HashSet;
|
||||
|
@ -80,6 +81,7 @@ import ucar.nc2.grib.grib1.Grib1Record;
|
|||
import ucar.nc2.grib.grib1.Grib1RecordScanner;
|
||||
import ucar.nc2.grib.grib1.Grib1SectionGridDefinition;
|
||||
import ucar.nc2.grib.grib1.Grib1SectionProductDefinition;
|
||||
import ucar.nc2.grib.grib1.tables.Grib1ParamTableReader;
|
||||
import ucar.nc2.grib.grib1.tables.Grib1ParamTables;
|
||||
import ucar.nc2.time.CalendarDate;
|
||||
import ucar.nc2.time.CalendarPeriod.Field;
|
||||
|
@ -113,6 +115,11 @@ import ucar.unidata.io.RandomAccessFile;
|
|||
* Sep 11, 2017 6406 bsteffen Upgrade ucar
|
||||
* Aug 02, 2018 7397 mapeters Fix parameter table lookups so standard
|
||||
* ucar lookups are used
|
||||
* Aug 08, 2018 7397 mapeters Disable default parameter table, provide
|
||||
* default param name for unknown params
|
||||
* (like older ucar version)
|
||||
* Aug 23, 2018 7397 mapeters Fix forecast times for intervals
|
||||
* Sep 11, 2018 7450 tjensen Limit decoding to a single grib record
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
|
@ -143,6 +150,16 @@ public class Grib1Decoder {
|
|||
/** Missing value string */
|
||||
private static final String MISSING = "Missing";
|
||||
|
||||
private static final String UNKNOWN_UNIT = "Unknown";
|
||||
|
||||
/** Format for unknown param, takes paramNumber int and tableName string */
|
||||
private static final String UNKNOWN_PARAM_FORMAT = "UnknownParameter_%d_table_%s";
|
||||
|
||||
/**
|
||||
* Format for unknown table, takes ints: centerid, subcenterid, tableVersion
|
||||
*/
|
||||
private static final String UNKNOWN_TABLE_FORMAT = "Unknown-%d.%d.%d";
|
||||
|
||||
/** Set of Time range types for accumulations and averages */
|
||||
private static final Set<Integer> AVG_ACCUM_LIST = new HashSet<>();
|
||||
|
||||
|
@ -168,6 +185,15 @@ public class Grib1Decoder {
|
|||
"Error reading user parameter tables for ucar grib decoder",
|
||||
e);
|
||||
}
|
||||
/*
|
||||
* The default table is not useful, as it doesn't specify the "name"
|
||||
* field for any of its parameters, which causes decoding to fail. Also,
|
||||
* falling back to it may incorrectly map some parameters. So we clear
|
||||
* its parameters so that we just get a null param when failing to find
|
||||
* it instead of an invalid default param.
|
||||
*/
|
||||
Grib1ParamTables.getDefaultTable()
|
||||
.setParameters(Collections.emptyMap());
|
||||
paramTables = new Grib1ParamTables();
|
||||
}
|
||||
|
||||
|
@ -188,7 +214,11 @@ public class Grib1Decoder {
|
|||
Grib1RecordScanner g1i = new Grib1RecordScanner(raf);
|
||||
|
||||
List<GridRecord> gribRecords = new ArrayList<>();
|
||||
while (g1i.hasNext()) {
|
||||
/*
|
||||
* Limit decoding to a single record, as a decode message should be
|
||||
* processed for each individual record.
|
||||
*/
|
||||
if (g1i.hasNext()) {
|
||||
Grib1Record grib1rec = g1i.next();
|
||||
if (grib1rec == null) {
|
||||
/*
|
||||
|
@ -291,9 +321,12 @@ public class Grib1Decoder {
|
|||
parameterAbbreviation = param.getName();
|
||||
parameterUnit = param.getUnit();
|
||||
} else {
|
||||
parameterAbbreviation = MISSING;
|
||||
parameterName = MISSING;
|
||||
parameterUnit = MISSING;
|
||||
String unknownParam = formatUnknownParamName(centerid,
|
||||
subcenterid, pds.getTableVersion(),
|
||||
pds.getParameterNumber());
|
||||
parameterAbbreviation = unknownParam;
|
||||
parameterName = unknownParam;
|
||||
parameterUnit = UNKNOWN_UNIT;
|
||||
}
|
||||
} else {
|
||||
parameterName = parameter.getName();
|
||||
|
@ -398,9 +431,14 @@ public class Grib1Decoder {
|
|||
}
|
||||
int p1 = convertToSeconds(pds.getTimeValue1(), pds.getTimeUnit());
|
||||
int p2 = convertToSeconds(pds.getTimeValue2(), pds.getTimeUnit());
|
||||
int forecastTime = convertToSeconds(
|
||||
new Grib1ParamTime(null, pds).getForecastTime(),
|
||||
pds.getTimeUnit());
|
||||
Grib1ParamTime paramTime = new Grib1ParamTime(null, pds);
|
||||
/*
|
||||
* getForecastTime() is only valid for non-interval times, otherwise
|
||||
* forecastTime is the end of the [start,end] interval
|
||||
*/
|
||||
int forecastTime = paramTime.isInterval() ? paramTime.getInterval()[1]
|
||||
: paramTime.getForecastTime();
|
||||
forecastTime = convertToSeconds(forecastTime, pds.getTimeUnit());
|
||||
|
||||
DataTime dataTime = constructDataTime(refTime, forecastTime,
|
||||
getTimeInformation(refTime, pds.getTimeRangeIndicator(), p1,
|
||||
|
@ -581,6 +619,24 @@ public class Grib1Decoder {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
private static String formatUnknownParamName(int centerid, int subcenterid,
|
||||
int tableVersion, int paramNumber) {
|
||||
Grib1ParamTableReader table = paramTables.getParameterTable(centerid,
|
||||
subcenterid, tableVersion);
|
||||
String tableName;
|
||||
if (table.getPath()
|
||||
.equals(Grib1ParamTables.getDefaultTable().getPath())) {
|
||||
// Failed to find in a valid table, format name for unknown table
|
||||
tableName = String.format(UNKNOWN_TABLE_FORMAT, centerid,
|
||||
subcenterid, tableVersion);
|
||||
} else {
|
||||
tableName = table.getName();
|
||||
}
|
||||
String unknownParam = String.format(UNKNOWN_PARAM_FORMAT, paramNumber,
|
||||
tableName);
|
||||
return unknownParam;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resizes a 1-D data array into a 2-D array based on the provided row and
|
||||
* column count
|
||||
|
@ -1331,8 +1387,7 @@ public class Grib1Decoder {
|
|||
if ((scaleFactor1 == 0) || (value1 == 0)) {
|
||||
levelOneValue = value1;
|
||||
} else {
|
||||
levelOneValue = new Double(
|
||||
(float) (value1 * Math.pow(10, scaleFactor1 * -1)));
|
||||
levelOneValue = (float) (value1 * Math.pow(10, scaleFactor1 * -1));
|
||||
}
|
||||
|
||||
levelTwoValue = levelOneValue;
|
||||
|
|
|
@ -654,9 +654,9 @@ CIn_NBM-NCEP-MDL NBE
|
|||
PRBCLDICE-9.999e+18%_NBM-NCEP-MDL PrbCldIce
|
||||
PRBCLDICE0.0%_NBM-NCEP-MDL PrbCldIce
|
||||
GeH_NBM-NCEP-MDL LLWSHgt
|
||||
DRYTPROB0.0%_NBM-NCEP-MDL DRYTPPROB
|
||||
// NBM publishes this, it is marked SREF because NBM doesn't change it.
|
||||
ThP0.0%_SREF-NCEP-MDL_2345x1597_10800-0 ThP3hr
|
||||
DRYTPROB0.0%_SREF-NCEP-SPC DRYTPPROB3hr
|
||||
//END NationalBLend
|
||||
|
||||
// HREF
|
||||
|
|
Loading…
Add table
Reference in a new issue