-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
monet/monet_accessor.py : monet.to_ascii2nc_list : var column restricted to integers when should be strings #151
Comments
I think we need a little more information here. The gribcode should be able to mapped to a specific variable we should look at the grib tables to see what the variables are. MONET reads directly from the AERONET server and so we aren't reading the grib data itself. We could have an internal mapping to add the grib table there but it isn't available from the AERONET website. |
Of all these arguments, grib code and message_type are the only ones that don't reach back to the AERONET dataframe. The user picks this grib_code out of thin air. Any integer will do and will get passed through to the output under the var column. But it demands an integer and that's the bug. It should operate like the message_type argument and accept whatever is passed in. This demanded integer It would be better if the column string that gets passed in was also used to populate the var column of the out dataframe. Right now, that string is used to reach back to the AERONET dataframe that monetio made. It grabs the data from df[column] and that data fills out the val column. If that column string were used to populate the var column, each value would retain its relationship to the column it came from. At the very least, line 277 should be changed to remove the int requirement. That would allow me to define my variables manually without being restricted to using integers. |
These two do not reach back to the aeronet data frame because they are not defined there. As you mentioned they are defined by the user. The |
monet/monet_accessor.py
277 df["ascii2nc_gribcode"] = int(grib_code)
According to the MET docs the var column should come through as a string so as to allow for GRIB codes and string variables. The datatype in the column has the default data type as string.
(see Table 37.2):
https://met.readthedocs.io/en/latest/Users_Guide/appendixF.html#python-embedding-for-point-observations
As it sits now, in order to use this code for python embedding I'm restricted to using an integer to define variables, which isn't always going to be the case.
Here's an example of how I'm using monet and a line of output to illustrate:
message type : station ID : valid time : lat : lon : msl : var : level : agl : qc : val
['AERONET AOD15', 'Huambo', '20170925_103207', -12.8679, 15.7046, None, '2', 1000.0, None, '0', 34.4]
From
monet/monet_accessor.py
grib_code is our variable and it won't always be an integer. For instance, I pulled in AERONET data using monetio and when converting that data to the list required by MET I'd like to pick from the column names that get output when I first create the dataframe using:
df = monetio.aeronet.add_data(dates=dates, product='AOD15') print (df.columns.tolist())
Since these variables aren't in grib codes I can't exactly translate what they are to the MET output.
The docs dictate that the var column should contain strings so the following changes ought to remedy it.
The text was updated successfully, but these errors were encountered: