mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
bugfix for phased array radar data reading
This commit is contained in:
parent
38f8dbcc96
commit
bf73e6218c
@ -180,6 +180,7 @@ public class PARadarDataInfo extends BaseRadarDataInfo implements IRadarDataInfo
|
||||
byte[] rhBytes = new byte[RadialHeader.length];
|
||||
while (raf.read(rhBytes) != -1) {
|
||||
RadialHeader radialHeader = new RadialHeader(rhBytes);
|
||||
int scanIdx = radialHeader.elevationNumber - 1;
|
||||
for (int i = 0; i < radialHeader.momentNumber; i++) {
|
||||
MomentHeader momentHeader = new MomentHeader(raf);
|
||||
String product = this.productMap.get(momentHeader.dataType);
|
||||
@ -194,26 +195,26 @@ public class PARadarDataInfo extends BaseRadarDataInfo implements IRadarDataInfo
|
||||
this.recordMap.put(product, record);
|
||||
}
|
||||
if (radialHeader.radialNumber == 1) {
|
||||
record.fixedElevation.add(cutConfigs.get(radialHeader.elevationNumber - 1).elevation);
|
||||
record.fixedElevation.add(cutConfigs.get(scanIdx).elevation);
|
||||
record.elevation.add(new ArrayList<>());
|
||||
record.azimuth.add(new ArrayList<>());
|
||||
record.azimuthMinIndex.add(0);
|
||||
if (isVelocityGroup(record)) {
|
||||
record.disResolution.add(cutConfigs.get(radialHeader.elevationNumber - 1).dopplerResolution);
|
||||
record.disResolution.add(cutConfigs.get(scanIdx).dopplerResolution);
|
||||
record.distance.add(ArrayUtil.arrayRange1(0, momentHeader.dataLength / momentHeader.binLength,
|
||||
cutConfigs.get(radialHeader.elevationNumber - 1).dopplerResolution));
|
||||
cutConfigs.get(scanIdx).dopplerResolution));
|
||||
} else {
|
||||
record.disResolution.add(cutConfigs.get(radialHeader.elevationNumber - 1).logResolution);
|
||||
record.disResolution.add(cutConfigs.get(scanIdx).logResolution);
|
||||
record.distance.add(ArrayUtil.arrayRange1(0, momentHeader.dataLength / momentHeader.binLength,
|
||||
cutConfigs.get(radialHeader.elevationNumber - 1).logResolution));
|
||||
cutConfigs.get(scanIdx).logResolution));
|
||||
}
|
||||
record.newScanData();
|
||||
}
|
||||
record.elevation.get(record.elevation.size() - 1).add(radialHeader.elevation);
|
||||
record.addAzimuth(radialHeader.azimuth);
|
||||
record.elevation.get(scanIdx).add(radialHeader.elevation);
|
||||
record.addAzimuth(scanIdx, radialHeader.azimuth);
|
||||
byte[] bytes = new byte[momentHeader.dataLength];
|
||||
raf.read(bytes);
|
||||
record.addDataBytes(bytes);
|
||||
record.addDataBytes(scanIdx, bytes);
|
||||
}
|
||||
radialHeaders.add(radialHeader);
|
||||
}
|
||||
@ -369,7 +370,7 @@ public class PARadarDataInfo extends BaseRadarDataInfo implements IRadarDataInfo
|
||||
taskName = new String(bytes).trim();
|
||||
bytes = new byte[128];
|
||||
raf.read(bytes);
|
||||
taskDescription = new String(bytes).trim();
|
||||
taskDescription = new String(bytes, "GB2312").trim();
|
||||
bytes = new byte[4];
|
||||
raf.read(bytes);
|
||||
polarizationType = DataConvert.bytes2Int(bytes, ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
@ -98,6 +98,23 @@ public class RadialRecord {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an azimuth value
|
||||
* @param scanIdx Scan index
|
||||
* @param a Azimuth value
|
||||
*/
|
||||
public void addAzimuth(int scanIdx, float a) {
|
||||
List<Float> azi = this.azimuth.get(scanIdx);
|
||||
azi.add(a);
|
||||
if (this.azimuthMinIndex.get(scanIdx) == 0) {
|
||||
if (azi.size() > 1) {
|
||||
if (a < azi.get(azi.size() - 2)) {
|
||||
this.azimuthMinIndex.set(scanIdx, azi.size() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is velocity group or not
|
||||
* @return Velocity group or not
|
||||
@ -173,6 +190,29 @@ public class RadialRecord {
|
||||
this.data.get(this.data.size() - 1).add(array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a data bytes
|
||||
* @param index Scan index
|
||||
* @param bytes Data bytes
|
||||
*/
|
||||
public void addDataBytes(int index, byte[] bytes) {
|
||||
if (this.data.isEmpty()) {
|
||||
this.data.add(new ArrayList<>());
|
||||
}
|
||||
Array array;
|
||||
if (this.dataType == DataType.UBYTE) {
|
||||
array = Array.factory(this.dataType, new int[]{bytes.length}, bytes);
|
||||
} else {
|
||||
int n = bytes.length / 2;
|
||||
array = Array.factory(this.dataType, new int[]{n});
|
||||
for (int i = 0; i < n; i++) {
|
||||
short v = DataConvert.bytes2Short(new byte[]{bytes[i*2], bytes[i*2+1]}, ByteOrder.LITTLE_ENDIAN);
|
||||
array.setShort(i, v);
|
||||
}
|
||||
}
|
||||
this.data.get(index).add(array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a data bytes
|
||||
* @param bytes Data bytes
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<MeteoInfo File="milconfig.xml" Type="configurefile">
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\io\burf">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map\geoshow"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\array"/>
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\io\radar\cinrad">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\dataset"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\fft"/>
|
||||
@ -13,18 +11,22 @@
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\satellite"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\netcdf"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\micaps"/>
|
||||
<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\io\radar\cinrad"/>
|
||||
</Path>
|
||||
<File>
|
||||
<OpenedFiles>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\burf\bufr_gfs_1.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\burf\bufr_gdas_3.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\radar\radar_x_phase_2.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\radar\cinrad\radar_pa_1.py"/>
|
||||
</OpenedFiles>
|
||||
<RecentFiles>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\io\burf\bufr_gfs_1.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\io\burf\bufr_gdas_3.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\io\radar\radar_x_phase_2.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\io\radar\cinrad\radar_pa_1.py"/>
|
||||
</RecentFiles>
|
||||
</File>
|
||||
<Font>
|
||||
|
||||
Binary file not shown.
@ -20,13 +20,13 @@ 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')
|
||||
if os.path.isfile(lookup_cma):
|
||||
try:
|
||||
is_ok = dataset.add_bufr_lookup(lookup_cma)
|
||||
except:
|
||||
is_ok = False
|
||||
if is_ok:
|
||||
pstr += ' (CMA Bufr lookup file added)'
|
||||
# lookup_cma = os.path.join(mi_dir, 'tables', 'bufr', 'tablelookup_cma.csv')
|
||||
# if os.path.isfile(lookup_cma):
|
||||
# try:
|
||||
# is_ok = dataset.add_bufr_lookup(lookup_cma)
|
||||
# except:
|
||||
# is_ok = False
|
||||
# if is_ok:
|
||||
# pstr += ' (CMA Bufr lookup file added)'
|
||||
|
||||
print(pstr)
|
||||
2
pom.xml
2
pom.xml
@ -35,7 +35,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<revision>3.9.7</revision>
|
||||
<revision>3.9.8</revision>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<maven.compiler.release>8</maven.compiler.release>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user