mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
update AWX reading function
This commit is contained in:
parent
86850747f1
commit
2d72e5f30b
@ -220,6 +220,9 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
|
||||
_numHeadRecord = DataConvert.bytes2Int(bytes, byteOrder);
|
||||
br.read(bytes);
|
||||
_numDataRecord = DataConvert.bytes2Int(bytes, byteOrder);
|
||||
if (_numDataRecord < 0) {
|
||||
_numDataRecord = DataConvert.bytes2UShort(bytes, byteOrder);
|
||||
}
|
||||
br.read(bytes);
|
||||
_productType = DataConvert.bytes2Int(bytes, byteOrder);
|
||||
br.read(bytes);
|
||||
@ -288,7 +291,12 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
|
||||
tbytes = Arrays.copyOfRange(bytes, yearIdx + 18, yearIdx + 20);
|
||||
_endMinute = DataConvert.bytes2Int(tbytes, byteOrder);
|
||||
if (_endYear > 0) {
|
||||
ETime = LocalDateTime.of(_endYear, _endMonth, _endDay, _endHour, _endMinute, 0);
|
||||
if (_endMinute < 60) {
|
||||
ETime = LocalDateTime.of(_endYear, _endMonth, _endDay, _endHour, _endMinute, 0);
|
||||
} else {
|
||||
ETime = LocalDateTime.of(_endYear, _endMonth, _endDay, _endHour, 0, 0);
|
||||
ETime = ETime.plusMinutes(_endMinute);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,18 +335,22 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
|
||||
getProjection(bytes);
|
||||
}
|
||||
|
||||
tbytes = Arrays.copyOfRange(bytes, yearIdx + 48, yearIdx + 50);
|
||||
lenColorTable = DataConvert.bytes2Int(tbytes, byteOrder);
|
||||
tbytes = Arrays.copyOfRange(bytes, yearIdx + 50, yearIdx + 52);
|
||||
lenCalibration = DataConvert.bytes2Int(tbytes, byteOrder);
|
||||
tbytes = Arrays.copyOfRange(bytes, yearIdx + 52, yearIdx + 54);
|
||||
lenLocation = DataConvert.bytes2Int(tbytes, byteOrder);
|
||||
if (_productType != 4) {
|
||||
tbytes = Arrays.copyOfRange(bytes, yearIdx + 48, yearIdx + 50);
|
||||
lenColorTable = DataConvert.bytes2Int(tbytes, byteOrder);
|
||||
tbytes = Arrays.copyOfRange(bytes, yearIdx + 50, yearIdx + 52);
|
||||
lenCalibration = DataConvert.bytes2Int(tbytes, byteOrder);
|
||||
tbytes = Arrays.copyOfRange(bytes, yearIdx + 52, yearIdx + 54);
|
||||
lenLocation = DataConvert.bytes2Int(tbytes, byteOrder);
|
||||
}
|
||||
|
||||
br.close();
|
||||
|
||||
//Set variable list
|
||||
// Add dimensions, attributes and variables
|
||||
this.addAttribute(new Attribute("Data type", "AWX"));
|
||||
this.addAttribute(new Attribute("Product type", this._productType));
|
||||
|
||||
VarList = new ArrayList<>();
|
||||
List<Variable> variables = new ArrayList<>();
|
||||
Variable var;
|
||||
switch (_productType) {
|
||||
case 1:
|
||||
@ -349,7 +361,7 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
|
||||
var.setName("var");
|
||||
var.setDimension(this.getYDimension());
|
||||
var.setDimension(this.getXDimension());
|
||||
variables.add(var);
|
||||
this.addVariable(var);
|
||||
break;
|
||||
case 4:
|
||||
VarList.add("Latitude");
|
||||
@ -368,6 +380,7 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
|
||||
VarList.add("LastCol");
|
||||
VarList.add("BrightTemp");
|
||||
Dimension stdim = new Dimension(DimensionType.OTHER);
|
||||
stdim.setName("stations");
|
||||
double[] values = new double[this._numDataRecord];
|
||||
stdim.setValues(values);
|
||||
this.addDimension(stdim);
|
||||
@ -376,7 +389,7 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
|
||||
var.setName(vName);
|
||||
var.setStation(true);
|
||||
var.setDimension(stdim);
|
||||
variables.add(var);
|
||||
this.addVariable(var);
|
||||
}
|
||||
|
||||
FieldList = new ArrayList<>();
|
||||
@ -385,7 +398,6 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
|
||||
FieldList.addAll(VarList);
|
||||
break;
|
||||
}
|
||||
this.setVariables(variables);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(AWXDataInfo.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
@ -532,10 +544,12 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
|
||||
xdim.setShortName("X");
|
||||
xdim.setValues(x);
|
||||
this.setXDimension(xdim);
|
||||
this.addDimension(xdim);
|
||||
Dimension ydim = new Dimension(DimensionType.Y);
|
||||
ydim.setShortName("Y");
|
||||
ydim.setValues(y);
|
||||
this.setYDimension(ydim);
|
||||
this.addDimension(ydim);
|
||||
}
|
||||
|
||||
private void calCoordinate_3() {
|
||||
@ -563,10 +577,12 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
|
||||
xdim.setShortName("X");
|
||||
xdim.setValues(x);
|
||||
this.setXDimension(xdim);
|
||||
this.addDimension(xdim);
|
||||
Dimension ydim = new Dimension(DimensionType.Y);
|
||||
ydim.setShortName("Y");
|
||||
ydim.setValues(y);
|
||||
this.setYDimension(ydim);
|
||||
this.addDimension(ydim);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -579,30 +595,6 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateInfoText() {
|
||||
String dataInfo;
|
||||
dataInfo = "File Name: " + this.getFileName();
|
||||
dataInfo += System.getProperty("line.separator") + "Data Type: AWX";
|
||||
if (this._productType != 4) {
|
||||
Dimension xdim = this.getXDimension();
|
||||
Dimension ydim = this.getYDimension();
|
||||
dataInfo += System.getProperty("line.separator") + "XNum = " + String.valueOf(xdim.getLength())
|
||||
+ " YNum = " + String.valueOf(ydim.getLength());
|
||||
dataInfo += System.getProperty("line.separator") + "XMin = " + String.valueOf(xdim.getValues()[0])
|
||||
+ " YMin = " + String.valueOf(ydim.getValues()[0]);
|
||||
dataInfo += System.getProperty("line.separator") + "XSize = " + String.valueOf(xdim.getValues()[1] - xdim.getValues()[0])
|
||||
+ " YSize = " + String.valueOf(ydim.getValues()[1] - ydim.getValues()[0]);
|
||||
}
|
||||
dataInfo += System.getProperty("line.separator") + "Product Type = " + String.valueOf(this._productType);
|
||||
dataInfo += System.getProperty("line.separator") + "Number of Variables = " + String.valueOf(this.getVariableNum());
|
||||
for (int i = 0; i < this.getVariableNum(); i++) {
|
||||
dataInfo += System.getProperty("line.separator") + "\t" + this.getVariableNames().get(i);
|
||||
}
|
||||
|
||||
return dataInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read array data of a variable
|
||||
*
|
||||
|
||||
@ -1,34 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="milconfig.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\array">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\array\complex"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\traj"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map"/>
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\io\burf">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map\webmap"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\interpolate"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\linalg"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\burf"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\radar"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite\cloudsat"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite\gpm"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\array"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\radar"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\traj"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite\FY"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\awx"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\burf"/>
|
||||
</Path>
|
||||
<File>
|
||||
<OpenedFiles>
|
||||
<OpenedFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\_reload.py"/>
|
||||
<OpenedFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\mainGUI.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\radar\radar_bin_proj.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\satellite\gpm\GPM_DPRGMI_cross.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\burf\bufr_cma_upar.py"/>
|
||||
</OpenedFiles>
|
||||
<RecentFiles>
|
||||
<RecentFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\_reload.py"/>
|
||||
<RecentFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\mainGUI.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\io\radar\radar_bin_proj.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\satellite\gpm\GPM_DPRGMI_cross.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\io\burf\bufr_cma_upar.py"/>
|
||||
</RecentFiles>
|
||||
</File>
|
||||
<Font>
|
||||
@ -36,5 +36,5 @@
|
||||
</Font>
|
||||
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
|
||||
<Figure DoubleBuffering="true"/>
|
||||
<Startup MainFormLocation="-7,0" MainFormSize="1410,778"/>
|
||||
<Startup MainFormLocation="-7,0" MainFormSize="1347,775"/>
|
||||
</MeteoInfo>
|
||||
|
||||
Binary file not shown.
@ -16,7 +16,8 @@ import os
|
||||
mi_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
migl.mifolder = mi_dir
|
||||
|
||||
__version__ = '3.6.3'
|
||||
from org.meteoinfo.common.util import GlobalUtil
|
||||
__version__ = GlobalUtil.getVersion()
|
||||
pstr = 'MeteoInfoLab {}'.format(__version__)
|
||||
|
||||
lookup_cma = os.path.join(mi_dir, 'tables', 'bufr', 'tablelookup_cma.csv')
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
|
||||
from .dimdatafile import DimDataFile
|
||||
import mipylib.miutil as miutil
|
||||
import mipylib.numeric as np
|
||||
|
||||
|
||||
class ARLDataFile(DimDataFile):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user