Closed BaptisteVandecrux closed 1 year ago
@BaptisteVandecrux recognizing that your original intention was only to modify AWS_station_locations.csv
, I like the idea of extrapolating altitude (when needed) for writing to the BUFR, so that we can submit more data to DMI. In the case where we have all instantaneous vars, lat and lon, but simply missing altitude, I think extrapolation is warranted.
The most recent commit has the following changes:
find_positions
. I took the previous fetch_old_positions
function, renamed it and added functionality. write_positions
has been removed. I also stripped the logic for combining Iridium messages and doing linear regression, etc out of getBUFR
, and instead do everything in find_positions
(whether for a processed station or a skipped station). This function sets positions in df_limited
(for use in the BUFR) as well as setting in the positions
dict, which will be written to the csv file.getBUFR
wmo_config.py
for new or unregistered stationsThe main problem right now is that I am reading from '../aws-l3/tx/*/*_hour.csv'
to get the transmitted data (need instantaneous obs). These files only go back a limited amount of time. So, even though we are trying to extrapolate using "full history", we are still not getting altitude for ['SCO_U', 'TAS_A', 'SCO_L']
! I am printing the min timestamp available now in the console output if we try full history extrapolation. For example:
####### Processing SCO_L #######
Generating SCO_L.bufr from ../aws-l3/tx/SCO_L/SCO_L_hour.csv
TIMESTAMP: 2023-05-10 06:00:00
----> Running in dev mode!
Time checks passed.
finding positions for SCO_L
last transmission: 2023-05-10 09:00:00
----> Insufficient gps_alt data for SCO_L!
----> Using full history for linear extrapolation: gps_alt
first transmission: 2020-07-01 00:00:00
----> Insufficient gps_alt data for SCO_L!
----> No data exists for gps_alt. Stubbing out with NaN.
writing positions for SCO_L
----> Failed min_data_check for position!
So, not sure what to do here.... I suppose we could read from a different source? We are running into an issue (which @PennyHow identified early on), that getBUFR
is primarily meant for writing BUFR files for DMI.... but since I was dealing with positions, I decided to add functionality to write the positions csv file. It may have been better to put this as a standalone routine (like getPositions
), but now we have everything fairly "baked in" here.....
Anyhow, it would be great to get a general review of this new logic @BaptisteVandecrux! I have tested it and it seems to be working.
You can test just this module as follows (locally or on glacio01):
aws-l0
and aws-l3
pypromice
, then pip install .
(with env activated)getBUFR --positions
. You can embed()
in the code to debug (if you like using IPython embed
).getBUFR --positions --dev
which will allow you to bypass the time checks and re-run the most recent transmissions.It also looks like we are getting no position data for QAS_Lv3
. Does that make sense?
Fixing this issue