support calibration table data in AWX data format

This commit is contained in:
wyq 2022-09-06 17:58:11 +08:00
parent 71d97a9c6c
commit 76f258ce6f
12 changed files with 151 additions and 42 deletions

View File

@ -1,13 +1,13 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="Maven: org.apache.commons:commons-math4-core:4.0-SNAPSHOT"> <library name="Maven: org.apache.commons:commons-math4-core:4.0-SNAPSHOT">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-core/4.0-SNAPSHOT/commons-math4-core-4.0-20220901.121659-323.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-core/4.0-SNAPSHOT/commons-math4-core-4.0-20220905.130458-327.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-core/4.0-SNAPSHOT/commons-math4-core-4.0-20220901.121659-323-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-core/4.0-SNAPSHOT/commons-math4-core-4.0-20220905.130458-327-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-core/4.0-SNAPSHOT/commons-math4-core-4.0-20220901.121659-323-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-core/4.0-SNAPSHOT/commons-math4-core-4.0-20220905.130458-327-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>

View File

@ -1,13 +1,13 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="Maven: org.apache.commons:commons-math4-legacy:4.0-SNAPSHOT"> <library name="Maven: org.apache.commons:commons-math4-legacy:4.0-SNAPSHOT">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy/4.0-SNAPSHOT/commons-math4-legacy-4.0-20220901.121659-442.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy/4.0-SNAPSHOT/commons-math4-legacy-4.0-20220905.130458-446.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy/4.0-SNAPSHOT/commons-math4-legacy-4.0-20220901.121659-442-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy/4.0-SNAPSHOT/commons-math4-legacy-4.0-20220905.130458-446-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy/4.0-SNAPSHOT/commons-math4-legacy-4.0-20220901.121659-442-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy/4.0-SNAPSHOT/commons-math4-legacy-4.0-20220905.130458-446-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>

View File

@ -1,13 +1,13 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="Maven: org.apache.commons:commons-math4-legacy-core:4.0-SNAPSHOT"> <library name="Maven: org.apache.commons:commons-math4-legacy-core:4.0-SNAPSHOT">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy-core/4.0-SNAPSHOT/commons-math4-legacy-core-4.0-20220901.121659-449.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy-core/4.0-SNAPSHOT/commons-math4-legacy-core-4.0-20220905.130458-453.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy-core/4.0-SNAPSHOT/commons-math4-legacy-core-4.0-20220901.121659-449-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy-core/4.0-SNAPSHOT/commons-math4-legacy-core-4.0-20220905.130458-453-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy-core/4.0-SNAPSHOT/commons-math4-legacy-core-4.0-20220901.121659-449-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy-core/4.0-SNAPSHOT/commons-math4-legacy-core-4.0-20220905.130458-453-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>

View File

@ -1,13 +1,13 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="Maven: org.apache.commons:commons-math4-legacy-exception:4.0-SNAPSHOT"> <library name="Maven: org.apache.commons:commons-math4-legacy-exception:4.0-SNAPSHOT">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy-exception/4.0-SNAPSHOT/commons-math4-legacy-exception-4.0-20220901.121659-458.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy-exception/4.0-SNAPSHOT/commons-math4-legacy-exception-4.0-20220905.130458-462.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy-exception/4.0-SNAPSHOT/commons-math4-legacy-exception-4.0-20220901.121659-458-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy-exception/4.0-SNAPSHOT/commons-math4-legacy-exception-4.0-20220905.130458-462-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy-exception/4.0-SNAPSHOT/commons-math4-legacy-exception-4.0-20220901.121659-458-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/apache/commons/commons-math4-legacy-exception/4.0-SNAPSHOT/commons-math4-legacy-exception-4.0-20220905.130458-462-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>

View File

