lair.noaa.CarbonTracker.sample#
- CarbonTracker.sample(points)[source]#
Sample the molefraction field at
points.pointsis a DataFrame with columnsdatetime(UTC sample time),lati,long,zagl, as in a PYSTILT particle table (for exampleparticles.stilt.endpoints()); any other columns (e.g.indx,receptor) are carried through for downstream grouping. Returns one row per input point withct_<specie>_<units>and the CT cell/level used. Points whose UTC date has no molefraction file are dropped.Each point takes the time step whose center is nearest: the steps are 3-hour means labeled by their centers (
ct_time: 01:30, 04:30, … UTC), so a point takes the mean of the period it is in, and a point on the boundary of two periods (03:00) takes the later one.- Parameters:
points (pd.DataFrame) – The points, with the columns
datetime(UTC),latiandlong(degrees) andzagl(meters above ground).- Returns:
pd.DataFrame – The points, with
ct_<specie>_<units>(ct_ch4_ppb) and the cell, time and level it came from (ct_latitude,ct_longitude,ct_time,ct_level). A point outside the grid gets NaN.- Return type:
See also
CarbonTracker.backgroundTheir mean.
Examples
The CarbonTracker example samples four points west of Salt Lake City; it reads the folder of one downloaded day:
points = pd.DataFrame( { "datetime": pd.to_datetime(["2020-01-15 17:00"] * 2), # UTC "lati": [41.5, 39.5], "long": [-114.5, -114.5], "zagl": [100.0, 100.0], } ) ct.sample(points)[["lati", "ct_ch4_ppb", "ct_time", "ct_level"]]