support read_dataframe function for micaps 3 dataset

This commit is contained in:
wyq 2022-11-28 20:48:47 +08:00
parent 15b2c381b4
commit fd22bcb973
5 changed files with 18 additions and 17 deletions

View File

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

View File

@ -288,8 +288,7 @@ public class MICAPS3DataInfo extends DataInfo implements IStationDataInfo {
for (String vName : this._fieldList) {
switch (vName) {
case "Stid":
dtype = DataType.STRING;
break;
continue;
default:
dtype = DataType.FLOAT;
break;
@ -305,12 +304,9 @@ public class MICAPS3DataInfo extends DataInfo implements IStationDataInfo {
for (int j = 0; j < data.size(); j++) {
dd = (Array) data.get(j);
switch (dd.getDataType()) {
case STRING:
dd.setString(i, dataList.get(j));
break;
case FLOAT:
try {
dd.setFloat(i, Float.parseFloat(dataList.get(j)));
dd.setFloat(i, Float.parseFloat(dataList.get(j + 1)));
} catch (Exception e) {
dd.setFloat(i, Float.NaN);
}

View File

@ -22,14 +22,12 @@
<OpenedFile File="D:\Working\MIScript\Jython\mis\common_math\linalg\norm_1.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\micaps\micaps_3.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\micaps\micaps_3-2.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\micaps\micaps_3_dataframe_1.py"/>
</OpenedFiles>
<RecentFiles>
<RecentFile File="D:\Working\MIScript\Jython\mis\LaSW\airship\sounding.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\common_math\linalg\norm_1.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\io\micaps\micaps_3.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\io\micaps\micaps_3-2.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\io\micaps\micaps_3_dataframe_1.py"/>
</RecentFiles>
</File>
<Font>
@ -37,5 +35,5 @@
</Font>
<LookFeel DockWindowDecorated="true" LafDecorated="true" Name="FlatDarkLaf"/>
<Figure DoubleBuffering="true"/>
<Startup MainFormLocation="-7,0" MainFormSize="1394,795"/>
<Startup MainFormLocation="-7,-7" MainFormSize="1293,685"/>
</MeteoInfo>

View File

@ -495,7 +495,7 @@ def flowfun(u, v):
return psi, phi
def eof(x, svd=True, transform=False):
def eof(x, svd=True, transform=False, return_index=False):
"""
Empirical Orthogonal Function (EOF) analysis to finds both time series and spatial patterns.
@ -504,9 +504,10 @@ def eof(x, svd=True, transform=False):
:param transform: (*boolean*) Do space-time transform or not. This transform will speed up
the computation if the space location number is much more than time stamps. Only valid
when ``svd=False``.
:param return_index: (*bool*) Whether return valid index. Default is `False`.
:returns: (EOF, E, PC) EOF: eigen vector 2-D array; E: eigen values 1-D array;
PC: Principle component 2-D array.
:returns: (EOF, E, PC, [valid_index]) EOF: eigen vector 2-D array; E: eigen values 1-D array;
PC: Principal component 2-D array. Optional valid_index: Valid data (not NaN) index 1-D array.
"""
has_nan = False
if x.contains_nan(): #Has NaN value
@ -549,9 +550,15 @@ def eof(x, svd=True, transform=False):
_PC = np.ones(x.shape) * np.nan
_EOF[valid_idx,:] = EOF
_PC[valid_idx,:] = PC
return _EOF, E, _PC, valid_idx
if return_index:
return _EOF, E, _PC, valid_idx
else:
return _EOF, E, _PC
else:
return EOF, E, PC
if return_index:
return EOF, E, PC, np.arange(x.shape[0])
else:
return EOF, E, PC
def varimax(x, normalize=False, tol=1e-10, it_max=1000):
"""