Search
Example aas etal read
import pyaerocom as pya
pya.__version__
'0.8.1.dev3'

NOTE: needs version 0.8.1.dev3 or later!

pya.const.BASEDIR = '/home/notebook/shared-ns1000k/inputs/pyaerocom-testdata/'
Initiating directories for pyaerocom test dataset
pya.const.OBS_IDS
['AeronetSunV2Lev1.5.daily',
 'AeronetSun_2.0_NRT',
 'AeronetSunV2Lev2.daily',
 'AeronetSunV2Lev2.AP',
 'AeronetSDAV2Lev2.daily',
 'AeronetSDAV2Lev2.AP',
 'AeronetInvV2Lev1.5.daily',
 'AeronetInvV2Lev1.5.AP',
 'AeronetInvV2Lev2.daily',
 'AeronetInvV2Lev2.AP',
 'AeronetSunV3Lev1.5.daily',
 'AeronetSunV3Lev1.5.AP',
 'AeronetSunV3Lev2.daily',
 'AeronetSunV3Lev2.AP',
 'AeronetSDAV3Lev1.5.daily',
 'AeronetSDAV3Lev1.5.AP',
 'AeronetSDAV3Lev2.daily',
 'AeronetSDAV3Lev2.AP',
 'AeronetInvV3Lev1.5.daily',
 'AeronetInvV3Lev2.daily',
 'EBASMC',
 'EEAAQeRep',
 'EARLINET',
 'GAWTADsubsetAasEtAl',
 'DMS_AMS_CVO']

NOTE: these are all observation data IDs that are theoretically available, but some of them are not provided in the pyaerocom-testdata database. You can check using pya.browse_database