@ -90,6 +90,32 @@ public class DataConvert {
return buf.getShort(); return buf.getShort();
} }
/**
* Byte array convert to short integer
*
* @param bytes Byte array
* @return Short integer value
*/
public static short bytes2Short(byte[] bytes) {
short sRet = 0;
sRet += (bytes[0] & 0xFF) << 8;
sRet += bytes[1] & 0xFF;
return sRet;
}
/**
* Byte array convert to unsigned short integer
*
* @param bytes Byte array
* @return Unsigned short integer value
*/
public static int bytes2UShort(byte[] bytes) {
return (int)(
(int)(bytes[1] & 0xff) << 8 |
(int)(bytes[0] & 0xff)
);
}
/** /**
* Byte array convert to long integer * Byte array convert to long integer
* *
@ -117,6 +143,17 @@ public class DataConvert {
return result; return result;
} }
/**
* Byte array (2 bytes) convert to integer
*
* @param bytes byte array
* @return Integer value
*/
public static int bytes2Int2(byte[] bytes) {
return bytes[1] & 0xFF |
(bytes[0] & 0xFF) << 8;
}
/** /**
* Byte array (3 bytes) convert to integer * Byte array (3 bytes) convert to integer
* *

View File

@ -51,6 +51,7 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
////First level head record - Part 2 ////First level head record - Part 2
//private string _satelliteName; //private string _satelliteName;
//private int _factorGridField; //private int _factorGridField;
private int channelNumber;
private int _byteGridData; private int _byteGridData;
//private int _refMarkGridData; //private int _refMarkGridData;
//private int _scaleGridData; //private int _scaleGridData;
@ -85,6 +86,9 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
private double _yDelt; private double _yDelt;
private double _xLB; private double _xLB;
private double _yLB; private double _yLB;
private int lenColorTable;
private int lenCalibration;
private int lenLocation;
/// <summary> /// <summary>
/// start observation time /// start observation time
@ -195,7 +199,10 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
this._dataFileName = new String(bytes).trim(); this._dataFileName = new String(bytes).trim();
bytes = new byte[2]; bytes = new byte[2];
br.read(bytes); br.read(bytes);
_orderOfInt = DataConvert.bytes2Int(bytes, byteOrder); _orderOfInt = DataConvert.bytes2Int2(bytes);
if (_orderOfInt != 0) {
this.byteOrder = ByteOrder.BIG_ENDIAN;
}
br.read(bytes); br.read(bytes);
_lenHeadP1 = DataConvert.bytes2Int(bytes, byteOrder); _lenHeadP1 = DataConvert.bytes2Int(bytes, byteOrder);
br.read(bytes); br.read(bytes);
@ -280,6 +287,9 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
} }
} }
tbytes = Arrays.copyOfRange(bytes, yearIdx + 10, yearIdx + 12);
channelNumber = DataConvert.bytes2Int(tbytes, byteOrder);
if (_productType == 3) //Get grid parameters if (_productType == 3) //Get grid parameters
{ {
tbytes = Arrays.copyOfRange(bytes, yearIdx + 20, yearIdx + 22); tbytes = Arrays.copyOfRange(bytes, yearIdx + 20, yearIdx + 22);
@ -312,6 +322,13 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
getProjection(bytes); 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);
br.close(); br.close();
//Set variable list //Set variable list
@ -650,7 +667,9 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
} }
private void readXY_1(Range yRange, Range xRange, IndexIterator ii) throws IOException { private void readXY_1(Range yRange, Range xRange, IndexIterator ii) throws IOException {
byte[] imageBytes = getIamgeData(); Object[] rawData = getImageData();
byte[] imageBytes = (byte[]) rawData[0];
int[] calibration = (int[]) rawData[1];
//Get grid data //Get grid data
int i, j; int i, j;
@ -658,9 +677,18 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
int yNum = (int) _height; int yNum = (int) _height;
float[] data = new float[yNum * xNum]; float[] data = new float[yNum * xNum];
for (i = 0; i < yNum; i++) { if (calibration.length > 0) {
for (j = 0; j < xNum; j++) { for (i = 0; i < yNum; i++) {
data[(yNum - i - 1) * xNum + j] = DataConvert.byte2Int(imageBytes[i * xNum + j]); for (j = 0; j < xNum; j++) {
data[(yNum - i - 1) * xNum + j] = calibration[DataConvert.byte2Int(
imageBytes[i * xNum + j]) * 4] * 0.01f;
}
}
} else {
for (i = 0; i < yNum; i++) {
for (j = 0; j < xNum; j++) {
data[(yNum - i - 1) * xNum + j] = DataConvert.byte2Int(imageBytes[i * xNum + j]);
}
} }
} }
@ -847,7 +875,8 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
} }
private GridData getGridData_1() throws IOException { private GridData getGridData_1() throws IOException {
byte[] imageBytes = getIamgeData(); Object[] rawData = getImageData();
byte[] imageBytes = (byte[]) rawData[0];
//Get grid data //Get grid data
int i, j; int i, j;
@ -879,7 +908,7 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
* @return Image data * @return Image data
* @throws FileNotFoundException * @throws FileNotFoundException
*/ */
public byte[] getIamgeData() throws FileNotFoundException, IOException { public Object[] getImageData() throws FileNotFoundException, IOException {
RandomAccessFile br = new RandomAccessFile(this.getFileName(), "r"); RandomAccessFile br = new RandomAccessFile(this.getFileName(), "r");
byte[] bytes = new byte[_lenHeadP1 + _lenHeadP2]; byte[] bytes = new byte[_lenHeadP1 + _lenHeadP2];
@ -891,6 +920,17 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
int lenVef = DataConvert.bytes2Int(tbytes, byteOrder); int lenVef = DataConvert.bytes2Int(tbytes, byteOrder);
tbytes = Arrays.copyOfRange(bytes, 100, 102); tbytes = Arrays.copyOfRange(bytes, 100, 102);
int lenGeo = DataConvert.bytes2Int(tbytes, byteOrder); int lenGeo = DataConvert.bytes2Int(tbytes, byteOrder);
int[] calibration = new int[lenVef / 2];
if (lenVef > 0) {
br.seek(104);
br.skipBytes(lenPallate);
bytes = new byte[lenVef];
br.read(bytes);
for (int i = 0; i < lenVef / 2; i++) {
calibration[i] = DataConvert.bytes2UShort(
Arrays.copyOfRange(bytes, i * 2, i * 2 + 2));
}
}
//Read byte data //Read byte data
br.seek(_lenRecord * _numHeadRecord); br.seek(_lenRecord * _numHeadRecord);
@ -900,7 +940,7 @@ public class AWXDataInfo extends DataInfo implements IGridDataInfo, IStationData
br.close(); br.close();
return imageBytes; return new Object[]{imageBytes, calibration};
} }
@Override @Override

