mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
improve WRFUtil functions
This commit is contained in:
parent
e57ad304f5
commit
aa2f32039a
@ -65,7 +65,7 @@ import java.util.zip.ZipInputStream;
|
||||
public static String getVersion(){
|
||||
String version = GlobalUtil.class.getPackage().getImplementationVersion();
|
||||
if (version == null || version.equals("")) {
|
||||
version = "3.3.9";
|
||||
version = "3.3.10";
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
@ -247,5 +247,10 @@ public class DimArray {
|
||||
|
||||
return new DimArray(rr, dims);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.array.toString();
|
||||
}
|
||||
// </editor-fold>
|
||||
}
|
||||
|
||||
@ -496,6 +496,7 @@ public class Dimension {
|
||||
Dimension dim = new Dimension(this.getShortName(), a, this.dimType);
|
||||
dim.setDimId(this.dimId);
|
||||
dim.setUnit(this.unit);
|
||||
dim.setStagger(this.stagger);
|
||||
return dim;
|
||||
} catch (InvalidRangeException e) {
|
||||
e.printStackTrace();
|
||||
@ -516,6 +517,7 @@ public class Dimension {
|
||||
Dimension dim = new Dimension(this.getShortName(), n, this.dimType);
|
||||
dim.setDimId(this.dimId);
|
||||
dim.setUnit(this.unit);
|
||||
dim.setStagger(this.stagger);
|
||||
//dim.setReverse(this.reverse);
|
||||
if (this.dimValue.getSize() > last) {
|
||||
List<Double> values = new ArrayList<>();
|
||||
@ -558,6 +560,7 @@ public class Dimension {
|
||||
Dimension dim = new Dimension(this.getShortName(), this.getLength(), this.dimType);
|
||||
dim.setDimId(this.dimId);
|
||||
dim.setUnit(this.unit);
|
||||
dim.setStagger(this.stagger);
|
||||
List<Double> values = new ArrayList<>();
|
||||
int idx;
|
||||
for (double v = first; v <= last; v += stride) {
|
||||
@ -579,6 +582,7 @@ public class Dimension {
|
||||
Dimension dim = new Dimension(this.getShortName(), this.getLength(), this.dimType);
|
||||
dim.setDimId(this.dimId);
|
||||
dim.setUnit(this.unit);
|
||||
dim.setStagger(this.stagger);
|
||||
//dim.setReverse(this.reverse);
|
||||
List<Double> values = new ArrayList<>();
|
||||
for (int i = 0; i < index.size(); i++) {
|
||||
@ -599,6 +603,7 @@ public class Dimension {
|
||||
Dimension dim = new Dimension(this.getShortName(), this.getLength(), this.dimType);
|
||||
dim.setDimId(this.dimId);
|
||||
dim.setUnit(this.unit);
|
||||
dim.setStagger(this.stagger);
|
||||
List<Double> values = new ArrayList<>();
|
||||
IndexIterator iter = index.getIndexIterator();
|
||||
while (iter.hasNext()) {
|
||||
|
||||
@ -586,7 +586,8 @@ import org.meteoinfo.projection.ProjectionInfo;
|
||||
* @return Dimension array
|
||||
*/
|
||||
public DimArray readDimArray(String varName, List<Range> ranges) {
|
||||
int[] origin = new int[1], size = new int[1], stride = new int[1];
|
||||
int n = ranges.size();
|
||||
int[] origin = new int[n], size = new int[n], stride = new int[n];
|
||||
ArrayMath.rangesToSection(ranges, origin, size, stride);
|
||||
|
||||
return readDimArray(varName, origin, size, stride);
|
||||
|
||||
@ -1500,7 +1500,6 @@ public class NetCDFDataInfo extends DataInfo implements IGridDataInfo, IStationD
|
||||
}
|
||||
}
|
||||
zDim.setDimType(DimensionType.Z);
|
||||
zDim.setStagger(true);
|
||||
//zDim.setDimName(_levelVar.getShortName());
|
||||
zDim.setValues(levels);
|
||||
zDim.setUnit("eta");
|
||||
@ -1527,6 +1526,7 @@ public class NetCDFDataInfo extends DataInfo implements IGridDataInfo, IStationD
|
||||
}
|
||||
}
|
||||
zDim.setDimType(DimensionType.Z);
|
||||
zDim.setStagger(true);
|
||||
//zDim.setDimName(_levelVar.getShortName());
|
||||
zDim.setValues(levels);
|
||||
zDim.setUnit("eta");
|
||||
@ -1550,6 +1550,7 @@ public class NetCDFDataInfo extends DataInfo implements IGridDataInfo, IStationD
|
||||
}
|
||||
}
|
||||
zDim.setDimType(DimensionType.Z);
|
||||
zDim.setStagger(true);
|
||||
//zDim.setDimName(_levelVar.getShortName());
|
||||
zDim.setValues(levels);
|
||||
//this.setZDimension(zDim);
|
||||
@ -3226,7 +3227,7 @@ public class NetCDFDataInfo extends DataInfo implements IGridDataInfo, IStationD
|
||||
MAMath.copy(data, r);
|
||||
} else {
|
||||
ucar.ma2.Section section = new ucar.ma2.Section(origin, size, stride);
|
||||
data = NCUtil.convertArray(var.read(section));
|
||||
data = NCUtil.convertArray(var.read(section)).reduce();
|
||||
}
|
||||
|
||||
if (unpack) {
|
||||
|
||||
@ -26,7 +26,7 @@ public class WRFUtil {
|
||||
Range range1 = new Range(0, sDim.getLength() - 2);
|
||||
Range range2 = new Range(1, sDim.getLength() - 1);
|
||||
Array sDimValue = sDim.getDimValue();
|
||||
Array sDimValue1 = Array.factory(DataType.DOUBLE, new int[]{sDim.getLength()});
|
||||
Array sDimValue1 = Array.factory(DataType.DOUBLE, new int[]{sDim.getLength() - 1});
|
||||
for (int i = 0; i < sDimValue1.getSize(); i++) {
|
||||
sDimValue1.setDouble(i, 0.5 * (sDimValue.getDouble(i) + sDimValue.getDouble(i + 1)));
|
||||
}
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
<?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\LaSW"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo\wrf"/>
|
||||
<Path OpenPath="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume">
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart\subplot"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\hdf"/>
|
||||
@ -14,23 +11,20 @@
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\dataframe"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\stats"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\array"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo\wrf"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\LaSW"/>
|
||||
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume"/>
|
||||
</Path>
|
||||
<File>
|
||||
<OpenedFiles>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\LaSW\typhoon_map_volume.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\dataframe\drop_1.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\common_math\stats\pearsonr.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\common_math\stats\spearmanr.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\array\delnan_1.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\LaSW\typhoon_map_volume_specular.py"/>
|
||||
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_sagittal_specular.py"/>
|
||||
</OpenedFiles>
|
||||
<RecentFiles>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\LaSW\typhoon_map_volume.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\dataframe\drop_1.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\common_math\stats\pearsonr.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\common_math\stats\spearmanr.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\array\delnan_1.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\LaSW\typhoon_map_volume_specular.py"/>
|
||||
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\volume\volumeplot_sagittal_specular.py"/>
|
||||
</RecentFiles>
|
||||
</File>
|
||||
<Font>
|
||||
@ -38,5 +32,5 @@
|
||||
</Font>
|
||||
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
|
||||
<Figure DoubleBuffering="true"/>
|
||||
<Startup MainFormLocation="-7,0" MainFormSize="1397,803"/>
|
||||
<Startup MainFormLocation="-7,-7" MainFormSize="1293,685"/>
|
||||
</MeteoInfo>
|
||||
|
||||
@ -5533,9 +5533,6 @@ public class ArrayMath {
|
||||
*/
|
||||
public static void rangesToSection(List<Range> ranges, int[] origin, int[] size, int[] stride) {
|
||||
int n = ranges.size();
|
||||
origin = new int[n];
|
||||
size = new int[n];
|
||||
stride = new int[n];
|
||||
for (int i = 0; i < n; i++) {
|
||||
origin[i] = ranges.get(i).first();
|
||||
size[i] = ranges.get(i).last() - ranges.get(i).first() + 1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user