read_factory = pya.io.ReadUngridded('GAWTADsubsetAasEtAl')
read_factory.get_reader().PROVIDES_VARIABLES
['concso2', 'concso4', 'pr', 'wetso4', 'concso4pr']
obsdata = read_factory.read('GAWTADsubsetAasEtAl', 'concso4')
obsdata
UngriddedData <networks: ['GAWTADsubsetAasEtAl']; vars: ['concso4']; instruments: ['3_stage_filterpack', 'IMPROVE_PM2.5', 'filter-1pack', 'filter_1pack', 'filter_3pack', 'filter_2pack', 'pm10_sampler', 'filter_denuder_sampler', 'filter-3pack'];No. of stations: 346
obsdata.plot_station_coordinates();
len(obsdata.metadata)
346
print(obsdata.unique_station_names)
['Abington', 'Acadia NP', 'Acadia_NP', 'Addison_Pinnacle', 'Agua_Tibia', 'Algoma', 'Alhambra', 'Ambler', 'Anholt', 'Ann Arbor', 'Arches_NP', 'Arendtsville', 'Ashland', 'Badlands_NP', 'Baengnyeong_Island', 'Bandelier_NM', 'Barcarrota', 'Barcombe Mills', 'Barrier_Lake', 'Beaufort', 'Beltsville', 'Big Bend NP', 'Big_Bend_NP', 'Birkenes I and II', 'Blackwater NWR', 'Bliss_SP_(TRPA)', 'Blue_Mounds', 'Bondville', 'Bosque_del_Apache', 'Boulder_Lake', 'Boundary_Waters_Canoe_Area', 'Bredkälen', 'Breton', 'Breton_Island', 'Bridger_Wilderness', 'Bridgton', 'Brigantine_NWR', 'Brooklyn_Lake', 'Bryce_Canyon_NP', 'Cabinet_Mountains', 'Cabo de Creus', 'Caddo Valley', 'Cadiz', 'Candor', 'Caney_Creek', 'Canyonlands NP', 'Canyonlands_NP', 'Cape_Cod', 'Cape_Romain_NWR', 'Capitol_Reef_NP', 'Casco_Bay', 'Cedar Creek', 'Cedar_Bluff', 'Centennial', 'Chalk River', 'Chapais', 'Chassahowitzka_NWR', 'Cheju', 'Cherokee_Nation', 'Chiang Mai (Mae Hia)', 'Chiricahua NM', 'Chiricahua_NM', 'Chopok', 'Claryville', 'Cloud_Peak', 'Coffeeville', 'Cohutta', 'Columbia_Gorge_#1', 'Columbia_River_Gorge', 'Connecticut Hill', 'Connecticut_Hill', 'Coweeta', 'Cranberry', 'Crater_Lake_NP', 'Craters_of_the_Moon_NM', 'Crescent_Lake', 'Crockett', 'Danki', 'Death_Valley_NP', 'Deer Creek', 'Denali NP', 'Denali_NP', 'Diabla Gora', 'Dolly_Sods_Wilderness', 'Dome_Lands_Wilderness', 'Donon', 'Douglas', 'E.L.A.', 'Edgar Evins', 'Egbert', 'El_Dorado_Springs', 'Ellis', 'Els Torms', 'Eskdalemuir', 'Everglades NP', 'Everglades_NP', 'Flat_Tops', 'Flathead', 'Fort_Peck', 'Frostberg_Reservoir_(Big_Piney_Run)', 'Gates_of_the_Arctic_NP', 'Gates_of_the_Mountains', 'Georgia Station', 'Gila_Wilderness', 'Glacier NP', 'Glacier_NP', 'Glen Dye', 'Gothic', 'Grand Canyon NP', 'Great Basin NP', 'Great Smoky NP - Look Rock', 'Great_Basin_NP', 'Great_Gulf_Wilderness', 'Great_River_Bluffs', 'Great_Sand_Dunes_NM', 'Great_Smoky_Mountains_NP', 'Guadalupe_Mountains_NP', 'Haleakala_Crater', 'Haleakala_NP', 'Hance_Camp_at_Grand_Canyon_NP', 'Hawaii_Volcanoes_NP', 'Hells_Canyon', 'Hercules-Glades', 'High Muffles', 'Hillside', 'Hoa Binh', 'Hoburgen', 'Hoover', 'Hopi_Point_#1', 'Horton Station', 'Howland', 'Hoxeyville', "Ike's_Backbone", 'Imsil', 'Indian_Gardens', 'Iraty', 'Iskrba', 'Isle_Royale_NP', 'Ispra', 'James_River_Face_Wilderness', 'Janiskoski', 'Jarbidge_Wilderness', 'Jarczew', 'Jefferson_NF', 'Joshua Tree NP', 'Joshua_Tree_NP', 'K-puszta', 'Kaiser', 'Kalmiopsis', 'Kane Exp. Forest', 'Kanghwa', 'Kejimkujik', 'Khanchanaburi (Vachiralongkorn Dam)', 'Kollumerwaard', 'Kosetice', 'Kårvatn', 'La Crouzille', 'Lake_Sugema', 'Lake_Tahoe_Community_College', 'Lassen Volcanic NP', 'Lassen_Volcanic_NP', 'Laurel Hill', 'Lava_Beds_NM', 'Leba', 'Linville_Gorge', 'Listvyanka', 'Livonia', 'Logroño', 'Londonderry', 'Lone_Peak_Wilderness', 'Longwoods', 'Lostwood', 'Lough Navar', 'Lye_Brook_Wilderness', 'Lykens', 'Lynden', 'M.K. Goddard', 'M.K._Goddard', 'Mackville', 'Mackville Collocated', 'Makah_Tribe', 'Makah_Tribe_Site_#2', 'Mammoth_Cave_NP', "Martha's_Vineyard", 'Meadview', 'Medicine_Lake', 'Melpitz', 'Mesa Verde NP', 'Mesa_Verde_NP', 'Mingo', 'Mohawk_Mt.', 'Mondy', 'Montelibretti', 'Monture', 'Moosehorn_NWR', 'Morvan', 'Mount Rainier NP', 'Mount_Baldy', 'Mount_Hood', 'Mount_Rainier_NP', 'Mount_Zirkel_Wilderness', 'Nebraska_NF', 'Niembro', 'North_Absaroka', 'North_Cascades', 'Northern_Cheyenne', 'O Saviñao', 'Okefenokee_NWR', 'Oki', 'Old_Town', 'Olympic', 'Omaha', 'Organ_Pipe', 'Osen', 'Oulanka', 'Owens_Valley', 'Oxford', 'Pack_Monadnock_Summit', 'Pallas (Matorova)', 'Parsons', 'Pasayten', 'Payerne', 'Penausende', 'Penn State', 'Penobscot', 'Perkinstown', 'Petersburg', 'Petrified_Forest_NP', 'Peyrusse Vieille', 'Pinedale', 'Pinnacles NM', 'Pinnacles_NM', 'Point_Reyes_National_Seashore', 'Preila', 'Presque_Isle', 'Primorskaya', 'Prince Edward', 'Proctor_Maple_R._F.', 'Quabbin_Summit', 'Quaker City', 'Quaker_City', 'Queen_Valley', 'Redwood_NP', 'Ripple_Creek', 'Rishiri', 'Rocky Mtn NP', 'Rocky_Mountain_NP', 'Rocky_Mountain_NP_HQ', 'Rucava', 'Rörvik-Råö', 'Sac_and_Fox', 'Saguaro_NM', 'Saguaro_West', 'Salamonie Reservoir', 'Salmon_NF', 'Salt_Creek', 'San_Andres', 'San_Gabriel', 'San_Gorgonio_Wilderness', 'San_Pedro_Parks', 'San_Rafael', 'Sand Mountain', 'Saturna', 'Sawtooth_NF', 'Scoville', 'Seney', 'Sequoia_NP', 'Serpong', 'Shamrock_Mine', 'Shenandoah NP - Big Meadows', 'Shenandoah_NP', 'Shining_Rock_Wilderness', 'Sierra_Ancha', 'Sikes', 'Simeonof', 'Sipsey_Wilderness', 'Sniezka', 'Snoqualmie_Pass', 'South_Lake_Tahoe', 'Speedwell', 'Spokane_Res.', 'St._Marks', 'Starkey', 'Stilwell', 'Stockton', 'Storm_Peak', 'Strath Vaich Dam', 'Sula_Peak', 'Sumatra', 'Svratouch', 'Swanquarter', 'Sycamore_Canyon', 'Tallgrass', 'Tanah Rata', 'Tange', 'Terelj', 'Theodore Roosevelt NP', 'Theodore_Roosevelt', 'Three_Sisters_Wilderness', 'Thunder_Basin', 'Tonto_NM', 'Trapper_Creek', 'Trinity', 'Tustervatn', 'Tuxedni', 'UL_Bend', 'Unionville', 'Upper_Buffalo_Wilderness', 'Utö', 'Valentia', 'Valentia Observatory', 'Vavihill', 'Viking_Lake', 'Vincennes', 'Virgin_Islands_NP', 'Virolahti', 'Virolahti II', 'Voyageurs NP', 'Voyageurs_NP_#1', 'Voyageurs_NP_#2', 'Vredepeel', 'Víznar', 'WY', 'Walker_River_Paiute_Tribe', 'Wash. Crossing', 'Weminuche_Wilderness', 'Wheeler_Peak', 'White_Mountain', 'White_Pass', 'White_River_NF', 'Whiteface Mountain', 'Wichita_Mountains', 'Wind_Cave', 'Woodstock', 'Wrightwood', 'Yarner Wood', 'Yellowstone NP', 'Yellowstone_NP_1', 'Yellowstone_NP_2', 'Yosemite NP - Turtleback Dome', 'Yosemite_NP', 'Zarra', 'Zeppelin mountain (Ny-Ålesund)', 'Zion', 'Zion_Canyon', 'Ähtäri I-II']
station = obsdata.to_station_data('Tana*')
print(station)
Pyaerocom StationData
---------------------
var_info (BrowseDict):
  concso4 (OrderedDict):
    units: ug m-3
    overlap: False
