sat Package

ascat Module

Created on Jul 29, 2013

@author: Christoph Paulik christoph.paulik@geo.tuwien.ac.at

exception pytesmo.io.sat.ascat.ASCATReaderException[source]

Bases: exceptions.Exception

class pytesmo.io.sat.ascat.ASCATTimeSeries(gpi, lon, lat, cell, data)

Bases: object

Container class for ASCAT time series

Parameters :

gpi : int

grid point index

lon : float

longitude of grid point

lat : float

latitude of grid point

cell : int

cell number of grid point

data: pandas.DataFrame :

DataFrame which contains the data

Attributes

gpi int grid point index
longitude float longitude of grid point
latitude float latitude of grid point
cell int cell number of grid point
data: pandas.DataFrame   DataFrame which contains the data

Methods

plot(*args, **kwargs)

wrapper for pandas.DataFrame.plot which adds title to plot and drops NaN values for plotting Returns ——- ax : axes

matplotlib axes of the plot
Raises :

ASCATReaderException :

if data attribute is not a pandas.DataFrame

class pytesmo.io.sat.ascat.Ascat_SSM(*args, **kwargs)[source]

Bases: pytesmo.io.sat.ascat.Ascat_data

class for reading ASCAT SSM data. It extends Ascat_data and provides the information necessary for reading SSM data

Parameters :

path : string

path to data folder which contains the zip files from the FTP server

grid_path : string

path to grid_info folder which contains txt files with information about grid point index,latitude, longitude and cell

grid_info_filename : string, optional

name of the grid info txt file in grid_path

advisory_flags_path : string, optional

path to advisory flags .dat files, if not provided they will not be used

topo_threshold : int, optional

if topographic complexity of read grid point is above this threshold a warning is output during reading

water_threshold : int, optional

if water fraction of read grid point is above this threshold a warning is output during reading

Attributes

gp_filename_template string defines how the gpi is put into the template string to make the filename
gp_filestruct numpy.dtype structure template of the SSM .dat file
scale_factor dict factor by which to multiply the raw data to get the correct values for each field in the gp_filestruct
include_in_df list list of fields that should be returned to the user after reading
nan_values dict nan value saved in the file which will be replaced by numpy.nan values during reading
datatype dict datatype of the fields that the return data should have

Methods

read_ssm(*args,**kwargs) read surface soil moisture
read_ssm(*args, **kwargs)[source]

function to read SSM takes either 1 or 2 arguments. It can be called as read_ssm(gpi,**kwargs) or read_ssm(lon,lat,**kwargs)

Parameters :

gpi : int

grid point index

lon : float

longitude of point

lat : float

latitude of point

mask_ssf : boolean, optional

default False, if True only SSF values of 1 will be allowed, all others are removed

mask_frozen_prob : int,optional

if included in kwargs then all observations taken when frozen probability > mask_frozen_prob are removed from the result

mask_snow_prob : int,optional

if included in kwargs then all observations taken when snow probability > mask_snow_prob are removed from the result

Returns :

df : pandas.DataFrame

containing all fields in self.include_in_df plus frozen_prob and snow_prob if advisory_flags_path was set

class pytesmo.io.sat.ascat.Ascat_SWI(*args, **kwargs)[source]

Bases: pytesmo.io.sat.ascat.Ascat_data

class for reading ASCAT SWI data. It extends Ascat_data and provides the information necessary for reading SWI data

Parameters :

path : string

path to data folder which contains the zip files from the FTP server

grid_path : string

path to grid_info folder which contains txt files with information about grid point index,latitude, longitude and cell

grid_info_filename : string, optional

name of the grid info txt file in grid_path

advisory_flags_path : string, optional

path to advisory flags .dat files, if not provided they will not be used

topo_threshold : int, optional

if topographic complexity of read grid point is above this threshold a warning is output during reading

water_threshold : int, optional

if water fraction of read grid point is above this threshold a warning is output during reading

Attributes

gp_filename_template string defines how the gpi is put into the template string to make the filename
gp_filestruct numpy.dtype structure template of the SSM .dat file
scale_factor dict factor by which to multiply the raw data to get the correct values for each field in the gp_filestruct
include_in_df list list of fields that should be returned to the user after reading
nan_values dict nan value saved in the file which will be replaced by numpy.nan values during reading
datatype dict datatype of the fields that the return data should have
T_SWI dict information about which numerical T-Value maps to which entry in the datastructure
T_QFLAG dict information about which numerical T-Value maps to which entry in the datastructure

