mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
update micaps4 data reading function
This commit is contained in:
parent
9bf1db579a
commit
87a10cb9f2
@ -88,31 +88,34 @@ public class MICAPS4DataInfo extends DataInfo implements IGridDataInfo {
|
||||
this.setFileName(fileName);
|
||||
aLine = sr.readLine().trim();
|
||||
_description = aLine;
|
||||
aLine = sr.readLine().trim();
|
||||
_headLineNum = 1;
|
||||
//aLine = sr.readLine().trim();
|
||||
dataArray = aLine.split("\\s+");
|
||||
for (i = 0; i < dataArray.length; i++) {
|
||||
if (!dataArray[i].isEmpty()) {
|
||||
dataList.add(dataArray[i]);
|
||||
}
|
||||
}
|
||||
_headLineNum = 2;
|
||||
for (n = 0; n <= 10; n++) {
|
||||
if (dataList.size() < 19) {
|
||||
aLine = sr.readLine().trim();
|
||||
dataArray = aLine.split("\\s+");
|
||||
for (i = 0; i < dataArray.length; i++) {
|
||||
if (!dataArray[i].isEmpty()) {
|
||||
dataList.add(dataArray[i]);
|
||||
if (dataList.size() < 21) {
|
||||
for (n = 0; n <= 10; n++) {
|
||||
if (dataList.size() < 21) {
|
||||
aLine = sr.readLine().trim();
|
||||
dataArray = aLine.split("\\s+");
|
||||
for (i = 0; i < dataArray.length; i++) {
|
||||
if (!dataArray[i].isEmpty()) {
|
||||
dataList.add(dataArray[i]);
|
||||
}
|
||||
}
|
||||
_headLineNum += 1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
_headLineNum += 1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
sr.close();
|
||||
|
||||
int year = Integer.parseInt(dataList.get(0));
|
||||
int idx = 3;
|
||||
int year = Integer.parseInt(dataList.get(idx));
|
||||
if (year < 100) {
|
||||
if (year < 50) {
|
||||
year = 2000 + year;
|
||||
@ -120,27 +123,28 @@ public class MICAPS4DataInfo extends DataInfo implements IGridDataInfo {
|
||||
year = 1900 + year;
|
||||
}
|
||||
}
|
||||
_preHours = Integer.parseInt(dataList.get(4));
|
||||
LocalDateTime time = LocalDateTime.of(year, Integer.parseInt(dataList.get(1)), Integer.parseInt(dataList.get(2)),
|
||||
Integer.parseInt(dataList.get(3)), 0, 0);
|
||||
_preHours = Integer.parseInt(dataList.get(idx + 4));
|
||||
LocalDateTime time = LocalDateTime.of(year, Integer.parseInt(dataList.get(idx + 1)),
|
||||
Integer.parseInt(dataList.get(idx + 2)),
|
||||
Integer.parseInt(dataList.get(idx + 3)), 0, 0);
|
||||
time = time.plusHours(_preHours);
|
||||
|
||||
_level = Integer.parseInt(dataList.get(5));
|
||||
float XDelt = Float.parseFloat(dataList.get(6));
|
||||
float YDelt = Float.parseFloat(dataList.get(7));
|
||||
float XMin = Float.parseFloat(dataList.get(8));
|
||||
float XMax = Float.parseFloat(dataList.get(9));
|
||||
float YMin = Float.parseFloat(dataList.get(10));
|
||||
float YMax = Float.parseFloat(dataList.get(11));
|
||||
int XNum = Integer.parseInt(dataList.get(12));
|
||||
int YNum = Integer.parseInt(dataList.get(13));
|
||||
float contourDelt = Float.parseFloat(dataList.get(14));
|
||||
float contourSValue = Float.parseFloat(dataList.get(15));
|
||||
float contourEValue = Float.parseFloat(dataList.get(16));
|
||||
float smoothCo = Float.parseFloat(dataList.get(17));
|
||||
float boldValue = Float.parseFloat(dataList.get(18));
|
||||
_level = Integer.parseInt(dataList.get(idx + 5));
|
||||
float XDelt = Float.parseFloat(dataList.get(idx + 6));
|
||||
float YDelt = Float.parseFloat(dataList.get(idx + 7));
|
||||
float XMin = Float.parseFloat(dataList.get(idx + 8));
|
||||
float XMax = Float.parseFloat(dataList.get(idx + 9));
|
||||
float YMin = Float.parseFloat(dataList.get(idx + 10));
|
||||
float YMax = Float.parseFloat(dataList.get(idx + 11));
|
||||
int XNum = Integer.parseInt(dataList.get(idx + 12));
|
||||
int YNum = Integer.parseInt(dataList.get(idx + 13));
|
||||
float contourDelt = Float.parseFloat(dataList.get(idx + 14));
|
||||
float contourSValue = Float.parseFloat(dataList.get(idx + 15));
|
||||
float contourEValue = Float.parseFloat(dataList.get(idx + 16));
|
||||
float smoothCo = Float.parseFloat(dataList.get(idx + 17));
|
||||
float boldValue = Float.parseFloat(dataList.get(idx + 18));
|
||||
boolean isLonLat;
|
||||
if (dataList.get(16).equals("-1") || dataList.get(16).equals("-2") || dataList.get(16).equals("-3")) {
|
||||
if (dataList.get(idx + 16).equals("-1") || dataList.get(idx + 16).equals("-2") || dataList.get(idx + 16).equals("-3")) {
|
||||
isLonLat = false;
|
||||
} else {
|
||||
isLonLat = true;
|
||||
|
||||
@ -128,29 +128,21 @@ public class MICAPSDataInfo {
|
||||
String dataType = stoker.nextToken() + " " + stoker.nextToken();
|
||||
if (dataType.contains("diamond 1")) {
|
||||
dataInfo = new MICAPS1DataInfo();
|
||||
}
|
||||
if (dataType.equals("diamond 2")) {
|
||||
} else if (dataType.equals("diamond 2")) {
|
||||
dataInfo = new MICAPS2DataInfo();
|
||||
}
|
||||
if (dataType.equals("diamond 3")) {
|
||||
} else if (dataType.equals("diamond 3")) {
|
||||
dataInfo = new MICAPS3DataInfo();
|
||||
}
|
||||
if (dataType.equals("diamond 4")) {
|
||||
} else if (dataType.equals("diamond 4")) {
|
||||
dataInfo = new MICAPS4DataInfo();
|
||||
}
|
||||
if (dataType.equals("diamond 7")) {
|
||||
} else if (dataType.equals("diamond 7")) {
|
||||
dataInfo = new MICAPS7DataInfo();
|
||||
}
|
||||
if (dataType.equals("diamond 11")) {
|
||||
} else if (dataType.equals("diamond 11")) {
|
||||
dataInfo = new MICAPS11DataInfo();
|
||||
}
|
||||
if (dataType.equals("diamond 13")) {
|
||||
} else if (dataType.equals("diamond 13")) {
|
||||
dataInfo = new MICAPS13DataInfo();
|
||||
}
|
||||
if (dataType.contains("iamond 120")) {
|
||||
} else if (dataType.contains("iamond 120")) {
|
||||
dataInfo = new MICAPS120DataInfo();
|
||||
}
|
||||
if (dataType.contains("diamond 131")) {
|
||||
} else if (dataType.contains("diamond 131")) {
|
||||
dataInfo = new MICAPS131DataInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,34 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="milconfig.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\common_math\stats">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\traj"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\random"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\model"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\fitting"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\integrate"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\linalg"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\hist"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\contour"/>
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\io\micaps">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\stats"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\interpolate"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\math"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\test"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\others"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\scatter"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\data_process"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\new"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\dataframe"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\array"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\micaps"/>
|
||||
</Path>
|
||||
<File>
|
||||
<OpenedFiles>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\model\obj_Lion_1.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\hist\hist_h_1.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\common_math\stats\linregress_1.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\common_math\stats\mlinregress_3.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\micaps\micaps_4_9.py"/>
|
||||
</OpenedFiles>
|
||||
<RecentFiles>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\model\obj_Lion_1.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\hist\hist_h_1.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\common_math\stats\linregress_1.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\common_math\stats\mlinregress_3.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\io\micaps\micaps_4_9.py"/>
|
||||
</RecentFiles>
|
||||
</File>
|
||||
<Font>
|
||||
@ -36,5 +34,5 @@
|
||||
</Font>
|
||||
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
|
||||
<Figure DoubleBuffering="true"/>
|
||||
<Startup MainFormLocation="-7,-7" MainFormSize="1293,685"/>
|
||||
<Startup MainFormLocation="-7,0" MainFormSize="1348,763"/>
|
||||
</MeteoInfo>
|
||||
|
||||
Binary file not shown.
@ -2904,7 +2904,7 @@ def interp2d(*args, **kwargs):
|
||||
xq = array(xq)._array
|
||||
yq = array(yq)._array
|
||||
kind = kwargs.pop('kind', 'linear')
|
||||
if kind == 'neareast':
|
||||
if kind == 'nearest':
|
||||
r = ArrayUtil.resample_Neighbor(z, x, y, xq, yq)
|
||||
else:
|
||||
r = ArrayUtil.resample_Bilinear(z, x, y, xq, yq)
|
||||
|
||||
Binary file not shown.
@ -72,7 +72,7 @@ class interp2d(object):
|
||||
:param y: (*array_like*) 1-D arrays of y coordinate in strictly ascending order.
|
||||
:param z: (*array_like*) 2-D array of data with shape (x.size,y.size).
|
||||
:param kind: (*boolean*) Specifies the kind of interpolation as a string (‘linear’,
|
||||
‘nearest’, 'kriging'). Default is ‘linear’.
|
||||
‘spline’, 'kriging'). Default is ‘linear’.
|
||||
"""
|
||||
|
||||
def __init__(self, x, y, z, kind='linear', **kwargs):
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="config.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Temp\traj\test"/>
|
||||
<Path OpenPath="D:\Temp\micaps"/>
|
||||
<Font>
|
||||
<TextFont FontName="YaHei Consolas Hybrid" FontSize="14"/>
|
||||
<LegendFont FontName="宋体" FontSize="12"/>
|
||||
@ -8,5 +8,5 @@
|
||||
<ScriptLanguage Language="Jython"/>
|
||||
<LookFeel LafDecorated="true" Name="FlatLightLaf"/>
|
||||
<Figure DoubleBuffering="true"/>
|
||||
<Startup MainFormLocation="-7,-7" MainFormSize="1293,685" ShowMeteoDataDlg="false"/>
|
||||
<Startup MainFormLocation="-7,-7" MainFormSize="1293,685" ShowMeteoDataDlg="true"/>
|
||||
</MeteoInfo>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user