From b2f31adc7dce3350db9662c76e5178a285a3273f Mon Sep 17 00:00:00 2001 From: cemeng Date: Sat, 13 Mar 2021 17:43:57 +0800 Subject: [PATCH 1/2] change the Record constructr so we can change the plateform id --- src/little_r/record.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/little_r/record.py b/src/little_r/record.py index b6bc639..c3ed45e 100644 --- a/src/little_r/record.py +++ b/src/little_r/record.py @@ -141,8 +141,9 @@ class Record: Currently, only one measurement per record is supported ''' - def __init__(self, station_name, lat, lon, height, time, **kwargs): - self.station_name = station_name + def __init__(self, station_name, plateform, lat, lon, height, time, **kwargs): + self.station_name = "%-40s"%station_name + self.plateform = "%-40s"%plateform self.lat = lat self.lon = lon self.time = time @@ -240,9 +241,9 @@ def message_header(self): self.lat, # station latitude (north positive) self.lon, # station longitude (east positive) self.station_name, # string1 ID of station - 'Station name', # string2 Name of station - 'FM-12 SYNOP', # string3 Description of the measurement device - 'String 4', # string4 GTS, NCAR/ADP, BOGUS, etc. + ' ', # string2 Name of station + self.plateform, # string3 Description of the measurement device + ' ', # string4 GTS, NCAR/ADP, BOGUS, etc. self.height, # terrain elevation (m) --> 1f20.5 6, # Number of valid fields in the report (kx*6) 0, # Number of errors encountered during the decoding of this observation (0) From 13aa985c9fd89106acc6260e6c4eeb4eb99111af Mon Sep 17 00:00:00 2001 From: cyemeng Date: Mon, 25 Oct 2021 18:05:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0station=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/little_r/record.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/little_r/record.py b/src/little_r/record.py index c3ed45e..eafc435 100644 --- a/src/little_r/record.py +++ b/src/little_r/record.py @@ -141,8 +141,9 @@ class Record: Currently, only one measurement per record is supported ''' - def __init__(self, station_name, plateform, lat, lon, height, time, **kwargs): - self.station_name = "%-40s"%station_name + def __init__(self, id, name, plateform, lat, lon, height, time, **kwargs): + self.id = "%-40s"%id + self.name = "%-40s"%name self.plateform = "%-40s"%plateform self.lat = lat self.lon = lon @@ -240,8 +241,8 @@ def message_header(self): data = [ self.lat, # station latitude (north positive) self.lon, # station longitude (east positive) - self.station_name, # string1 ID of station - ' ', # string2 Name of station + self.id, # string1 ID of station + self.name, # string2 Name of station self.plateform, # string3 Description of the measurement device ' ', # string4 GTS, NCAR/ADP, BOGUS, etc. self.height, # terrain elevation (m) --> 1f20.5