View File

@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MeteoInfo File="milconfig.xml" Type="configurefile"> <MeteoInfo File="milconfig.xml" Type="configurefile">
<Path OpenPath="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf"> <Path OpenPath="D:\Working\MIScript\Jython\mis\io\awx">
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\gui"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math\stats"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart\subplot"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart\subplot"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\bar"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\bar"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\common_math"/>
@ -11,22 +9,26 @@
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\pie"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\pie"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart\axis"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\chart\axis"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\savefig"/> <RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\savefig"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl"/> <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\plot_types\3d\jogl\surf"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\awx"/>
</Path> </Path>
<File> <File>
<OpenedFiles> <OpenedFiles>
<OpenedFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\mainGUI.py"/> <OpenedFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\mainGUI.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\subplot_3d_cylinder_1.py"/> <OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\subplot_3d_cylinder_1.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surf_spherical_harmonic_1.py"/> <OpenedFile File="D:\Working\MIScript\Jython\mis\io\awx\awx_1.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\awx\awx_3.py"/>
</OpenedFiles> </OpenedFiles>
<RecentFiles> <RecentFiles>
<RecentFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\mainGUI.py"/> <RecentFile File="D:\MyProgram\java\MeteoInfoDev\toolbox\meteoview3d\mainGUI.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\subplot_3d_cylinder_1.py"/> <RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\subplot_3d_cylinder_1.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf\surf_spherical_harmonic_1.py"/> <RecentFile File="D:\Working\MIScript\Jython\mis\io\awx\awx_1.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\io\awx\awx_3.py"/>
</RecentFiles> </RecentFiles>
</File> </File>
<Font> <Font>
@ -34,5 +36,5 @@
</Font> </Font>
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/> <LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
<Figure DoubleBuffering="true"/> <Figure DoubleBuffering="true"/>
<Startup MainFormLocation="-7,0" MainFormSize="1385,790"/> <Startup MainFormLocation="-7,-7" MainFormSize="1293,685"/>
</MeteoInfo> </MeteoInfo>