Methods

read_swi(*args,**kwargs) read soil water index
read_swi(*args, **kwargs)[source]

function to read SWI takes either 1 or 2 arguments being. It can be called as read_swi(gpi,**kwargs) or read_swi(lon,lat,**kwargs)

Parameters :

gpi : int

grid point index

lon : float

longitude of point

lat : float

latitude of point

T : int, optional

if set only the SWI and QFLAG of this T-Value will be returned

mask_qf : int, optional

if set, SWI values with a QFLAG value lower than the mask_qf value will be masked. This is done for each T value independently

mask_frozen_prob : int,optional

if included in kwargs then all observations taken when frozen probability > mask_frozen_prob are removed from the result

mask_snow_prob : int,optional

if included in kwargs then all observations taken when snow probability > mask_snow_prob are removed from the result

Returns :

df : pandas.DataFrame

containing all fields in self.include_in_df plus frozen_prob and snow_prob if advisory_flags_path was set. If T was set then only SWI and QFLAG values for the selected T value are included plut frozen_prob and snow_prob if applicable

class pytesmo.io.sat.ascat.Ascat_data(path, grid_path, grid_info_filename='TUW_W54_01_lonlat-ld-land.txt', advisory_flags_path=None, topo_threshold=50, water_threshold=50)[source]

Bases: object

Class that provides access to ASCAT data stored in userformat which is downloadable from the TU Wien FTP Server after registration at http://rs.geo.tuwien.ac.at .

Parameters :

path : string

path to data folder which contains the zip files from the FTP server

grid_path : string

path to grid_info folder which contains txt files with information about grid point index,latitude, longitude and cell

grid_info_filename : string, optional

name of the grid info txt file in grid_path

advisory_flags_path : string, optional

path to advisory flags .dat files, if not provided they will not be used

topo_threshold : int, optional

if topographic complexity of read grid point is above this threshold a warning is output during reading

water_threshold : int, optional

if water fraction of read grid point is above this threshold a warning is output during reading

Attributes

path string path to data folder which contains the zip files from the FTP server
grid_path string path to grid_info folder which contains txt files with information about grid point index,latitude, longitude and cell
grid_info_filename string name of the grid info txt file in grid_path
grid_info_np_filename string name of the numpy save file to the grid information
topo_threshold int if topographic complexity of read grid point is above this threshold a warning is output during reading
water_threshold int if water fraction of read grid point is above this threshold a warning is output during reading
grid_info_loaded boolean true if the grid information has already been loaded
kdTree NN.findGeoNN object kdTree wrapper object used for finding the nearest neighbor
advisory_flags_path string path to advisory flags .dat files, if not provided they will not be used
include_advflags boolean True if advisory flags are available

Methods

unzip_cell(cell) unzips zipped grid point files into subdirectory
find_nearest_gpi(lon,lat) finds nearest grid point index given longitude and latitude
read_advisory_flags(gpi) reads the advisory flags for a given grid point index
find_nearest_gpi(lon, lat)[source]

finds nearest gpi, builds kdTree if it does not yet exist

Parameters :

lon : float

longitude of point

lat : float

latitude of point

Returns :

gpi : long

grid point index

gpi2lonlat(gpi)

gets lon lat coordinates for given gpi

Parameters :

gpi : int

grid point index

Returns :

longitude : float

latitude : float

Raises :

ASCATReaderException :

if gpi was not found

read_advisory_flags(gpi)[source]

Read the advisory flags located in the self.advisory_flags_path Advisory flags include frozen probability, snow cover probability topographic complexity and water fraction.

Parameters :

gpi : long

grid point index

Returns :

df : pandas.DataFrame

containing the columns frozen_prob and snow_prob. lenght 366 with one entry for every day of the year, including February 29th

topo : numpy.uint8

topographic complexity ranging from 0-100

water : numpy.uint8

water fraction of pixel in percent

unzip_cell(cell)[source]

unzips the downloaded .zip cell file into the directory of os.path.join(self.path,cell)

Parameters :

cell : int

cell number

Table Of Contents

Previous topic

test Package

Next topic

timedate Package

This Page