station_coords (dict):
  latitude: 4.466667
  longitude: 101.383333
  altitude: nan
data_err (BrowseDict): <empty_dict>
overlap (BrowseDict): <empty_dict>
data_flagged (BrowseDict): <empty_dict>
filename: /home/notebook/shared-ns1000k/inputs/pyaerocom-testdata//obsdata/GAWTADSulphurSubset/data/monthly_so4_aero.csv
station_id: None
station_name: Tanah Rata
instrument_name: 3_stage_filterpack
PI: None
country: None
ts_type: monthly
latitude: 4.466667
longitude: 101.383333
altitude: nan
data_id: GAWTADsubsetAasEtAl
dataset_name: None
data_product: None
data_version: None
data_level: None
revision_date: None
website: None
ts_type_src: monthly
stat_merge_pref_attr: None
data_revision: 20190522

Data arrays
.................
dtime (ndarray, 188 items): [2000-01-01T00:00:00.000000000, 2000-02-01T00:00:00.000000000, ..., 2015-11-01T00:00:00.000000000, 2015-12-01T00:00:00.000000000]
Pandas Series
.................
concso4 (Series, 188 items)
station.plot_timeseries('concso4');
/opt/conda/lib/python3.7/site-packages/pandas/plotting/_matplotlib/converter.py:103: FutureWarning: Using an implicitly registered datetime converter for a matplotlib plotting method. The converter was registered by pandas on import. Future versions of pandas will require you to explicitly register matplotlib converters.

