Issue #189 convert sounding/cloudheight to grid.
Former-commit-id:4743e17c7a
[formerlyb67376efc9
] [formerly a4785c76f3aca3cebb1695a95303640da136f1ee [formerly7544986f1f
]] [formerly7efbc19f81
[formerly7544986f1f
[formerly 4a95bbc65642b688d67fb67faf8d76aed10d2f7c]]] Former-commit-id:7efbc19f81
Former-commit-id: ed881aecf24caceed39537661892630d05de175a [formerly2f43572682
] Former-commit-id:6e033f7043
This commit is contained in:
parent
3557427a09
commit
e3409fc614
6 changed files with 50 additions and 82 deletions
|
@ -10,16 +10,6 @@ Eclipse-BuddyPolicy: ext, global
|
|||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
com.raytheon.uf.common.pointdata,
|
||||
com.raytheon.uf.common.serialization;bundle-version="1.11.17",
|
||||
com.raytheon.uf.common.localization;bundle-version="1.11.17",
|
||||
com.raytheon.uf.common.status;bundle-version="1.11.17",
|
||||
com.raytheon.uf.viz.core;bundle-version="1.11.17",
|
||||
com.raytheon.uf.viz.sounding;bundle-version="1.11.17",
|
||||
com.raytheon.uf.common.time;bundle-version="1.11.17",
|
||||
com.raytheon.uf.common.geospatial;bundle-version="1.11.17",
|
||||
org.geotools;bundle-version="2.5.8",
|
||||
com.raytheon.edex.meteolib;bundle-version="1.11.17",
|
||||
com.raytheon.uf.common.dataplugin;bundle-version="1.11.17",
|
||||
com.raytheon.uf.viz.d2d.core;bundle-version="1.11.17",
|
||||
com.raytheon.viz.ui;bundle-version="1.11.17",
|
||||
com.raytheon.viz.skewt;bundle-version="1.11.17",
|
||||
|
@ -28,9 +18,9 @@ Require-Bundle: org.eclipse.ui,
|
|||
com.raytheon.uf.common.sounding;bundle-version="1.0.0",
|
||||
javax.measure;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.dataplugin.grib;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.dataplugin.satellite;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.dataplugin.grid;bundle-version="1.0.0"
|
||||
com.raytheon.uf.common.dataplugin.grid;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.parameter;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.raytheon.uf.viz.cloudheight,
|
||||
|
|
|
@ -31,7 +31,8 @@ import org.eclipse.core.runtime.Status;
|
|||
import org.eclipse.core.runtime.jobs.Job;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.grib.GribRecord;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridConstants;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.dataplugin.grid.dataset.DatasetInfo;
|
||||
import com.raytheon.uf.common.dataplugin.grid.dataset.DatasetInfoLookup;
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
|
@ -57,7 +58,7 @@ import com.raytheon.viz.core.map.GeoUtil;
|
|||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
* Grib model cloud height sounding implementation
|
||||
* Grid model cloud height sounding implementation
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -76,6 +77,12 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
public class ModelCloudHeightSourceImplementation extends
|
||||
AbstractCloudHeightSourceImpl {
|
||||
|
||||
private static final String PARAM_TEMP = "T";
|
||||
|
||||
private static final String PARAM_DEWPOINT = "DpT";
|
||||
|
||||
private static final String PARAM_HEIGHT = "GH";
|
||||
|
||||
private Map<DataTime, VerticalSounding[]> soundingMap = new HashMap<DataTime, VerticalSounding[]>();
|
||||
|
||||
private Job hdf5Job = null;
|
||||
|
@ -100,8 +107,7 @@ public class ModelCloudHeightSourceImplementation extends
|
|||
for (PluginDataObject pdo : objects) {
|
||||
float[] data = (float[]) pdo.getMessageData();
|
||||
if (data != null) {
|
||||
Double level = ((GribRecord) pdo).getModelInfo()
|
||||
.getLevelOneValue();
|
||||
Double level = ((GridRecord) pdo).getLevel().getLevelonevalue();
|
||||
SoundingLayer layer = layerMap.get(level);
|
||||
if (layer == null) {
|
||||
layer = new SoundingLayer();
|
||||
|
@ -110,14 +116,14 @@ public class ModelCloudHeightSourceImplementation extends
|
|||
}
|
||||
|
||||
float val = data[index];
|
||||
String param = ((GribRecord) pdo).getModelInfo()
|
||||
.getParameterAbbreviation();
|
||||
String param = ((GridRecord) pdo).getParameter()
|
||||
.getAbbreviation();
|
||||
|
||||
if ("T".equals(param)) {
|
||||
if (PARAM_TEMP.equals(param)) {
|
||||
layer.setTemperature(val);
|
||||
} else if ("GH".equals(param)) {
|
||||
} else if (PARAM_HEIGHT.equals(param)) {
|
||||
layer.setGeoHeight(val);
|
||||
} else if ("DpT".equals(param)) {
|
||||
} else if (PARAM_DEWPOINT.equals(param)) {
|
||||
layer.setDewpoint(val);
|
||||
}
|
||||
}
|
||||
|
@ -142,20 +148,21 @@ public class ModelCloudHeightSourceImplementation extends
|
|||
@Override
|
||||
protected HashMap<String, RequestConstraint> constructMetadataMap() {
|
||||
HashMap<String, RequestConstraint> requestMap = new HashMap<String, RequestConstraint>();
|
||||
requestMap.put("pluginName", new RequestConstraint("grib"));
|
||||
requestMap.put("modelInfo.modelName",
|
||||
requestMap.put(GridConstants.PLUGIN_NAME, new RequestConstraint(
|
||||
GridConstants.GRID));
|
||||
requestMap.put(GridConstants.DATASET_ID,
|
||||
new RequestConstraint(source.getName()));
|
||||
|
||||
RequestConstraint params = new RequestConstraint();
|
||||
params.setConstraintType(ConstraintType.IN);
|
||||
params.addToConstraintValueList("T");
|
||||
params.addToConstraintValueList("GH");
|
||||
params.addToConstraintValueList("DpT");
|
||||
requestMap.put("modelInfo.parameterAbbreviation", params);
|
||||
requestMap.put("modelInfo.level.masterLevel.name",
|
||||
new RequestConstraint("MB"));
|
||||
requestMap.put("modelInfo.level.leveltwovalue", new RequestConstraint(
|
||||
Level.getInvalidLevelValueAsString()));
|
||||
params.addToConstraintValueList(PARAM_TEMP);
|
||||
params.addToConstraintValueList(PARAM_HEIGHT);
|
||||
params.addToConstraintValueList(PARAM_DEWPOINT);
|
||||
requestMap.put(GridConstants.PARAMETER_ABBREVIATION, params);
|
||||
requestMap.put(GridConstants.MASTER_LEVEL_NAME, new RequestConstraint(
|
||||
"MB"));
|
||||
requestMap.put(GridConstants.LEVEL_TWO,
|
||||
new RequestConstraint(Level.getInvalidLevelValueAsString()));
|
||||
return requestMap;
|
||||
}
|
||||
|
||||
|
@ -170,7 +177,7 @@ public class ModelCloudHeightSourceImplementation extends
|
|||
protected synchronized VerticalSounding createSoundingInternal(
|
||||
Coordinate latLon, final DataTime time,
|
||||
final PluginDataObject[] pdos) {
|
||||
GribRecord pdo = (GribRecord) pdos[0];
|
||||
GridRecord pdo = (GridRecord) pdos[0];
|
||||
|
||||
final ISpatialObject spatial = pdo.getSpatialObject();
|
||||
|
||||
|
|
|
@ -7,43 +7,30 @@ Bundle-Activator: com.raytheon.uf.viz.sounding.Activator
|
|||
Bundle-Vendor: RAYTHEON
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
javax.measure;bundle-version="1.0.0",
|
||||
org.geotools;bundle-version="2.5.2",
|
||||
com.raytheon.edex.common;bundle-version="1.11.17",
|
||||
com.raytheon.uf.common.dataplugin.grib;bundle-version="1.11.17",
|
||||
com.raytheon.uf.common.sounding;bundle-version="1.0.0"
|
||||
com.raytheon.uf.common.sounding;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.dataplugin.grid;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.topo;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.parameter;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.raytheon.uf.viz.sounding,
|
||||
com.raytheon.uf.viz.sounding.adapters
|
||||
Import-Package: com.raytheon.edex.meteoLib,
|
||||
com.raytheon.edex.plugin.modelsounding.common,
|
||||
com.raytheon.edex.scriptfactory,
|
||||
com.raytheon.edex.util,
|
||||
com.raytheon.uf.common.dataplugin,
|
||||
com.raytheon.uf.common.dataplugin.acarssounding,
|
||||
com.raytheon.uf.common.dataplugin.bufrua,
|
||||
com.raytheon.uf.common.dataplugin.goessounding,
|
||||
com.raytheon.uf.common.dataplugin.grib,
|
||||
com.raytheon.uf.common.dataplugin.level,
|
||||
com.raytheon.uf.common.dataplugin.poessounding,
|
||||
com.raytheon.uf.common.dataplugin.profiler,
|
||||
com.raytheon.uf.common.geospatial,
|
||||
com.raytheon.uf.common.menus,
|
||||
com.raytheon.uf.common.menus.xml,
|
||||
com.raytheon.uf.common.pointdata,
|
||||
com.raytheon.uf.common.pointdata.spatial,
|
||||
com.raytheon.uf.common.serialization,
|
||||
com.raytheon.uf.common.status,
|
||||
com.raytheon.uf.common.time,
|
||||
com.raytheon.uf.common.topo,
|
||||
com.raytheon.uf.viz.acarssounding,
|
||||
com.raytheon.uf.viz.core.catalog,
|
||||
com.raytheon.uf.viz.core.datastructure,
|
||||
com.raytheon.uf.viz.core.exception,
|
||||
com.raytheon.uf.viz.core.status,
|
||||
com.raytheon.uf.viz.core.topo,
|
||||
com.raytheon.uf.viz.ui.menus,
|
||||
com.raytheon.viz.core.map,
|
||||
com.raytheon.viz.core.slice,
|
||||
com.raytheon.viz.core.slice.request,
|
||||
com.raytheon.viz.pointdata
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.grib.GribRecord;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.datastorage.Request;
|
||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
import com.raytheon.uf.common.geospatial.ISpatialObject;
|
||||
|
@ -49,7 +49,7 @@ import com.raytheon.viz.core.map.GeoUtil;
|
|||
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||
|
||||
/**
|
||||
* Sounding adapter for grib data, used for both skewt and cloud height sampling
|
||||
* Sounding adapter for grid data, used for cloud height sampling
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -64,9 +64,9 @@ import com.vividsolutions.jts.geom.GeometryFactory;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GribSoundingAdapter extends AbstractVerticalSoundingAdapter {
|
||||
public class GridSoundingAdapter extends AbstractVerticalSoundingAdapter {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(GribSoundingAdapter.class);
|
||||
.getHandler(GridSoundingAdapter.class);
|
||||
|
||||
/** Interface for getting point information */
|
||||
private IPointSounding pointSounding;
|
||||
|
@ -84,7 +84,7 @@ public class GribSoundingAdapter extends AbstractVerticalSoundingAdapter {
|
|||
* Object which will provide information on point location and
|
||||
* name
|
||||
*/
|
||||
public GribSoundingAdapter(IPointSounding pointSounding) {
|
||||
public GridSoundingAdapter(IPointSounding pointSounding) {
|
||||
this.pointSounding = pointSounding;
|
||||
soundingMap = new HashMap<DataTime, Map<Double, SoundingLayer>>();
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public class GribSoundingAdapter extends AbstractVerticalSoundingAdapter {
|
|||
long t0 = System.currentTimeMillis();
|
||||
List<VerticalSounding> soundings = new ArrayList<VerticalSounding>();
|
||||
try {
|
||||
GribRecord sampleRecord = (GribRecord) objects[0];
|
||||
GridRecord sampleRecord = (GridRecord) objects[0];
|
||||
ISpatialObject spatial = sampleRecord.getSpatialObject();
|
||||
Point point = PointUtil.determineIndex(
|
||||
pointSounding.getCoordinate(), spatial.getCrs(),
|
||||
|
@ -113,10 +113,9 @@ public class GribSoundingAdapter extends AbstractVerticalSoundingAdapter {
|
|||
"Point is outside bounds of grid"));
|
||||
return new VerticalSounding[0];
|
||||
}
|
||||
String name = String.format("%s pt%s %s", sampleRecord
|
||||
.getModelInfo().getModelTitle(), pointSounding
|
||||
.getPointName(), GeoUtil.formatCoordinate(pointSounding
|
||||
.getCoordinate()));
|
||||
String name = String.format("%s pt%s %s",
|
||||
sampleRecord.getDatasetId(), pointSounding.getPointName(),
|
||||
GeoUtil.formatCoordinate(pointSounding.getCoordinate()));
|
||||
location = new SurfaceObsLocation(name);
|
||||
location.setGeometry(new GeometryFactory()
|
||||
.createPoint(pointSounding.getCoordinate()));
|
||||
|
@ -134,18 +133,9 @@ public class GribSoundingAdapter extends AbstractVerticalSoundingAdapter {
|
|||
if (rec != null && rec.length > 0) {
|
||||
float[] data = (float[]) rec[0].getDataObject();
|
||||
float val = data[0];
|
||||
addToSoundingMap((GribRecord) pdo, val);
|
||||
addToSoundingMap((GridRecord) pdo, val);
|
||||
}
|
||||
}
|
||||
double rotation = 0;
|
||||
if ((sampleRecord.getResCompFlags() == null)
|
||||
|| (sampleRecord.getResCompFlags() & 8) != 0) {
|
||||
rotation = 180 - MapUtil.rotation(
|
||||
pointSounding.getCoordinate(),
|
||||
sampleRecord.getSpatialObject());
|
||||
}
|
||||
float sinRot = (float) Math.sin(Math.toRadians(rotation));
|
||||
float cosRot = (float) Math.cos(Math.toRadians(rotation));
|
||||
for (DataTime time : soundingMap.keySet()) {
|
||||
VerticalSounding sounding = new VerticalSounding();
|
||||
sounding.setDataTime(time);
|
||||
|
@ -156,12 +146,6 @@ public class GribSoundingAdapter extends AbstractVerticalSoundingAdapter {
|
|||
sounding.setStationId(location.getStationId());
|
||||
Map<Double, SoundingLayer> layerMap = soundingMap.get(time);
|
||||
for (SoundingLayer layer : layerMap.values()) {
|
||||
float u = layer.getWindU();
|
||||
float v = layer.getWindV();
|
||||
float vTemp = (u * sinRot) + (v * cosRot);
|
||||
u = (u * cosRot) - (v * sinRot);
|
||||
layer.setWindU(u);
|
||||
layer.setWindV(vTemp);
|
||||
sounding.addLayer(layer);
|
||||
}
|
||||
|
||||
|
@ -213,7 +197,7 @@ public class GribSoundingAdapter extends AbstractVerticalSoundingAdapter {
|
|||
* @param dataVal
|
||||
* @throws VizException
|
||||
*/
|
||||
private void addToSoundingMap(GribRecord record, float dataVal)
|
||||
private void addToSoundingMap(GridRecord record, float dataVal)
|
||||
throws VizException {
|
||||
DataTime dt = record.getDataTime();
|
||||
Map<Double, SoundingLayer> layerMap = soundingMap.get(dt);
|
||||
|
@ -222,14 +206,14 @@ public class GribSoundingAdapter extends AbstractVerticalSoundingAdapter {
|
|||
soundingMap.put(dt, layerMap);
|
||||
}
|
||||
|
||||
Double l1val = record.getModelInfo().getLevelOneValue();
|
||||
Double l1val = record.getLevel().getLevelonevalue();
|
||||
SoundingLayer layer = layerMap.get(l1val);
|
||||
if (layer == null) {
|
||||
layer = new SoundingLayer();
|
||||
layer.setPressure(l1val.floatValue());
|
||||
layerMap.put(l1val, layer);
|
||||
}
|
||||
String param = record.getModelInfo().getParameterAbbreviation();
|
||||
String param = record.getParameter().getAbbreviation();
|
||||
|
||||
if ("T".equals(param)) {
|
||||
layer.setTemperature(dataVal);
|
|
@ -219,7 +219,7 @@ public class InterpUtils {
|
|||
val += (1 - Math.abs(x1 - x)) * (1 - Math.abs(y1 - y))
|
||||
* val11;
|
||||
} else {
|
||||
missing -= Math.abs((x1 - x) * (y1 - y));
|
||||
missing -= (1 - Math.abs(x1 - x)) * (1 - Math.abs(y1 - y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
|||
import com.raytheon.uf.common.sounding.adapter.AbstractVerticalSoundingAdapter;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.sounding.adapters.GribSoundingAdapter;
|
||||
import com.raytheon.uf.viz.sounding.adapters.GridSoundingAdapter;
|
||||
import com.raytheon.uf.viz.sounding.adapters.IPointSounding;
|
||||
import com.raytheon.viz.skewt.rsc.SkewTResource;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
@ -66,7 +66,7 @@ public class GribSoundingSkewTResourceData extends SkewTResourceData implements
|
|||
@Override
|
||||
protected SkewTResource constructResource(LoadProperties loadProperties,
|
||||
PluginDataObject[] objects) throws VizException {
|
||||
AbstractVerticalSoundingAdapter adapter = new GribSoundingAdapter(this);
|
||||
AbstractVerticalSoundingAdapter adapter = new GridSoundingAdapter(this);
|
||||
adapter.setObjects(objects);
|
||||
this.soundings = adapter.createSoundings();
|
||||
SkewTResource rsc = new SkewTResource(this, loadProperties);
|
||||
|
|
Loading…
Add table
Reference in a new issue