Search
Get EBAS data with pydap
# get from package
from pydap.client import open_dods, open_url
from netCDF4 import num2date
import pandas as pd
# get directly from EBAS
ds = open_dods(
'http://dev-ebas-pydap.nilu.no/' 
'NO0042G.dmps.IMG.aerosol.particle_number_size_distribution'
'.1h.NO01L_NILU_DMPSmodel2_ZEP.NO01L_dmps_DMPS_ZEP01.2.dods')

# syntax: ST_STATION_CODE.FT_TYPE.RE_REGIME_CODE.MA_MATRIX_NAME.CO_COMP_NAME.DS_RESCODE.FI_REF.ME_REF.DL_DATA_LEVEL.dods
# or: #station.instrument_type.IMG.matrix.component.resolution.instrument_reference.datalevel.dods
# if no level, then '..dods'
# if doen't work, download one file to check what are the FI_REF and ME_REF.
# other example: 'http://dev-ebas-pydap.nilu.no/NO0042G.Hg_mon.IMG.air.mercury.1h.NO01L_tekran_42_dup.NO01L_afs..dods'
#get the actual data
dmps_data = ds['particle_number_size_distribution_amean']

# get normalised size distribution in dNdlogDp
dNdlogDp= dmps_data.particle_number_size_distribution_amean.data

# get time in datatime format using function from netCDF4 package
tim_dmps = num2date(dmps_data.time.data,units='days since 1900-01-01 00:00:00',
calendar='gregorian')

# get diameter vector
dp_NILU = dmps_data.D.data

# make DataFrame to simplify the handling of data
df_NILU = pd.DataFrame(dNdlogDp,index=dp_NILU,columns=tim_dmps)