kopia lustrzana https://github.com/projecthorus/radiosonde_auto_rx
Merge branch 'testing' into testing
commit
e8bf52151e
|
|
@ -29,6 +29,17 @@ def log_filename_to_stats(filename):
|
|||
# Example log file name: 20210430-235413_IMET-89F2720A_IMET_401999_sonde.log
|
||||
# ./log/20200320-063233_R2230624_RS41_402500_sonde.log
|
||||
|
||||
# Get a rough estimate of the number of lines of telemetry
|
||||
_filesize = os.path.getsize(filename)
|
||||
# Don't try and load files without data.
|
||||
if _filesize < 140:
|
||||
return None
|
||||
|
||||
_lines = _filesize // 140 - 1
|
||||
|
||||
if _lines <= 0:
|
||||
_lines = 1
|
||||
|
||||
_basename = os.path.basename(filename)
|
||||
|
||||
_now_dt = datetime.datetime.now(datetime.timezone.utc)
|
||||
|
|
@ -63,6 +74,7 @@ def log_filename_to_stats(filename):
|
|||
"serial": _serial,
|
||||
"type": _type_str,
|
||||
"freq": _freq,
|
||||
"lines": _lines,
|
||||
}
|
||||
|
||||
except Exception as e:
|
||||
|
|
@ -157,6 +169,11 @@ def read_log_file(filename, skewt_decimation=10):
|
|||
|
||||
_file.close()
|
||||
|
||||
|
||||
if _data.size == 1:
|
||||
# Deal with log files with only one entry cleanly.
|
||||
_data = np.array([_data])
|
||||
|
||||
# Now we need to rearrange some data for easier use in the client
|
||||
_output = {"serial": strip_sonde_serial(_data[fields["serial"]][0])}
|
||||
|
||||
|
|
@ -231,8 +248,8 @@ def calculate_skewt_data(
|
|||
while i < _burst_idx:
|
||||
i += decimation
|
||||
try:
|
||||
if temperature[i] < -260.0 or humidity[i] < 0.0:
|
||||
# If we don't have any valid temp or humidity data, just skip this point
|
||||
if temperature[i] < -260.0:
|
||||
# If we don't have any valid temp data, just skip this point
|
||||
# to avoid doing un-necessary calculations
|
||||
continue
|
||||
|
||||
|
|
@ -256,13 +273,17 @@ def calculate_skewt_data(
|
|||
_pressure = pressure[i]
|
||||
|
||||
_temp = temperature[i]
|
||||
_rh = humidity[i]
|
||||
|
||||
_dp = (
|
||||
243.04
|
||||
* (np.log(_rh / 100) + ((17.625 * _temp) / (243.04 + _temp)))
|
||||
/ (17.625 - np.log(_rh / 100) - ((17.625 * _temp) / (243.04 + _temp)))
|
||||
)
|
||||
if humidity[i] >= 0.0:
|
||||
_rh = humidity[i]
|
||||
|
||||
_dp = (
|
||||
243.04
|
||||
* (np.log(_rh / 100) + ((17.625 * _temp) / (243.04 + _temp)))
|
||||
/ (17.625 - np.log(_rh / 100) - ((17.625 * _temp) / (243.04 + _temp)))
|
||||
)
|
||||
else:
|
||||
_dp = -999.0
|
||||
|
||||
if np.isnan(_dp):
|
||||
continue
|
||||
|
|
@ -320,4 +341,4 @@ if __name__ == "__main__":
|
|||
|
||||
if len(sys.argv) > 1:
|
||||
print(f"Attempting to read serial: {sys.argv[1]}")
|
||||
read_log_by_serial(sys.argv[1])
|
||||
print(read_log_by_serial(sys.argv[1]))
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@
|
|||
var SkewT = function(div) {
|
||||
//properties used in calculations
|
||||
var wrapper = d3.select(div);
|
||||
var width = parseInt(wrapper.style('width'), 10);
|
||||
var height = width; //tofix
|
||||
// These width and height values get used when the plot is first shown
|
||||
var width = parseInt(wrapper.style('width'), 10)-100;
|
||||
var height = width;//parseInt(wrapper.style('height'), 10)-100; // width; //tofix
|
||||
var margin = {top: 30, right: 40, bottom: 20, left: 35}; //container margins
|
||||
var deg2rad = (Math.PI/180);
|
||||
var tan = Math.tan(55*deg2rad);
|
||||
|
|
@ -37,7 +38,8 @@ var SkewT = function(div) {
|
|||
|
||||
//local functions
|
||||
function setVariables() {
|
||||
width = parseInt(wrapper.style('width'), 10) -10; // tofix: using -10 to prevent x overflow
|
||||
// These width and height values get calculated when the plot is updated
|
||||
width = parseInt(wrapper.style('width'), 10) - 10; // tofix: using -10 to prevent x overflow
|
||||
height = width; //to fix
|
||||
w = width - margin.left - margin.right;
|
||||
h = width - margin.top - margin.bottom;
|
||||
|
|
@ -217,8 +219,8 @@ var SkewT = function(div) {
|
|||
tmpcfocus.attr("transform", "translate(" + (x(d.temp) + (y(basep)-y(d.press))/tan)+ "," + y(d.press) + ")");
|
||||
dwpcfocus.attr("transform", "translate(" + (x(d.dwpt) + (y(basep)-y(d.press))/tan)+ "," + y(d.press) + ")");
|
||||
hghtfocus.attr("transform", "translate(0," + y(d.press) + ")");
|
||||
tmpcfocus.select("text").text(Math.round(d.temp)+"°C");
|
||||
dwpcfocus.select("text").text(Math.round(d.dwpt)+"°C");
|
||||
tmpcfocus.select("text").text("Temp: "+Math.round(d.temp)+"°C");
|
||||
dwpcfocus.select("text").text("DP: "+Math.round(d.dwpt)+"°C");
|
||||
hghtfocus.select("text").text("-- "+Math.round(d.hght)+" m"); //hgt or hghtagl ???
|
||||
wspdfocus.attr("transform", "translate(" + (w-65) + "," + y(d.press) + ")");
|
||||
wspdfocus.select("text").text(Math.round(convert(d.wspd, unit)*10)/10 + " " + unit);
|
||||
|
|
|
|||
Plik diff jest za duży
Load Diff
Ładowanie…
Reference in New Issue