View File

@ -23,23 +23,44 @@ class Figure(GLChartPanel):
top level container for all plot elements top level container for all plot elements
""" """
def __init__(self, figsize=None, dpi=None, bgcolor='w', **kwargs): def __init__(self, figsize=None, dpi=None, facecolor='w', **kwargs):
""" """
Constructor Constructor
:param figsize: (*list*) Optional, width and height of the figure such as ``[600, 400]``. :param figsize: (*list*) Optional, width and height of the figure such as ``[600, 400]``.
:param bgcolor: (*Color*) Optional, background color of the figure. Default is ``w`` (white). :param facecolor: (*Color*) Optional, fill color of the figure. Default is ``w`` (white).
:param dpi: (*int*) Dots per inch. :param dpi: (*int*) Dots per inch.
""" """
chart = GLChart() chart = GLChart()
chart.setBackground(plotutil.getcolor(bgcolor)) facecolor = plotutil.getcolor(facecolor)
if kwargs.has_key('bgcolor'):
facecolor = plotutil.getcolor(kwargs.pop('bgcolor'))
chart.setBackground(plotutil.getcolor(facecolor))
if figsize is None: if figsize is None:
super(Figure, self).__init__(chart) super(Figure, self).__init__(chart)
else: else:
super(Figure, self).__init__(chart, figsize[0], figsize[1]) super(Figure, self).__init__(chart, figsize[0], figsize[1])
self.axes = [] self.axes = []
self.current_axes = -1 self.current_axes = -1
@property
def facecolor(self):
"""
facecolor property.
:return: Fill color of the figure.
"""
return self.getChart().getBackground()
@facecolor.setter
def facecolor(self, value):
"""
Set facecolor property value.
:param value: Fill color of the figure.
"""
self.getChart().setBackground(plotutil.getcolor(value))
def get_size(self): def get_size(self):
""" """
Get figure size. Get figure size.

View File

