You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from ndbc_api import NdbcApi
api = NdbcApi()
# get all standard meterological measurements for stations tplm2 and apam2
stdmet_df = api.get_data(
station_ids=['tplm2', 'apam2'],
mode='stdmet',
start_time='2021-01-01',
end_time='2022-01-01',
)
stdmet_df
The index of the returned df is only the timestamp, resulting in a non-unique index (because timestamps can be duplicated between different stations). Perhaps it may be useful to make station_id an index as well.
In addition to better leveraging pandas's index-based functions, this would also make it easier to flip between pandas and xarray (since df.to_xarray() uses those indices), for example.
(it's easy enough to do 'manually' through stdmet_df.reset_index().set_index(['station_id','timestamp']), but it may be a neater way of showing this information)
Thank you for this suggestion as well @ks905383, I will include it in the next release. You make an excellent point on index uniqueness. I will include this in the next release.
As for #51 , the suggestions are incorporated in #52 and the release in #53. I am scoping an appropriate change which allows for station metadata in the returned xarray Datasets. Thanks again for the suggestions!
When getting observations from multiple stations:
The index of the returned
df
is only thetimestamp
, resulting in a non-unique index (because timestamps can be duplicated between different stations). Perhaps it may be useful to makestation_id
an index as well.In addition to better leveraging
pandas
's index-based functions, this would also make it easier to flip betweenpandas
andxarray
(sincedf.to_xarray()
uses those indices), for example.(it's easy enough to do 'manually' through
stdmet_df.reset_index().set_index(['station_id','timestamp'])
, but it may be a neater way of showing this information)This is related to JOSS review openjournals/joss-reviews#7406.
The text was updated successfully, but these errors were encountered: