Skip to content

module TopoPyScale.topo_obs

Tools to download and compare Downsclaed timeseries to observation All observation in folder inputs/obs/ S. Filhol December 2021


function get_metno_obs

get_metno_obs(
    sources,
    voi,
    start_date,
    end_date,
    client_id='97a0e2bc-a262-48fe-9dea-5e9c894e9328'
)

Function to download observation data from MetNo FROST API (Norwegian Meteorological institute)

Args sources (list): station code, e.g. 'SN25830' voi (list): variables to download start_date (str): starting date end_date (str): ending date client_id (str): FROST_API_CLIENTID

Return: dataframe: all data combined together

List of variable: https://frost.met.no/element table Find out about stations: https://seklima.met.no/ WARNING: Download max one year at the time to not reach max limit of data to download.

TODO:

  • convert df to xarray dataset with stn_id, time as coordinates

function combine_metno_obs_to_xarray

combine_metno_obs_to_xarray(fnames='metno*.pckl', path='inputs/obs/')

Function to convert metno format to usable dataset

Args:

  • fnames (str pattern): pattern of the file to load
  • path (str): path of the file to load

Returns:

  • dataset: dataset will all data organized in timeseries and station number

function fetch_WMO_insitu_observations

fetch_WMO_insitu_observations(
    years,
    months,
    bbox,
    target_path='./inputs/observations',
    product='sub_daily',
    var=['air_pressure', 'air_pressure_at_sea_level', 'air_temperature', 'dew_point_temperature', 'wind_from_direction', 'wind_speed']
)

Function to download WMO in-situ data from land surface in-situ observations from Copernicus. https://cds.climate.copernicus.eu/cdsapp#!/dataset/insitu-observations-surface-land?tab=overview

Args:

  • year (str or list): year(s) to download
  • month (str or list): month(s) to download
  • bbox (list): bonding box in lat-lon [lat_south, lon_west, lat_north, lon_east]
  • target (str): filename
  • var (list): list of variable to download. available:

Returns: Store to disk the dataset as zip file

TODO:

- [x] test function 
- [ ] check if can download large extent at once or need multiple requests? 
- [x] save data in individual files for each stations. store either as csv or netcdf (better)

function parse_WMO_insitu_observations

parse_WMO_insitu_observations(
    fname=None,
    file_pattern='inputs/observations/surf*subset_csv*.csv',
    path='./inputs/observations'
)

Function to parse WMO files formated from CDS database. parse in single station file

Args: fname: file_pattern: path:

Returns:


This file was automatically generated via lazydocs.