To register the converters:
	>>> from pandas.plotting import register_matplotlib_converters
	>>> register_matplotlib_converters()
  warnings.warn(msg, FutureWarning)
help(station.compute_trend)
Help on method compute_trend in module pyaerocom.stationdata:

compute_trend(var_name, start_year=None, stop_year=None, season=None, slope_confidence=None, **alt_range) method of pyaerocom.stationdata.StationData instance

trend_info = station.compute_trend('concso4', start_year=2001, stop_year=2009)
trend_info
{'pval': 0.002365577053397881,
 'm': 0.13073429925325294,
 'm_err': 0.028531628463017787,
 'n': 9,
 'y_mean': 1.0410477935443632,
 'y_min': 0.5018000155933261,
 'y_max': 1.5303652216851187,
 'coverage': None,
 'slp': 24.072939013178072,
 'slp_err': 7.460016102620728,
 'reg0': 0.5430757714364916,
 't0': None,
 'slp_2001': 24.072939013178072,
 'slp_2001_err': 7.460016102620728,
 'reg0_2001': 0.5430757714364916,
 'yoffs': -3.50968750541435,
 'period': '2001-2009'}
trend_info = station.compute_trend('concso4', start_year=2011, stop_year=2016)
trend_info
{'pval': 0.022977401503206086,
 'm': 0.5454890716773222,
 'm_err': 0.2533965252871774,
 'n': 5,
 'y_mean': 2.009197276365716,
 'y_min': 1.2232935703518897,
 'y_max': 3.325361297364729,
 'coverage': None,
 'slp': 149.65753424657507,
 'slp_err': 237.74789181341114,
 'reg0': 0.3644915536150535,
 't0': None,
 'slp_2011': 149.65753424657507,
 'slp_2011_err': 237.74789181341114,
 'reg0_2011': 0.3644915536150535,
 'yoffs': -22.000560385155158,
 'period': '2011-2016'}
help(station.trends['concso4'].plot)
Help on method plot in module pyaerocom.trends_helpers:

plot(season='all', period=None, ax=None) method of pyaerocom.trends_helpers.TrendsEngine instance

station.trends['concso4'].plot(period='2001-2009');
<matplotlib.axes._subplots.AxesSubplot at 0x7ff778cff208>
station.trends['concso4'].plot(period='2011-2016');
station.compute_trend('concso4', 2000, 2018)
station.trends['concso4'].plot(period='2000-2018');