mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
add create trajectory layer functions in DrawMeteoData class
This commit is contained in:
parent
57bee7404c
commit
ee8a2f1769
13
.idea/libraries/Maven__org_freehep_freehep_util_2_0_2.xml
generated
Normal file
13
.idea/libraries/Maven__org_freehep_freehep_util_2_0_2.xml
generated
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.freehep:freehep-util:2.0.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/freehep/freehep-util/2.0.2/freehep-util-2.0.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/freehep/freehep-util/2.0.2/freehep-util-2.0.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/freehep/freehep-util/2.0.2/freehep-util-2.0.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
@ -1,13 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.jogamp.gluegen:gluegen-rt:natives-android-aarch64:2.3.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jogamp/gluegen/gluegen-rt/2.3.2/gluegen-rt-2.3.2-natives-android-aarch64.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jogamp/gluegen/gluegen-rt/2.3.2/gluegen-rt-2.3.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jogamp/gluegen/gluegen-rt/2.3.2/gluegen-rt-2.3.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.freehep:freehep-util:2.0.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/freehep/freehep-util/2.0.2/freehep-util-2.0.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/freehep/freehep-util/2.0.2/freehep-util-2.0.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/freehep/freehep-util/2.0.2/freehep-util-2.0.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
@ -13,6 +13,7 @@
|
||||
*/
|
||||
package org.meteoinfo.data.meteodata;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.Period;
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
package org.meteoinfo.data.meteodata;
|
||||
|
||||
import org.meteoinfo.table.DataTable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ITrajDataInfo {
|
||||
|
||||
/**
|
||||
* Get DataTable list
|
||||
* @return DataTable list
|
||||
*/
|
||||
public abstract List<DataTable> getDataTables();
|
||||
|
||||
/**
|
||||
* Get TrajectoryInfo list
|
||||
* @return TrajectoryInfo list
|
||||
*/
|
||||
public abstract List<TrajectoryInfo> getTrajInfoList();
|
||||
|
||||
/**
|
||||
* Get X coordinate variable name
|
||||
* @return X coordinate variable name
|
||||
*/
|
||||
public abstract String getXVarName();
|
||||
|
||||
/**
|
||||
* Get Y coordinate variable name
|
||||
* @return Y coordinate variable name
|
||||
*/
|
||||
public abstract String getYVarName();
|
||||
|
||||
/**
|
||||
* Get Z coordinate variable name
|
||||
* @return Z coordinate variable name
|
||||
*/
|
||||
public abstract String getZVarName();
|
||||
|
||||
/**
|
||||
* Get time coordinate variable name
|
||||
* @return Time coordinate variable name
|
||||
*/
|
||||
public abstract String getTVarName();
|
||||
|
||||
/**
|
||||
* Get variables
|
||||
* @return Variables
|
||||
*/
|
||||
public abstract List<Variable> getVariables();
|
||||
|
||||
}
|
||||
@ -11,7 +11,7 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
|
||||
* General Public License for more details.
|
||||
*/
|
||||
package org.meteoinfo.data.meteodata.hysplit;
|
||||
package org.meteoinfo.data.meteodata;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@ -774,7 +774,7 @@ public class Variable {
|
||||
* @param reverse If is reverse
|
||||
*/
|
||||
public void setDimension(String tstr, List<Number> values, boolean reverse) {
|
||||
DimensionType dType = DimensionType.Other;
|
||||
DimensionType dType = DimensionType.OTHER;
|
||||
switch (tstr) {
|
||||
case "X":
|
||||
dType = DimensionType.X;
|
||||
@ -804,7 +804,7 @@ public class Variable {
|
||||
* @param reverse If is reverse
|
||||
*/
|
||||
public void setDimension(String tstr, List<Number> values, boolean reverse, int index) {
|
||||
DimensionType dType = DimensionType.Other;
|
||||
DimensionType dType = DimensionType.OTHER;
|
||||
switch (tstr) {
|
||||
case "X":
|
||||
dType = DimensionType.X;
|
||||
@ -835,7 +835,7 @@ public class Variable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aDim.getDimType() == DimensionType.Other) {
|
||||
if (aDim.getDimType() == DimensionType.OTHER) {
|
||||
this.addDimension(aDim);
|
||||
} else {
|
||||
boolean hasDim = false;
|
||||
@ -922,7 +922,7 @@ public class Variable {
|
||||
public boolean hasXtrackDimension() {
|
||||
boolean has = false;
|
||||
for (int i = 0; i < getDimNumber(); i++) {
|
||||
if (((Dimension) this.getDimension(i)).getDimType() == DimensionType.Xtrack) {
|
||||
if (((Dimension) this.getDimension(i)).getDimType() == DimensionType.X_TRACK) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
@ -1048,7 +1048,7 @@ public class Variable {
|
||||
if (this.getDimNumber() > var.getDimNumber()) {
|
||||
for (int i = var.getDimNumber(); i < this.getDimNumber(); i++) {
|
||||
Dimension dim = (Dimension) this.getDimension(i);
|
||||
if (dim.getDimType() == DimensionType.Other) {
|
||||
if (dim.getDimType() == DimensionType.OTHER) {
|
||||
return dim;
|
||||
}
|
||||
}
|
||||
@ -1152,7 +1152,7 @@ public class Variable {
|
||||
* @param values Dimension values
|
||||
*/
|
||||
public void addDimension(String tstr, List<Number> values) {
|
||||
DimensionType dType = DimensionType.Other;
|
||||
DimensionType dType = DimensionType.OTHER;
|
||||
switch (tstr) {
|
||||
case "X":
|
||||
dType = DimensionType.X;
|
||||
|
||||
@ -342,7 +342,7 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
|
||||
VarList.add("LastRow");
|
||||
VarList.add("LastCol");
|
||||
VarList.add("BrightTemp");
|
||||
Dimension stdim = new Dimension(DimensionType.Other);
|
||||
Dimension stdim = new Dimension(DimensionType.OTHER);
|
||||
double[] values = new double[this._numDataRecord];
|
||||
stdim.setValues(values);
|
||||
this.addDimension(stdim);
|
||||
|
||||
@ -80,7 +80,7 @@ import org.meteoinfo.data.meteodata.Attribute;
|
||||
this.bandNum = this.geoTiff.getBandNum();
|
||||
Dimension bDim = null;
|
||||
if (this.bandNum > 1){
|
||||
bDim = new Dimension(DimensionType.Other);
|
||||
bDim = new Dimension(DimensionType.OTHER);
|
||||
bDim.setValues(new double[this.bandNum]);
|
||||
this.addDimension(bDim);
|
||||
}
|
||||
|
||||
@ -16,10 +16,7 @@ package org.meteoinfo.data.meteodata.hysplit;
|
||||
import org.meteoinfo.common.DataConvert;
|
||||
import org.meteoinfo.common.PointD;
|
||||
import org.meteoinfo.common.util.JDateUtil;
|
||||
import org.meteoinfo.data.meteodata.Attribute;
|
||||
import org.meteoinfo.data.meteodata.DataInfo;
|
||||
import org.meteoinfo.data.meteodata.MeteoDataType;
|
||||
import org.meteoinfo.data.meteodata.Variable;
|
||||
import org.meteoinfo.data.meteodata.*;
|
||||
import org.meteoinfo.ndarray.Dimension;
|
||||
import org.meteoinfo.ndarray.DimensionType;
|
||||
|
||||
@ -50,7 +47,7 @@ import org.meteoinfo.ndarray.Section;
|
||||
*
|
||||
* @author yaqiang
|
||||
*/
|
||||
public class HYSPLITTrajDataInfo extends DataInfo {
|
||||
public class HYSPLITTrajDataInfo extends DataInfo implements ITrajDataInfo {
|
||||
|
||||
// <editor-fold desc="Variables">
|
||||
/// <summary>
|
||||
@ -73,7 +70,7 @@ public class HYSPLITTrajDataInfo extends DataInfo {
|
||||
/// <summary>
|
||||
/// Information list of trajectories
|
||||
/// </summary>
|
||||
public List<TrajectoryInfo> trajInfos;
|
||||
private List<TrajectoryInfo> trajInfoList;
|
||||
/// <summary>
|
||||
/// Number of variables
|
||||
/// </summary>
|
||||
@ -96,17 +93,43 @@ public class HYSPLITTrajDataInfo extends DataInfo {
|
||||
}
|
||||
|
||||
private void initVariables() {
|
||||
trajInfos = new ArrayList<>();
|
||||
trajInfoList = new ArrayList<>();
|
||||
varNames = new ArrayList<>();
|
||||
trajNum = 0;
|
||||
inVarNames = new String[]{"time", "run_hour", "lat", "lon", "height"};
|
||||
}
|
||||
// </editor-fold>
|
||||
// <editor-fold desc="Get Set Methods">
|
||||
@Override
|
||||
public String getXVarName() {
|
||||
return "lon";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getYVarName() {
|
||||
return "lat";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getZVarName() {
|
||||
return "height";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTVarName() {
|
||||
return "time";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TrajectoryInfo> getTrajInfoList() {
|
||||
return this.trajInfoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data table list
|
||||
* @return Data table list
|
||||
*/
|
||||
@Override
|
||||
public List<DataTable> getDataTables(){
|
||||
return this.dataTables;
|
||||
}
|
||||
@ -162,7 +185,7 @@ public class HYSPLITTrajDataInfo extends DataInfo {
|
||||
aTrajInfo.startLat = Float.parseFloat(dataArray[4]);
|
||||
aTrajInfo.startLon = Float.parseFloat(dataArray[5]);
|
||||
aTrajInfo.startHeight = Float.parseFloat(dataArray[6]);
|
||||
trajInfos.add(aTrajInfo);
|
||||
trajInfoList.add(aTrajInfo);
|
||||
}
|
||||
Dimension tdim = new Dimension(DimensionType.T);
|
||||
tdim.setValues(times);
|
||||
@ -176,20 +199,7 @@ public class HYSPLITTrajDataInfo extends DataInfo {
|
||||
for (i = 0; i < varNum; i++) {
|
||||
varNames.add(dataArray[i + 1]);
|
||||
}
|
||||
//Trajectory end point number
|
||||
// endPointNum = 0;
|
||||
// while (true) {
|
||||
// aLine = sr.readLine();
|
||||
// if (aLine == null) {
|
||||
// break;
|
||||
// }
|
||||
// if (aLine.isEmpty()) {
|
||||
// continue;
|
||||
// }
|
||||
// endPointNum += 1;
|
||||
// }
|
||||
sr.close();
|
||||
//endPointNum = endPointNum / this.trajNum;
|
||||
|
||||
//Read data table list
|
||||
this.dataTables = this.readTable();
|
||||
@ -201,11 +211,11 @@ public class HYSPLITTrajDataInfo extends DataInfo {
|
||||
}
|
||||
|
||||
//Dimensions
|
||||
Dimension trajDim = new Dimension(DimensionType.Other);
|
||||
Dimension trajDim = new Dimension(DimensionType.OTHER);
|
||||
trajDim.setName("trajectory");
|
||||
trajDim.setLength(this.trajNum);
|
||||
this.addDimension(trajDim);
|
||||
Dimension obsDim = new Dimension(DimensionType.Other);
|
||||
Dimension obsDim = new Dimension(DimensionType.OTHER);
|
||||
obsDim.setName("obs");
|
||||
obsDim.setLength(this.endPointNum);
|
||||
this.addDimension(obsDim);
|
||||
@ -214,6 +224,17 @@ public class HYSPLITTrajDataInfo extends DataInfo {
|
||||
for (String vName : this.inVarNames) {
|
||||
Variable var = new Variable();
|
||||
var.setName(vName);
|
||||
switch (vName) {
|
||||
case "time":
|
||||
var.setDataType(DataType.DATE);
|
||||
break;
|
||||
case "run_hour":
|
||||
var.setDataType(DataType.INT);
|
||||
break;
|
||||
default:
|
||||
var.setDataType(DataType.FLOAT);
|
||||
break;
|
||||
}
|
||||
var.addDimension(trajDim);
|
||||
var.addDimension(obsDim);
|
||||
var.addAttribute("long_name", vName);
|
||||
@ -222,6 +243,7 @@ public class HYSPLITTrajDataInfo extends DataInfo {
|
||||
for (String vName : this.varNames) {
|
||||
Variable var = new Variable();
|
||||
var.setName(vName);
|
||||
var.setDataType(DataType.FLOAT);
|
||||
var.addDimension(trajDim);
|
||||
var.addDimension(obsDim);
|
||||
var.addAttribute("long_name", vName);
|
||||
@ -271,7 +293,7 @@ public class HYSPLITTrajDataInfo extends DataInfo {
|
||||
}
|
||||
dataInfo += System.getProperty("line.separator") + System.getProperty("line.separator") + "Trajectories:";
|
||||
DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:00");
|
||||
for (TrajectoryInfo aTrajInfo : trajInfos) {
|
||||
for (TrajectoryInfo aTrajInfo : trajInfoList) {
|
||||
dataInfo += System.getProperty("line.separator") + " " + format.format(aTrajInfo.startTime)
|
||||
+ " " + String.valueOf(aTrajInfo.startLat) + " " + String.valueOf(aTrajInfo.startLon)
|
||||
+ " " + String.valueOf(aTrajInfo.startHeight);
|
||||
@ -371,7 +393,7 @@ public class HYSPLITTrajDataInfo extends DataInfo {
|
||||
}
|
||||
|
||||
try {
|
||||
BufferedReader sr = new BufferedReader(new FileReader(new File(this.getFileName())));
|
||||
BufferedReader sr = new BufferedReader(new FileReader(this.getFileName()));
|
||||
String aLine;
|
||||
String[] dataArray, tempArray;
|
||||
int i;
|
||||
|
||||
@ -121,7 +121,7 @@ public class MDFSDataInfo extends DataInfo implements IGridDataInfo, IStationDat
|
||||
zDim.setValues(new float[]{level});
|
||||
this.setZDimension(zDim);
|
||||
this.addDimension(zDim);
|
||||
Dimension stDim = new Dimension(DimensionType.Other);
|
||||
Dimension stDim = new Dimension(DimensionType.OTHER);
|
||||
stDim.setName("station");
|
||||
float[] values = new float[numStation];
|
||||
for (int i = 0; i < numStation; i++) {
|
||||
|
||||
@ -122,7 +122,7 @@ public class MICAPS120DataInfo extends DataInfo implements IStationDataInfo {
|
||||
stNum += 1;
|
||||
}
|
||||
|
||||
Dimension stdim = new Dimension(DimensionType.Other);
|
||||
Dimension stdim = new Dimension(DimensionType.OTHER);
|
||||
stdim.setShortName("station");
|
||||
values = new double[stNum];
|
||||
for (int i = 0; i < stNum; i++){
|
||||
|
||||
@ -141,7 +141,7 @@ public class MICAPS1DataInfo extends DataInfo implements IStationDataInfo {
|
||||
_stNum = Integer.parseInt(dataArray[0]);
|
||||
}
|
||||
}
|
||||
Dimension stdim = new Dimension(DimensionType.Other);
|
||||
Dimension stdim = new Dimension(DimensionType.OTHER);
|
||||
stdim.setShortName("station");
|
||||
values = new double[_stNum];
|
||||
for (int i = 0; i < _stNum; i++) {
|
||||
|
||||
@ -128,7 +128,7 @@ public class MICAPS2DataInfo extends DataInfo implements IStationDataInfo {
|
||||
Dimension zdim = new Dimension(DimensionType.Z);
|
||||
zdim.setValues(new double[]{level});
|
||||
this.setZDimension(zdim);
|
||||
Dimension stdim = new Dimension(DimensionType.Other);
|
||||
Dimension stdim = new Dimension(DimensionType.OTHER);
|
||||
stdim.setShortName("station");
|
||||
values = new double[stNum];
|
||||
for (i = 0; i < stNum; i++){
|
||||
|
||||
@ -140,7 +140,7 @@ public class MICAPS3DataInfo extends DataInfo implements IStationDataInfo {
|
||||
}
|
||||
|
||||
stNum = _dataList.size();
|
||||
Dimension stdim = new Dimension(DimensionType.Other);
|
||||
Dimension stdim = new Dimension(DimensionType.OTHER);
|
||||
stdim.setShortName("station");
|
||||
double[] values = new double[stNum];
|
||||
for (i = 0; i < stNum; i++){
|
||||
|
||||
@ -1,347 +1,470 @@
|
||||
/* Copyright 2012 Yaqiang Wang,
|
||||
* yaqiang.wang@gmail.com
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
|
||||
* General Public License for more details.
|
||||
*/
|
||||
package org.meteoinfo.data.meteodata.micaps;
|
||||
* yaqiang.wang@gmail.com
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
|
||||
* General Public License for more details.
|
||||
*/
|
||||
package org.meteoinfo.data.meteodata.micaps;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.meteoinfo.common.PointD;
|
||||
import org.meteoinfo.common.util.JDateUtil;
|
||||
import org.meteoinfo.data.meteodata.Attribute;
|
||||
import org.meteoinfo.data.meteodata.DataInfo;
|
||||
import org.meteoinfo.data.meteodata.MeteoDataType;
|
||||
import org.meteoinfo.data.meteodata.Variable;
|
||||
import org.meteoinfo.data.meteodata.hysplit.TrajectoryInfo;
|
||||
import org.meteoinfo.ndarray.Dimension;
|
||||
import org.meteoinfo.ndarray.DimensionType;
|
||||
import org.meteoinfo.ndarray.Array;
|
||||
import org.meteoinfo.common.PointD;
|
||||
import org.meteoinfo.common.util.JDateUtil;
|
||||
import org.meteoinfo.data.meteodata.*;
|
||||
import org.meteoinfo.data.meteodata.hysplit.HYSPLITTrajDataInfo;
|
||||
import org.meteoinfo.data.meteodata.TrajectoryInfo;
|
||||
import org.meteoinfo.ndarray.*;
|
||||
import org.meteoinfo.table.ColumnData;
|
||||
import org.meteoinfo.table.DataColumn;
|
||||
import org.meteoinfo.table.DataTable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author yaqiang
|
||||
*/
|
||||
public class MICAPS7DataInfo extends DataInfo {
|
||||
* @author yaqiang
|
||||
*/
|
||||
public class MICAPS7DataInfo extends DataInfo implements ITrajDataInfo {
|
||||
|
||||
// <editor-fold desc="Variables">
|
||||
public List<String> FileNames;
|
||||
/// <summary>
|
||||
/// Number of meteorological files
|
||||
/// </summary>
|
||||
public List<Integer> MeteoFileNums;
|
||||
/// <summary>
|
||||
/// Number of trajectories
|
||||
/// </summary>
|
||||
public int TrajeoryNumber;
|
||||
/// <summary>
|
||||
/// Number of trajectories
|
||||
/// </summary>
|
||||
public List<Integer> TrajeoryNums;
|
||||
/// <summary>
|
||||
/// Trajectory direction - foreward or backward
|
||||
/// </summary>
|
||||
public List<String> TrajDirections;
|
||||
/// <summary>
|
||||
/// Vertical motion
|
||||
/// </summary>
|
||||
public List<String> VerticalMotions;
|
||||
/// <summary>
|
||||
/// Information list of trajectories
|
||||
/// </summary>
|
||||
public List<List<TrajectoryInfo>> TrajInfos;
|
||||
/// <summary>
|
||||
/// Number of variables
|
||||
/// </summary>
|
||||
public List<Integer> VarNums;
|
||||
/// <summary>
|
||||
/// Variable name list
|
||||
/// </summary>
|
||||
public List<List<String>> VarNames;
|
||||
// </editor-fold>
|
||||
// <editor-fold desc="Constructor">
|
||||
// <editor-fold desc="Variables">
|
||||
// Number of trajectories
|
||||
private int trajNum;
|
||||
// Information list of trajectories
|
||||
private List<TrajectoryInfo> trajInfoList;
|
||||
private String[] varNames;
|
||||
private int pointNum;
|
||||
private List<DataTable> dataTables;
|
||||
private String[] inVarNames;
|
||||
// </editor-fold>
|
||||
// <editor-fold desc="Constructor">
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public MICAPS7DataInfo() {
|
||||
this.setDataType(MeteoDataType.MICAPS_7);
|
||||
initVariables();
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public MICAPS7DataInfo() {
|
||||
this.setDataType(MeteoDataType.MICAPS_7);
|
||||
initVariables();
|
||||
}
|
||||
|
||||
private void initVariables() {
|
||||
FileNames = new ArrayList<>();
|
||||
MeteoFileNums = new ArrayList<>();
|
||||
TrajeoryNums = new ArrayList<>();
|
||||
TrajDirections = new ArrayList<>();
|
||||
VerticalMotions = new ArrayList<>();
|
||||
TrajInfos = new ArrayList<>();
|
||||
VarNums = new ArrayList<>();
|
||||
VarNames = new ArrayList<>();
|
||||
TrajeoryNumber = 0;
|
||||
}
|
||||
// </editor-fold>
|
||||
// <editor-fold desc="Get Set Methods">
|
||||
// </editor-fold>
|
||||
// <editor-fold desc="Methods">
|
||||
private void initVariables() {
|
||||
varNames = new String[]{"time", "run_hour", "lon", "lat", "wind_speed", "pressure", "radius_7",
|
||||
"radius_10", "move_dir", "move_speed"};
|
||||
inVarNames = new String[]{"time", "run_hour", "lon", "lat"};
|
||||
}
|
||||
// </editor-fold>
|
||||
// <editor-fold desc="Get Set Methods">
|
||||
|
||||
@Override
|
||||
public void readDataInfo(String fileName) {
|
||||
String[] trajFiles = new String[1];
|
||||
trajFiles[0] = fileName;
|
||||
try {
|
||||
readDataInfo(trajFiles);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MICAPS7DataInfo.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getXVarName() {
|
||||
return "lon";
|
||||
}
|
||||
|
||||
public void readDataInfo(String[] trajFiles) throws IOException {
|
||||
this.setFileName(trajFiles[0]);
|
||||
String aLine;
|
||||
String[] dataArray;
|
||||
int t;
|
||||
@Override
|
||||
public String getYVarName() {
|
||||
return "lat";
|
||||
}
|
||||
|
||||
initVariables();
|
||||
List<Double> times = new ArrayList<>();
|
||||
@Override
|
||||
public String getZVarName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (t = 0; t < trajFiles.length; t++) {
|
||||
String aFile = trajFiles[t];
|
||||
FileNames.add(aFile);
|
||||
@Override
|
||||
public String getTVarName() {
|
||||
return "time";
|
||||
}
|
||||
|
||||
BufferedReader sr = new BufferedReader(new FileReader(new File(aFile)));
|
||||
@Override
|
||||
public List<TrajectoryInfo> getTrajInfoList() {
|
||||
return this.trajInfoList;
|
||||
}
|
||||
|
||||
TrajectoryInfo aTrajInfo = new TrajectoryInfo();
|
||||
List<TrajectoryInfo> trajInfoList = new ArrayList<>();
|
||||
sr.readLine();
|
||||
aLine = sr.readLine();
|
||||
int trajIdx = -1;
|
||||
int trajNum = 0;
|
||||
while (aLine != null) {
|
||||
if (aLine.trim().isEmpty()) {
|
||||
aLine = sr.readLine();
|
||||
continue;
|
||||
}
|
||||
/**
|
||||
* Get data table list
|
||||
*
|
||||
* @return Data table list
|
||||
*/
|
||||
@Override
|
||||
public List<DataTable> getDataTables() {
|
||||
return this.dataTables;
|
||||
}
|
||||
// </editor-fold>
|
||||
// <editor-fold desc="Methods">
|
||||
|
||||
dataArray = aLine.split("\\s+");
|
||||
if (dataArray.length == 4) {
|
||||
aTrajInfo = new TrajectoryInfo();
|
||||
aTrajInfo.trajName = dataArray[0];
|
||||
aTrajInfo.trajID = dataArray[1];
|
||||
aTrajInfo.trajCenter = dataArray[2];
|
||||
trajIdx = -1;
|
||||
trajNum += 1;
|
||||
} else if (dataArray.length == 13) {
|
||||
trajIdx += 1;
|
||||
if (trajIdx == 0) {
|
||||
int year = Integer.parseInt(dataArray[0]);
|
||||
if (year < 100) {
|
||||
if (year < 50) {
|
||||
year = 2000 + year;
|
||||
} else {
|
||||
year = 1900 + year;
|
||||
}
|
||||
}
|
||||
LocalDateTime tt = LocalDateTime.of(year, Integer.parseInt(dataArray[1]),
|
||||
Integer.parseInt(dataArray[2]), Integer.parseInt(dataArray[3]), 0, 0);
|
||||
if (times.isEmpty()) {
|
||||
times.add(JDateUtil.toOADate(tt));
|
||||
}
|
||||
@Override
|
||||
public void readDataInfo(String fileName) {
|
||||
this.setFileName(fileName);
|
||||
String aLine;
|
||||
String[] dataArray;
|
||||
int t;
|
||||
|
||||
aTrajInfo.startTime = tt;
|
||||
aTrajInfo.startLat = Float.parseFloat(dataArray[6]);
|
||||
aTrajInfo.startLon = Float.parseFloat(dataArray[5]);
|
||||
trajInfoList.add(aTrajInfo);
|
||||
}
|
||||
}
|
||||
aLine = sr.readLine();
|
||||
}
|
||||
TrajeoryNums.add(trajNum);
|
||||
TrajeoryNumber += TrajeoryNums.get(t);
|
||||
TrajInfos.add(trajInfoList);
|
||||
initVariables();
|
||||
List<Double> times = new ArrayList<>();
|
||||
this.pointNum = 0;
|
||||
int pn;
|
||||
|
||||
Dimension tdim = new Dimension(DimensionType.T);
|
||||
tdim.setValues(times);
|
||||
this.setTimeDimension(tdim);
|
||||
BufferedReader sr = null;
|
||||
try {
|
||||
sr = new BufferedReader(new FileReader(fileName));
|
||||
|
||||
sr.close();
|
||||
this.trajInfoList = new ArrayList<>();
|
||||
TrajectoryInfo aTrajInfo = new TrajectoryInfo();
|
||||
sr.readLine();
|
||||
aLine = sr.readLine();
|
||||
int trajIdx = -1;
|
||||
this.trajNum = 0;
|
||||
while (aLine != null) {
|
||||
if (aLine.trim().isEmpty()) {
|
||||
aLine = sr.readLine();
|
||||
continue;
|
||||
}
|
||||
|
||||
Variable var = new Variable();
|
||||
var.setName("Traj");
|
||||
var.setStation(true);
|
||||
var.setDimension(tdim);
|
||||
List<Variable> variables = new ArrayList<>();
|
||||
variables.add(var);
|
||||
this.setVariables(variables);
|
||||
dataArray = aLine.split("\\s+");
|
||||
if (dataArray.length == 4) {
|
||||
aTrajInfo = new TrajectoryInfo();
|
||||
aTrajInfo.trajName = dataArray[0];
|
||||
aTrajInfo.trajID = dataArray[1];
|
||||
aTrajInfo.trajCenter = dataArray[2];
|
||||
pn = Integer.parseInt(dataArray[3]);
|
||||
if (this.pointNum < pn)
|
||||
this.pointNum = pn;
|
||||
trajIdx = -1;
|
||||
trajNum += 1;
|
||||
} else if (dataArray.length == 13) {
|
||||
trajIdx += 1;
|
||||
if (trajIdx == 0) {
|
||||
int year = Integer.parseInt(dataArray[0]);
|
||||
if (year < 100) {
|
||||
if (year < 50) {
|
||||
year = 2000 + year;
|
||||
} else {
|
||||
year = 1900 + year;
|
||||
}
|
||||
}
|
||||
LocalDateTime tt = LocalDateTime.of(year, Integer.parseInt(dataArray[1]),
|
||||
Integer.parseInt(dataArray[2]), Integer.parseInt(dataArray[3]), 0, 0);
|
||||
if (times.isEmpty()) {
|
||||
times.add(JDateUtil.toOADate(tt));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get global attributes
|
||||
* @return Global attributes
|
||||
*/
|
||||
@Override
|
||||
public List<Attribute> getGlobalAttributes(){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
aTrajInfo.startTime = tt;
|
||||
aTrajInfo.startLat = Float.parseFloat(dataArray[6]);
|
||||
aTrajInfo.startLon = Float.parseFloat(dataArray[5]);
|
||||
trajInfoList.add(aTrajInfo);
|
||||
}
|
||||
}
|
||||
aLine = sr.readLine();
|
||||
}
|
||||
sr.close();
|
||||
|
||||
@Override
|
||||
public String generateInfoText() {
|
||||
String dataInfo = "";
|
||||
for (int t = 0; t < FileNames.size(); t++) {
|
||||
dataInfo += "File Name: " + FileNames.get(t);
|
||||
dataInfo += System.getProperty("line.separator") + "Typhoon number = " + String.valueOf(TrajeoryNums.get(t));
|
||||
dataInfo += System.getProperty("line.separator") + System.getProperty("line.separator") + "Typhoons:";
|
||||
DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:00");
|
||||
for (TrajectoryInfo aTrajInfo : TrajInfos.get(t)) {
|
||||
dataInfo += System.getProperty("line.separator") + " " + aTrajInfo.trajName + " "
|
||||
+ aTrajInfo.trajID + " " + aTrajInfo.trajCenter + " " + format.format(aTrajInfo.startTime)
|
||||
+ " " + String.valueOf(aTrajInfo.startLat) + " " + String.valueOf(aTrajInfo.startLon)
|
||||
+ " " + String.valueOf(aTrajInfo.startHeight);
|
||||
}
|
||||
//Dimensions
|
||||
Dimension trajDim = new Dimension(DimensionType.OTHER);
|
||||
trajDim.setName("trajectory");
|
||||
trajDim.setLength(trajNum);
|
||||
this.addDimension(trajDim);
|
||||
Dimension obsDim = new Dimension(DimensionType.OTHER);
|
||||
obsDim.setName("obs");
|
||||
obsDim.setLength(this.pointNum);
|
||||
this.addDimension(obsDim);
|
||||
|
||||
if (t < FileNames.size() - 1) {
|
||||
dataInfo += System.getProperty("line.separator") + System.getProperty("line.separator")
|
||||
+ "******************************" + System.getProperty("line.separator");
|
||||
}
|
||||
}
|
||||
//Variables
|
||||
for (String vName : this.varNames) {
|
||||
Variable var = new Variable();
|
||||
var.setName(vName);
|
||||
switch (vName) {
|
||||
case "time":
|
||||
var.setDataType(DataType.DATE);
|
||||
break;
|
||||
case "run_hour":
|
||||
var.setDataType(DataType.INT);
|
||||
break;
|
||||
default:
|
||||
var.setDataType(DataType.FLOAT);
|
||||
break;
|
||||
}
|
||||
var.addDimension(trajDim);
|
||||
var.addDimension(obsDim);
|
||||
var.addAttribute("long_name", vName);
|
||||
if (!Arrays.asList(this.inVarNames).contains(vName))
|
||||
var.setStation(true);
|
||||
this.addVariable(var);
|
||||
}
|
||||
|
||||
return dataInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read array data of a variable
|
||||
*
|
||||
* @param varName Variable name
|
||||
* @return Array data
|
||||
*/
|
||||
@Override
|
||||
public Array read(String varName){
|
||||
Variable var = this.getVariable(varName);
|
||||
int n = var.getDimNumber();
|
||||
int[] origin = new int[n];
|
||||
int[] size = new int[n];
|
||||
int[] stride = new int[n];
|
||||
for (int i = 0; i < n; i++){
|
||||
origin[i] = 0;
|
||||
size[i] = var.getDimLength(i);
|
||||
stride[i] = 1;
|
||||
}
|
||||
|
||||
Array r = read(varName, origin, size, stride);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read array data of the variable
|
||||
*
|
||||
* @param varName Variable name
|
||||
* @param origin The origin array
|
||||
* @param size The size array
|
||||
* @param stride The stride array
|
||||
* @return Array data
|
||||
*/
|
||||
@Override
|
||||
public Array read(String varName, int[] origin, int[] size, int[] stride) {
|
||||
return null;
|
||||
}
|
||||
//Read tables
|
||||
this.dataTables = this.readTable();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (sr != null) {
|
||||
sr.close();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MICAPS7DataInfo.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a trajectory points data
|
||||
*
|
||||
* @param aTrajIdx The trajectory index
|
||||
* @return A trajectory points data
|
||||
*/
|
||||
public List<List<Object>> getATrajData(int aTrajIdx) {
|
||||
List<List<Object>> trajPointsData = new ArrayList<>();
|
||||
/**
|
||||
* Get global attributes
|
||||
*
|
||||
* @return Global attributes
|
||||
*/
|
||||
@Override
|
||||
public List<Attribute> getGlobalAttributes() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
boolean ifExit = false;
|
||||
for (int t = 0; t < FileNames.size(); t++) {
|
||||
BufferedReader sr = null;
|
||||
try {
|
||||
String aFile = FileNames.get(t);
|
||||
sr = new BufferedReader(new FileReader(new File(aFile)));
|
||||
String aLine;
|
||||
String[] dataArray;
|
||||
//
|
||||
int TrajIdx = -1;
|
||||
PointD aPoint;
|
||||
sr.readLine();
|
||||
aLine = sr.readLine();
|
||||
while (aLine != null) {
|
||||
if (aLine.trim().isEmpty()) {
|
||||
aLine = sr.readLine();
|
||||
continue;
|
||||
}
|
||||
dataArray = aLine.split("\\s+");
|
||||
switch (dataArray.length) {
|
||||
case 4:
|
||||
TrajIdx += 1;
|
||||
if (TrajIdx > aTrajIdx) {
|
||||
ifExit = true;
|
||||
}
|
||||
@Override
|
||||
public String generateInfoText() {
|
||||
String dataInfo = "";
|
||||
dataInfo += "File Name: " + this.fileName;
|
||||
dataInfo += System.getProperty("line.separator") + "Typhoon number = " + String.valueOf(this.trajNum);
|
||||
dataInfo += System.getProperty("line.separator") + System.getProperty("line.separator") + "Typhoons:";
|
||||
DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:00");
|
||||
for (TrajectoryInfo aTrajInfo : this.trajInfoList) {
|
||||
dataInfo += System.getProperty("line.separator") + " " + aTrajInfo.trajName + " "
|
||||
+ aTrajInfo.trajID + " " + aTrajInfo.trajCenter + " " + format.format(aTrajInfo.startTime)
|
||||
+ " " + String.valueOf(aTrajInfo.startLat) + " " + String.valueOf(aTrajInfo.startLon)
|
||||
+ " " + String.valueOf(aTrajInfo.startHeight);
|
||||
}
|
||||
|
||||
break;
|
||||
case 13:
|
||||
if (TrajIdx == aTrajIdx) {
|
||||
List<Object> dList = new ArrayList<>();
|
||||
LocalDateTime tt = LocalDateTime.of(Integer.parseInt(dataArray[0]), Integer.parseInt(dataArray[1]),
|
||||
Integer.parseInt(dataArray[2]), Integer.parseInt(dataArray[3]), 0, 0);
|
||||
aPoint = new PointD();
|
||||
aPoint.X = Double.parseDouble(dataArray[5]);
|
||||
aPoint.Y = Double.parseDouble(dataArray[6]);
|
||||
dList.add(aPoint);
|
||||
dList.add(tt);
|
||||
dList.add(Double.parseDouble(dataArray[7]));
|
||||
dataInfo += System.getProperty("line.separator") + super.generateInfoText();
|
||||
|
||||
trajPointsData.add(dList);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (ifExit) {
|
||||
break;
|
||||
}
|
||||
return dataInfo;
|
||||
}
|
||||
|
||||
aLine = sr.readLine();
|
||||
}
|
||||
sr.close();
|
||||
if (ifExit) {
|
||||
break;
|
||||
}
|
||||
} catch (FileNotFoundException ex) {
|
||||
Logger.getLogger(MICAPS7DataInfo.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MICAPS7DataInfo.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} finally {
|
||||
try {
|
||||
sr.close();
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MICAPS7DataInfo.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Read array data of a variable
|
||||
*
|
||||
* @param varName Variable name
|
||||
* @return Array data
|
||||
*/
|
||||
@Override
|
||||
public Array read(String varName) {
|
||||
int[] origin = new int[]{0, 0};
|
||||
int[] size = new int[]{this.trajNum, this.pointNum};
|
||||
int[] stride = new int[]{1, 1};
|
||||
|
||||
return trajPointsData;
|
||||
}
|
||||
// </editor-fold>
|
||||
}
|
||||
Array r = read(varName, origin, size, stride);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read array data of the variable
|
||||
*
|
||||
* @param varName Variable name
|
||||
* @param origin The origin array
|
||||
* @param size The size array
|
||||
* @param stride The stride array
|
||||
* @return Array data
|
||||
*/
|
||||
@Override
|
||||
public Array read(String varName, int[] origin, int[] size, int[] stride) {
|
||||
try {
|
||||
DataColumn col = this.dataTables.get(0).findColumn(varName);
|
||||
DataType dtype = col.getDataType();
|
||||
switch (col.getDataType()){
|
||||
case DATE:
|
||||
dtype = DataType.DOUBLE;
|
||||
break;
|
||||
}
|
||||
Section section = new Section(origin, size, stride);
|
||||
Array array = Array.factory(dtype, section.getShape());
|
||||
Range trajRange = section.getRange(0);
|
||||
Range obsRange = section.getRange(1);
|
||||
Index index = array.getIndex();
|
||||
for (int trajIdx = trajRange.first(); trajIdx <= trajRange.last(); trajIdx += trajRange.stride()){
|
||||
DataTable dTable = this.dataTables.get(trajIdx);
|
||||
ColumnData colData = dTable.getColumnData(varName);
|
||||
for (int obsIdx = obsRange.first(); obsIdx <= obsRange.last(); obsIdx += obsRange.stride()){
|
||||
if (colData.size() > obsIdx)
|
||||
if (col.getDataType() == DataType.DATE) {
|
||||
array.setObject(index, JDateUtil.toOADate((LocalDateTime) colData.getValue(obsIdx)));
|
||||
} else {
|
||||
array.setObject(index, colData.getValue(obsIdx));
|
||||
}
|
||||
else
|
||||
array.setObject(index, Double.NaN);
|
||||
index.incr();
|
||||
}
|
||||
}
|
||||
|
||||
return array;
|
||||
} catch (InvalidRangeException ex) {
|
||||
Logger.getLogger(HYSPLITTrajDataInfo.class.getName()).log(Level.SEVERE, null, ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read trajectories as data table list.
|
||||
*
|
||||
* @return Data table list
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<DataTable> readTable() throws Exception {
|
||||
List<DataTable> tables = new ArrayList<>();
|
||||
for (int i = 0; i < this.trajNum; i++) {
|
||||
DataTable table = new DataTable();
|
||||
for (Variable variable : this.variables) {
|
||||
table.addColumn(variable.getName(), variable.getDataType());
|
||||
}
|
||||
tables.add(table);
|
||||
}
|
||||
|
||||
try {
|
||||
BufferedReader sr = new BufferedReader(new FileReader(this.getFileName()));
|
||||
String[] dataArray;
|
||||
float v;
|
||||
int trajId = -1;
|
||||
sr.readLine();
|
||||
String line = sr.readLine();
|
||||
while (line != null) {
|
||||
line = line.trim();
|
||||
if (line.isEmpty()) {
|
||||
line = sr.readLine();
|
||||
continue;
|
||||
}
|
||||
dataArray = line.split("\\s+");
|
||||
switch (dataArray.length) {
|
||||
case 4:
|
||||
trajId += 1;
|
||||
break;
|
||||
case 13:
|
||||
DataTable dataTable = tables.get(trajId);
|
||||
dataTable.addRow();
|
||||
int rowIdx = dataTable.getRowCount() - 1;
|
||||
int year = Integer.parseInt(dataArray[0]);
|
||||
if (year < 50)
|
||||
year = 2000 + year;
|
||||
else
|
||||
year = 1900 + year;
|
||||
LocalDateTime tt = LocalDateTime.of(year, Integer.parseInt(dataArray[1]),
|
||||
Integer.parseInt(dataArray[2]), Integer.parseInt(dataArray[3]), 0, 0);
|
||||
int runHour = Integer.parseInt(dataArray[4]);
|
||||
tt = tt.plusHours(runHour);
|
||||
int i = 3;
|
||||
for (String vName : this.varNames) {
|
||||
switch (vName) {
|
||||
case "time":
|
||||
dataTable.setValue(rowIdx, vName, tt);
|
||||
break;
|
||||
case "run_hour":
|
||||
dataTable.setValue(rowIdx, vName, runHour);
|
||||
break;
|
||||
default:
|
||||
v = Float.parseFloat(dataArray[i]);
|
||||
if (v == 9999)
|
||||
v = Float.NaN;
|
||||
dataTable.setValue(rowIdx, vName, v);
|
||||
break;
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
line = sr.readLine();
|
||||
}
|
||||
sr.close();
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(HYSPLITTrajDataInfo.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(HYSPLITTrajDataInfo.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
return tables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a trajectory points data
|
||||
*
|
||||
* @param aTrajIdx The trajectory index
|
||||
* @return A trajectory points data
|
||||
*/
|
||||
public List<List<Object>> getATrajData(int aTrajIdx) {
|
||||
List<List<Object>> trajPointsData = new ArrayList<>();
|
||||
|
||||
boolean ifExit = false;
|
||||
BufferedReader sr = null;
|
||||
try {
|
||||
sr = new BufferedReader(new FileReader(this.fileName));
|
||||
String aLine;
|
||||
String[] dataArray;
|
||||
//
|
||||
int TrajIdx = -1;
|
||||
PointD aPoint;
|
||||
sr.readLine();
|
||||
aLine = sr.readLine();
|
||||
while (aLine != null) {
|
||||
if (aLine.trim().isEmpty()) {
|
||||
aLine = sr.readLine();
|
||||
continue;
|
||||
}
|
||||
dataArray = aLine.split("\\s+");
|
||||
switch (dataArray.length) {
|
||||
case 4:
|
||||
TrajIdx += 1;
|
||||
if (TrajIdx > aTrajIdx) {
|
||||
ifExit = true;
|
||||
}
|
||||
|
||||
break;
|
||||
case 13:
|
||||
if (TrajIdx == aTrajIdx) {
|
||||
List<Object> dList = new ArrayList<>();
|
||||
LocalDateTime tt = LocalDateTime.of(Integer.parseInt(dataArray[0]), Integer.parseInt(dataArray[1]),
|
||||
Integer.parseInt(dataArray[2]), Integer.parseInt(dataArray[3]), 0, 0);
|
||||
aPoint = new PointD();
|
||||
aPoint.X = Double.parseDouble(dataArray[5]);
|
||||
aPoint.Y = Double.parseDouble(dataArray[6]);
|
||||
dList.add(aPoint);
|
||||
dList.add(tt);
|
||||
dList.add(Double.parseDouble(dataArray[7]));
|
||||
|
||||
trajPointsData.add(dList);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (ifExit) {
|
||||
break;
|
||||
}
|
||||
|
||||
aLine = sr.readLine();
|
||||
}
|
||||
sr.close();
|
||||
} catch (FileNotFoundException ex) {
|
||||
Logger.getLogger(MICAPS7DataInfo.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MICAPS7DataInfo.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} finally {
|
||||
try {
|
||||
sr.close();
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MICAPS7DataInfo.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
return trajPointsData;
|
||||
}
|
||||
// </editor-fold>
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ public class NetCDFDataInfo extends DataInfo implements IGridDataInfo, IStationD
|
||||
for (ucar.nc2.Dimension dim : ncDimensions) {
|
||||
Dimension ndim = NCUtil.convertDimension(dim);
|
||||
if (dim.getShortName().equals("nXtrack")) {
|
||||
ndim.setDimType(DimensionType.Xtrack);
|
||||
ndim.setDimType(DimensionType.X_TRACK);
|
||||
}
|
||||
this.dimensions.add(ndim);
|
||||
}
|
||||
@ -363,7 +363,7 @@ public class NetCDFDataInfo extends DataInfo implements IGridDataInfo, IStationD
|
||||
nvar.addDimension(ndim);
|
||||
} else {
|
||||
Dimension ndim = NCUtil.convertDimension(dim);
|
||||
ndim.setDimType(DimensionType.Other);
|
||||
ndim.setDimType(DimensionType.OTHER);
|
||||
nvar.addDimension(ndim);
|
||||
}
|
||||
}
|
||||
@ -1133,7 +1133,7 @@ public class NetCDFDataInfo extends DataInfo implements IGridDataInfo, IStationD
|
||||
continue;
|
||||
}
|
||||
Dimension dim = this.dimensions.get(idx);
|
||||
if (dim.getDimType() != DimensionType.Other) {
|
||||
if (dim.getDimType() != DimensionType.OTHER) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1578,7 +1578,7 @@ public class NetCDFDataInfo extends DataInfo implements IGridDataInfo, IStationD
|
||||
|
||||
private DimensionType getDimType(ucar.nc2.Variable aVar) {
|
||||
String sName;
|
||||
DimensionType dimType = DimensionType.Other;
|
||||
DimensionType dimType = DimensionType.OTHER;
|
||||
if (_fileTypeId.equals("HDF5-EOS")) {
|
||||
sName = aVar.getShortName().toLowerCase();
|
||||
switch (sName) {
|
||||
@ -1618,7 +1618,7 @@ public class NetCDFDataInfo extends DataInfo implements IGridDataInfo, IStationD
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dimType == DimensionType.Other) {
|
||||
if (dimType == DimensionType.OTHER) {
|
||||
if (aVar.findAttributeIgnoreCase("long_name") != null) {
|
||||
ucar.nc2.Attribute axisAtt = aVar.findAttributeIgnoreCase("long_name");
|
||||
sName = axisAtt.getStringValue().trim().toLowerCase();
|
||||
@ -1651,7 +1651,7 @@ public class NetCDFDataInfo extends DataInfo implements IGridDataInfo, IStationD
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dimType == DimensionType.Other) {
|
||||
if (dimType == DimensionType.OTHER) {
|
||||
if (aVar.findAttributeIgnoreCase("axis") != null) {
|
||||
ucar.nc2.Attribute axisAtt = aVar.findAttributeIgnoreCase("axis");
|
||||
sName = axisAtt.getStringValue().trim().toLowerCase();
|
||||
@ -1671,22 +1671,22 @@ public class NetCDFDataInfo extends DataInfo implements IGridDataInfo, IStationD
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dimType == DimensionType.Other) {
|
||||
if (dimType == DimensionType.OTHER) {
|
||||
if (aVar.findAttributeIgnoreCase("GRIB_level_type") != null) {
|
||||
dimType = DimensionType.Z;
|
||||
}
|
||||
}
|
||||
if (dimType == DimensionType.Other) {
|
||||
if (dimType == DimensionType.OTHER) {
|
||||
if (aVar.findAttributeIgnoreCase("Grib2_level_type") != null) {
|
||||
dimType = DimensionType.Z;
|
||||
}
|
||||
}
|
||||
if (dimType == DimensionType.Other) {
|
||||
if (dimType == DimensionType.OTHER) {
|
||||
if (aVar.findAttributeIgnoreCase("hybrid_layer") != null) {
|
||||
dimType = DimensionType.Z;
|
||||
}
|
||||
}
|
||||
if (dimType == DimensionType.Other) {
|
||||
if (dimType == DimensionType.OTHER) {
|
||||
if (aVar.findAttributeIgnoreCase("unitsCategory") != null) {
|
||||
sName = aVar.findAttributeIgnoreCase("unitsCategory").getStringValue().trim().toLowerCase();
|
||||
switch (sName) {
|
||||
@ -1699,7 +1699,7 @@ public class NetCDFDataInfo extends DataInfo implements IGridDataInfo, IStationD
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dimType == DimensionType.Other) {
|
||||
if (dimType == DimensionType.OTHER) {
|
||||
String vName = aVar.getShortName().toLowerCase();
|
||||
switch (vName) {
|
||||
case "lon":
|
||||
@ -2964,7 +2964,7 @@ public class NetCDFDataInfo extends DataInfo implements IGridDataInfo, IStationD
|
||||
size[i] = 1;
|
||||
}
|
||||
break;
|
||||
case Xtrack:
|
||||
case X_TRACK:
|
||||
origin[i] = levelIdx;
|
||||
size[i] = dim.getLength();
|
||||
break;
|
||||
|
||||
@ -18,9 +18,7 @@ import org.meteoinfo.common.Extent;
|
||||
import org.meteoinfo.common.MIMath;
|
||||
import org.meteoinfo.common.PointD;
|
||||
import org.meteoinfo.data.*;
|
||||
import org.meteoinfo.data.meteodata.StationInfoData;
|
||||
import org.meteoinfo.data.meteodata.StationModel;
|
||||
import org.meteoinfo.data.meteodata.StationModelData;
|
||||
import org.meteoinfo.data.meteodata.*;
|
||||
import org.meteoinfo.dataframe.DataFrame;
|
||||
import org.meteoinfo.geo.drawing.ContourDraw;
|
||||
import org.meteoinfo.geo.drawing.Draw;
|
||||
@ -36,6 +34,7 @@ import org.meteoinfo.ndarray.Array;
|
||||
import org.meteoinfo.ndarray.DataType;
|
||||
import org.meteoinfo.ndarray.IndexIterator;
|
||||
import org.meteoinfo.ndarray.math.ArrayUtil;
|
||||
import org.meteoinfo.table.DataTable;
|
||||
import org.meteoinfo.table.Field;
|
||||
import wcontour.global.PolyLine;
|
||||
import wcontour.global.Polygon;
|
||||
@ -3305,5 +3304,282 @@ public class DrawMeteoData {
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create trajectory line layer
|
||||
* @param trajDataInfo ITrajDataInfo
|
||||
* @return Trajectory line layer
|
||||
*/
|
||||
public static VectorLayer createTrajLineLayer(ITrajDataInfo trajDataInfo) {
|
||||
List<DataTable> dataTables = trajDataInfo.getDataTables();
|
||||
List<TrajectoryInfo> trajInfoList = trajDataInfo.getTrajInfoList();
|
||||
String xVarName = trajDataInfo.getXVarName();
|
||||
String yVarName = trajDataInfo.getYVarName();
|
||||
String zVarName = trajDataInfo.getZVarName();
|
||||
ShapeTypes shapeType = zVarName == null ? ShapeTypes.POLYLINE : ShapeTypes.POLYLINE_Z;
|
||||
|
||||
VectorLayer layer = new VectorLayer(shapeType);
|
||||
layer.editAddField(new Field("TrajIndex", DataType.INT));
|
||||
layer.editAddField(new Field("TrajName", DataType.STRING));
|
||||
layer.editAddField(new Field("TrajID", DataType.STRING));
|
||||
layer.editAddField(new Field("TrajCenter", DataType.STRING));
|
||||
layer.editAddField(new Field("StartDate", DataType.DATE));
|
||||
layer.editAddField(new Field("StartLon", DataType.DOUBLE));
|
||||
layer.editAddField(new Field("StartLat", DataType.DOUBLE));
|
||||
layer.editAddField(new Field("StartHeight", DataType.DOUBLE));
|
||||
|
||||
int trajIdx = 0;
|
||||
if (shapeType == ShapeTypes.POLYLINE) {
|
||||
double x, y;
|
||||
for (DataTable dataTable : dataTables) {
|
||||
TrajectoryInfo trajInfo = trajInfoList.get(trajIdx);
|
||||
List<PointD> points = new ArrayList<>();
|
||||
for (int i = 0; i < dataTable.getRowCount(); i++) {
|
||||
x = Double.parseDouble(dataTable.getValue(i, xVarName).toString());
|
||||
y = Double.parseDouble(dataTable.getValue(i, yVarName).toString());
|
||||
points.add(new PointD(x, y));
|
||||
}
|
||||
PolylineShape polylineShape = new PolylineShape();
|
||||
polylineShape.setPoints(points);
|
||||
int shapeNum = layer.getShapeNum();
|
||||
try {
|
||||
if (layer.editInsertShape(polylineShape, shapeNum)) {
|
||||
layer.editCellValue("TrajIndex", shapeNum, trajIdx + 1);
|
||||
layer.editCellValue("TrajName", shapeNum, trajInfo.trajName);
|
||||
layer.editCellValue("TrajID", shapeNum, trajInfo.trajID);
|
||||
layer.editCellValue("TrajCenter", shapeNum, trajInfo.trajCenter);
|
||||
layer.editCellValue("StartDate", shapeNum, trajInfo.startTime);
|
||||
layer.editCellValue("StartLat", shapeNum, trajInfo.startLat);
|
||||
layer.editCellValue("StartLon", shapeNum, trajInfo.startLon);
|
||||
layer.editCellValue("StartHeight", shapeNum, trajInfo.startHeight);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
trajIdx += 1;
|
||||
}
|
||||
} else {
|
||||
double x, y, z;
|
||||
for (DataTable dataTable : dataTables) {
|
||||
TrajectoryInfo trajInfo = trajInfoList.get(trajIdx);
|
||||
List<PointZ> points = new ArrayList<>();
|
||||
for (int i = 0; i < dataTable.getRowCount(); i++) {
|
||||
x = Double.parseDouble(dataTable.getValue(i, xVarName).toString());
|
||||
y = Double.parseDouble(dataTable.getValue(i, yVarName).toString());
|
||||
z = Double.parseDouble(dataTable.getValue(i, zVarName).toString());
|
||||
points.add(new PointZ(x, y, z));
|
||||
}
|
||||
PolylineZShape polylineShape = new PolylineZShape();
|
||||
polylineShape.setPoints(points);
|
||||
int shapeNum = layer.getShapeNum();
|
||||
try {
|
||||
if (layer.editInsertShape(polylineShape, shapeNum)) {
|
||||
layer.editCellValue("TrajIndex", shapeNum, trajIdx + 1);
|
||||
layer.editCellValue("TrajName", shapeNum, trajInfo.trajName);
|
||||
layer.editCellValue("TrajID", shapeNum, trajInfo.trajID);
|
||||
layer.editCellValue("TrajCenter", shapeNum, trajInfo.trajCenter);
|
||||
layer.editCellValue("StartDate", shapeNum, trajInfo.startTime);
|
||||
layer.editCellValue("StartLat", shapeNum, trajInfo.startLat);
|
||||
layer.editCellValue("StartLon", shapeNum, trajInfo.startLon);
|
||||
layer.editCellValue("StartHeight", shapeNum, trajInfo.startHeight);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
trajIdx += 1;
|
||||
}
|
||||
}
|
||||
|
||||
layer.setLayerName("Trajectory_Lines");
|
||||
layer.setLayerDrawType(LayerDrawType.TRAJECTORY_LINE);
|
||||
layer.setVisible(true);
|
||||
layer.updateLegendScheme(LegendType.UNIQUE_VALUE, "TrajID");
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create trajectory line layer
|
||||
* @param trajDataInfo ITrajDataInfo
|
||||
* @param varName Variation name
|
||||
* @return Trajectory line layer
|
||||
*/
|
||||
public static VectorLayer createTrajLineLayer(ITrajDataInfo trajDataInfo, String varName) {
|
||||
List<DataTable> dataTables = trajDataInfo.getDataTables();
|
||||
List<TrajectoryInfo> trajInfoList = trajDataInfo.getTrajInfoList();
|
||||
String xVarName = trajDataInfo.getXVarName();
|
||||
String yVarName = trajDataInfo.getYVarName();
|
||||
String zVarName = trajDataInfo.getZVarName();
|
||||
|
||||
VectorLayer layer = new VectorLayer(ShapeTypes.POLYLINE_Z);
|
||||
layer.editAddField(new Field("TrajIndex", DataType.INT));
|
||||
layer.editAddField(new Field("TrajName", DataType.STRING));
|
||||
layer.editAddField(new Field("TrajID", DataType.STRING));
|
||||
layer.editAddField(new Field("TrajCenter", DataType.STRING));
|
||||
layer.editAddField(new Field("StartDate", DataType.DATE));
|
||||
layer.editAddField(new Field("StartLon", DataType.DOUBLE));
|
||||
layer.editAddField(new Field("StartLat", DataType.DOUBLE));
|
||||
layer.editAddField(new Field("StartHeight", DataType.DOUBLE));
|
||||
|
||||
int trajIdx = 0;
|
||||
double x, y, z, m;
|
||||
for (DataTable dataTable : dataTables) {
|
||||
TrajectoryInfo trajInfo = trajInfoList.get(trajIdx);
|
||||
List<PointZ> points = new ArrayList<>();
|
||||
for (int i = 0; i < dataTable.getRowCount(); i++) {
|
||||
x = Double.parseDouble(dataTable.getValue(i, xVarName).toString());
|
||||
y = Double.parseDouble(dataTable.getValue(i, yVarName).toString());
|
||||
if (zVarName == null)
|
||||
z = 0;
|
||||
else
|
||||
z = Double.parseDouble(dataTable.getValue(i, zVarName).toString());
|
||||
m = Double.parseDouble(dataTable.getValue(i, varName).toString());
|
||||
points.add(new PointZ(x, y, z, m));
|
||||
}
|
||||
PolylineZShape polylineShape = new PolylineZShape();
|
||||
polylineShape.setPoints(points);
|
||||
int shapeNum = layer.getShapeNum();
|
||||
try {
|
||||
if (layer.editInsertShape(polylineShape, shapeNum)) {
|
||||
layer.editCellValue("TrajIndex", shapeNum, trajIdx + 1);
|
||||
layer.editCellValue("TrajName", shapeNum, trajInfo.trajName);
|
||||
layer.editCellValue("TrajID", shapeNum, trajInfo.trajID);
|
||||
layer.editCellValue("TrajCenter", shapeNum, trajInfo.trajCenter);
|
||||
layer.editCellValue("StartDate", shapeNum, trajInfo.startTime);
|
||||
layer.editCellValue("StartLat", shapeNum, trajInfo.startLat);
|
||||
layer.editCellValue("StartLon", shapeNum, trajInfo.startLon);
|
||||
layer.editCellValue("StartHeight", shapeNum, trajInfo.startHeight);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
trajIdx += 1;
|
||||
}
|
||||
|
||||
layer.setLayerName("Trajectory_Lines");
|
||||
layer.setLayerDrawType(LayerDrawType.TRAJECTORY_LINE);
|
||||
layer.setVisible(true);
|
||||
layer.updateLegendScheme(LegendType.UNIQUE_VALUE, "TrajID");
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
public static VectorLayer createTrajPointLayer(ITrajDataInfo trajDataInfo) {
|
||||
List<DataTable> dataTables = trajDataInfo.getDataTables();
|
||||
List<Variable> variables = trajDataInfo.getVariables();
|
||||
String xVarName = trajDataInfo.getXVarName();
|
||||
String yVarName = trajDataInfo.getYVarName();
|
||||
String zVarName = trajDataInfo.getZVarName();
|
||||
|
||||
VectorLayer layer = new VectorLayer(ShapeTypes.POINT_Z);
|
||||
layer.editAddField(new Field("TrajID", DataType.INT));
|
||||
for (Variable variable : variables) {
|
||||
layer.editAddField(new Field(variable.getName(), variable.getDataType()));
|
||||
}
|
||||
|
||||
int trajIdx = 0;
|
||||
double x, y, z;
|
||||
for (DataTable dataTable : dataTables) {
|
||||
for (int i = 0; i < dataTable.getRowCount(); i++) {
|
||||
x = Double.parseDouble(dataTable.getValue(i, xVarName).toString());
|
||||
y = Double.parseDouble(dataTable.getValue(i, yVarName).toString());
|
||||
if (zVarName == null)
|
||||
z = 0;
|
||||
else
|
||||
z = Double.parseDouble(dataTable.getValue(i, zVarName).toString());
|
||||
PointZ point = new PointZ(x, y, z);
|
||||
PointZShape pointZShape = new PointZShape();
|
||||
pointZShape.setPoint(point);
|
||||
int shapeNum = layer.getShapeNum();
|
||||
try {
|
||||
if (layer.editInsertShape(pointZShape, shapeNum)) {
|
||||
layer.editCellValue("TrajID", shapeNum, trajIdx + 1);
|
||||
for (Variable variable : variables) {
|
||||
layer.editCellValue(variable.getName(), shapeNum, dataTable.getValue(i, variable.getName()));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
trajIdx += 1;
|
||||
}
|
||||
|
||||
layer.setLayerName("Trajectory_Points");
|
||||
layer.setLayerDrawType(LayerDrawType.TRAJECTORY_POINT);
|
||||
layer.setVisible(true);
|
||||
LegendScheme aLS = LegendManage.createSingleSymbolLegendScheme(ShapeTypes.POINT, Color.red, 5.0F);
|
||||
aLS.setFieldName("TrajID");
|
||||
layer.setLegendScheme(aLS);
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create trajectory start point layer
|
||||
* @param trajDataInfo ITrajDataInfo
|
||||
* @return Trajectory start point layer
|
||||
*/
|
||||
public static VectorLayer createTrajStartPointLayer(ITrajDataInfo trajDataInfo) {
|
||||
List<DataTable> dataTables = trajDataInfo.getDataTables();
|
||||
List<TrajectoryInfo> trajInfoList = trajDataInfo.getTrajInfoList();
|
||||
String xVarName = trajDataInfo.getXVarName();
|
||||
String yVarName = trajDataInfo.getYVarName();
|
||||
String zVarName = trajDataInfo.getZVarName();
|
||||
|
||||
VectorLayer layer = new VectorLayer(ShapeTypes.POINT_Z);
|
||||
layer.editAddField(new Field("TrajIndex", DataType.INT));
|
||||
layer.editAddField(new Field("TrajName", DataType.STRING));
|
||||
layer.editAddField(new Field("TrajID", DataType.STRING));
|
||||
layer.editAddField(new Field("TrajCenter", DataType.STRING));
|
||||
layer.editAddField(new Field("StartDate", DataType.DATE));
|
||||
layer.editAddField(new Field("StartLon", DataType.DOUBLE));
|
||||
layer.editAddField(new Field("StartLat", DataType.DOUBLE));
|
||||
layer.editAddField(new Field("StartHeight", DataType.DOUBLE));
|
||||
|
||||
int trajIdx = 0;
|
||||
double x, y, z;
|
||||
for (DataTable dataTable : dataTables) {
|
||||
TrajectoryInfo trajInfo = trajInfoList.get(trajIdx);
|
||||
List<PointZ> points = new ArrayList<>();
|
||||
x = Double.parseDouble(dataTable.getValue(0, xVarName).toString());
|
||||
y = Double.parseDouble(dataTable.getValue(0, yVarName).toString());
|
||||
if (zVarName == null)
|
||||
z = 0;
|
||||
else
|
||||
z = Double.parseDouble(dataTable.getValue(0, zVarName).toString());
|
||||
PointZShape pointZShape = new PointZShape();
|
||||
pointZShape.setPoint(new PointZ(x, y, z));
|
||||
int shapeNum = layer.getShapeNum();
|
||||
try {
|
||||
if (layer.editInsertShape(pointZShape, shapeNum)) {
|
||||
layer.editCellValue("TrajIndex", shapeNum, trajIdx + 1);
|
||||
layer.editCellValue("TrajName", shapeNum, trajInfo.trajName);
|
||||
layer.editCellValue("TrajID", shapeNum, trajInfo.trajID);
|
||||
layer.editCellValue("TrajCenter", shapeNum, trajInfo.trajCenter);
|
||||
layer.editCellValue("StartDate", shapeNum, trajInfo.startTime);
|
||||
layer.editCellValue("StartLat", shapeNum, trajInfo.startLat);
|
||||
layer.editCellValue("StartLon", shapeNum, trajInfo.startLon);
|
||||
layer.editCellValue("StartHeight", shapeNum, trajInfo.startHeight);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
trajIdx += 1;
|
||||
}
|
||||
|
||||
layer.setLayerName("Trajectory_Start_Points");
|
||||
layer.setLayerDrawType(LayerDrawType.TRAJECTORY_POINT);
|
||||
layer.setVisible(true);
|
||||
LegendScheme aLS = LegendManage.createSingleSymbolLegendScheme(ShapeTypes.POINT, Color.black, 8.0F);
|
||||
aLS.setFieldName("TrajID");
|
||||
layer.setLegendScheme(aLS);
|
||||
|
||||
return layer;
|
||||
}
|
||||
// </editor-fold>
|
||||
}
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="milconfig.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\common_math\linalg">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\micaps">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\wind"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map\maskout"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map\geoshow"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map"/>
|
||||
@ -16,17 +13,22 @@
|
||||
<RecentFolder Folder="D:\Run\emips"/>
|
||||
<RecentFolder Folder="D:\Run\emips\run_cams"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\linalg"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\traj"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\micaps"/>
|
||||
</Path>
|
||||
<File>
|
||||
<OpenedFiles>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\common_math\interpolate\griddata_kriging.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\common_math\linalg\solve_3.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\common_math\linalg\eof_elnino.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\traj\plot_traj.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\micaps\micaps_7.py"/>
|
||||
</OpenedFiles>
|
||||
<RecentFiles>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\common_math\interpolate\griddata_kriging.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\common_math\linalg\solve_3.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\common_math\linalg\eof_elnino.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\traj\plot_traj.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\micaps\micaps_7.py"/>
|
||||
</RecentFiles>
|
||||
</File>
|
||||
<Font>
|
||||
@ -34,5 +36,5 @@
|
||||
</Font>
|
||||
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
|
||||
<Figure DoubleBuffering="true"/>
|
||||
<Startup MainFormLocation="-7,0" MainFormSize="1378,824"/>
|
||||
<Startup MainFormLocation="-7,-7" MainFormSize="1293,693"/>
|
||||
</MeteoInfo>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="config.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Temp\test"/>
|
||||
<Path OpenPath="D:\MyProgram\Distribution\Java\MeteoInfo\MeteoInfo\sample\MICAPS"/>
|
||||
<Font>
|
||||
<TextFont FontName="YaHei Consolas Hybrid" FontSize="14"/>
|
||||
<LegendFont FontName="宋体" FontSize="12"/>
|
||||
|
||||
@ -2456,7 +2456,7 @@ public class FrmMeteoData extends javax.swing.JDialog {
|
||||
aLayer = drawStation(fieldName);
|
||||
_useSameLegendScheme = true;
|
||||
} else if (_meteoDataInfo.isTrajData()) {
|
||||
aLayer = drawTraj();
|
||||
aLayer = drawTraj(fieldName);
|
||||
this.jButton_DrawSetting.setEnabled(false);
|
||||
this.jButton_NexTime.setEnabled(false);
|
||||
this.jButton_PreTime.setEnabled(false);
|
||||
@ -2603,27 +2603,22 @@ public class FrmMeteoData extends javax.swing.JDialog {
|
||||
}
|
||||
}
|
||||
|
||||
private MapLayer drawTraj() {
|
||||
private MapLayer drawTraj(String varName) {
|
||||
DataInfo aDataInfo = _meteoDataInfo.getDataInfo();
|
||||
VectorLayer aLayer = null;
|
||||
switch (_2DDrawType) {
|
||||
case TRAJECTORY_LINE:
|
||||
aLayer = ((TrajDataInfo) aDataInfo).createTrajLineLayer();
|
||||
// PolylineBreak aPLB;
|
||||
// for (int i = 0; i < aLayer.getLegendScheme().getBreakNum(); i++) {
|
||||
// aPLB = (PolylineBreak) aLayer.getLegendScheme().getLegendBreaks().get(i);
|
||||
// aPLB.setSize(2);
|
||||
// }
|
||||
aLayer = DrawMeteoData.createTrajLineLayer((ITrajDataInfo) aDataInfo, varName);
|
||||
_lastAddedLayerHandle = _parent.getMapDocument().getActiveMapFrame().insertPolylineLayer(aLayer);
|
||||
break;
|
||||
case TRAJECTORY_START_POINT:
|
||||
aLayer = ((TrajDataInfo) aDataInfo).createTrajStartPointLayer();
|
||||
aLayer = DrawMeteoData.createTrajStartPointLayer((ITrajDataInfo) aDataInfo);
|
||||
PointBreak aPB = (PointBreak) aLayer.getLegendScheme().getLegendBreaks().get(0);
|
||||
aPB.setStyle(PointStyle.UP_TRIANGLE);
|
||||
_lastAddedLayerHandle = _parent.getMapDocument().getActiveMapFrame().insertPolylineLayer(aLayer);
|
||||
break;
|
||||
case TRAJECTORY_POINT:
|
||||
aLayer = ((TrajDataInfo) aDataInfo).createTrajPointLayer();
|
||||
aLayer = DrawMeteoData.createTrajPointLayer((ITrajDataInfo) aDataInfo);
|
||||
_lastAddedLayerHandle = _parent.getMapDocument().getActiveMapFrame().insertPolylineLayer(aLayer);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ public class Dimension {
|
||||
public Dimension(String name, int len) {
|
||||
this.name = name;
|
||||
this.length = len;
|
||||
_dimType = DimensionType.Other;
|
||||
_dimType = DimensionType.OTHER;
|
||||
_dimValue = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
@ -38,9 +38,9 @@ public enum DimensionType {
|
||||
/// <summary>
|
||||
/// Xtrack dimension - for HDF EOS swath data
|
||||
/// </summary>
|
||||
Xtrack,
|
||||
X_TRACK,
|
||||
/// <summary>
|
||||
/// Other dimension
|
||||
/// </summary>
|
||||
Other
|
||||
OTHER
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user