@ -39,12 +39,12 @@ g_figure = None
g_axes = None g_axes = None
__all__ = [ __all__ = [
'gca','annotate','antialias','arrow','arrowline','axes','axes3d','axes3dgl','axesm','caxes','axis', 'annotate','antialias','arrow','arrowline','axes','axes3d','axes3dgl','axesm','caxes','axis',
'axism','bar','bar3','barh','barbs','barbsm','bgcolor','box', 'axism','bar','bar3','barh','barbs','barbsm','bgcolor','box',
'boxplot','windrose','cla','clabel','clc','clear','clf','cll','cloudspec','colorbar','contour','contourf', 'boxplot','windrose','cla','clabel','clc','clear','clf','cll','cloudspec','colorbar','contour','contourf',
'contourfm','contourm','contourfslice','contourslice','delfig','draw','draw_if_interactive','errorbar', 'contourfm','contourm','contourfslice','contourslice','delfig','draw','draw_if_interactive','errorbar',
'figure','glfigure','figsize','patch','rectangle','fill','fill_between','fill_betweenx','fimplicit3', 'figure','glfigure','figsize','patch','rectangle','fill','fill_between','fill_betweenx','fimplicit3',
'webmap','gc_collect','geoshow','get_figure','gifaddframe','gifanimation','giffinish', 'webmap','gca','gcf','gc_collect','geoshow','get_figure','gifaddframe','gifanimation','giffinish',
'grid','gridshow','gridshowm','hist','imshow','imshowm','isosurface','legend','left_title','lighting','loglog','makecolors', 'grid','gridshow','gridshowm','hist','imshow','imshowm','isosurface','legend','left_title','lighting','loglog','makecolors',
'makelegend','makesymbolspec','masklayer','mesh','particles','pcolor','pcolorm','pie','plot','plot3','plotm','quiver','quiver3', 'makelegend','makesymbolspec','masklayer','mesh','particles','pcolor','pcolorm','pie','plot','plot3','plotm','quiver','quiver3',
'quiverkey','quiverm','readlegend','right_title','savefig','savefig_jpeg','scatter','scatter3','scatterm', 'quiverkey','quiverm','readlegend','right_title','savefig','savefig_jpeg','scatter','scatter3','scatterm',
@ -65,9 +65,18 @@ def _copy_docstring_and_deprecators(method, func=None):
func = decorator(func) func = decorator(func)
return func return func
def gcf():
"""
Get current figure.
:return: Current figure.
"""
return g_figure
def gca(): def gca():
""" """
Get current axes Get current axes
:return: Current axes :return: Current axes
""" """
return g_axes return g_axes
@ -547,17 +556,17 @@ def windrose(wd, ws, nwdbins=16, wsbins=None, degree=True, colors=None, cmap='ma
return g_axes, bars return g_axes, bars
def figure(bgcolor='w', figsize=None, newfig=True, **kwargs): def figure(facecolor='w', figsize=None, newfig=True, **kwargs):
""" """
Creates a figure. Creates a figure.
:param bgcolor: (*Color*) Optional, background color of the figure. Default is ``w`` (white) . :param facecolor: (*Color*) Optional, fill color of the figure. Default is ``w`` (white) .
:param figsize: (*list*) Optional, width and height of the figure such as ``[600, 400]`` . :param figsize: (*list*) Optional, width and height of the figure such as ``[600, 400]`` .
Default is ``None`` with changable size same as *Figures* window. Default is ``None`` with changeable size same as *Figures* window.
:param newfig: (*boolean*) Optional, if creates a new figure. Default is ``True`` . :param newfig: (*boolean*) Optional, if creates a new figure. Default is ``True`` .
""" """
global g_figure global g_figure
g_figure = Figure(figsize, bgcolor=bgcolor, **kwargs) g_figure = Figure(figsize, facecolor=facecolor, **kwargs)
if not batchmode: if not batchmode:
show(newfig) show(newfig)

View File

@ -332,7 +332,7 @@ public enum DataType {
* convert an unsigned long to a String * convert an unsigned long to a String
* *
* @param li unsigned int * @param li unsigned int
* @return equivilent long value * @return equivalent long value
*/ */
static public String unsignedLongToString(long li) { static public String unsignedLongToString(long li) {
if (li >= 0) { if (li >= 0) {
@ -354,7 +354,7 @@ public enum DataType {
* widen an unsigned int to a long * widen an unsigned int to a long
* *
* @param i unsigned int * @param i unsigned int
* @return equivilent long value * @return equivalent long value
*/ */
static public long unsignedIntToLong(int i) { static public long unsignedIntToLong(int i) {
return (i < 0) ? (long) i + 4294967296L : (long) i; return (i < 0) ? (long) i + 4294967296L : (long) i;
@ -364,7 +364,7 @@ public enum DataType {
* widen an unsigned short to an int * widen an unsigned short to an int
* *
* @param s unsigned short * @param s unsigned short
* @return equivilent int value * @return equivalent int value
*/ */
static public int unsignedShortToInt(short s) { static public int unsignedShortToInt(short s) {
return (s & 0xffff); return (s & 0xffff);
@ -374,7 +374,7 @@ public enum DataType {
* widen an unsigned byte to a short * widen an unsigned byte to a short
* *
* @param b unsigned byte * @param b unsigned byte
* @return equivilent short value * @return equivalent short value
*/ */
static public short unsignedByteToShort(byte b) { static public short unsignedByteToShort(byte b) {
return (short) (b & 0xff); return (short) (b & 0xff);