Skip to content

add new obstype is difficult #542

@spuynen

Description

@spuynen

#Createing an obstype

wbgt_obstype = mt.Obstype(obsname='WBGT', std_unit='degree_Celsius',
                  description='The Wet Bulb Globe Temperature as an index for heat stress, calculated from T, BGT and RH')

wbgt_obstype._original_unit = 'degree_Celsius'

mt_dataset.add_new_observationtype(wbgt_obstype)
#%%
from metobs_toolkit import SensorData


for staname in WBGT.index.get_level_values('name').unique():
    stawbgt = WBGT.xs(staname, level='name', drop_level=False)
    
    
    wbgt_sensor = SensorData(stationname=staname,
                             datarecords=stawbgt['value'].to_numpy(),
                             timestamps=stawbgt.index.get_level_values('datetime').to_numpy(),
                             obstype=wbgt_obstype)
    
    mt_dataset.get_station(staname).add_to_sensordata(wbgt_sensor, force_update=True)


mt_dataset.make_plot(obstype='WBGT', colorby='station')

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions