smos.smos_l4 package

Submodules

smos.smos_l4.interface_l4 module

class smos.smos_l4.interface_l4.SMOS_L4_Ds(data_path, parameters=None, flatten=False, grid=<smos.grid.EASE25CellGrid object>, filename_templ=None, read_flags=array([0., 0.2, 0.4, 0.6, 0.8, 1. ]), oper=False, float_fillval=nan)[source]

Bases: SMOSDs

Class for reading SMOS L4 CATDS - CESBIO RZSM images in nc format. Images are orgnaised in subdirs for each year.

Parameters:
  • data_path (str) – Path to the nc files

  • parameters (str or list, optional (default: None)) – one or list of parameters to read. We add quality flags if ‘read_flags’ is not None. All parameters are described in docs/varnames.rst. If None is passed, all parameters are read.

  • flatten (bool, optional (default: False)) – If set then the data is read into 1D arrays. This is used to e.g reshuffle the data.

  • grid (pygeogrids.CellGrid, optional (default: EASE25CellGrid)) – Grid that the image data is organised on, by default the global EASE25 grid is used.

  • read_flags (tuple, list, np.array or None, optional (default: np.linspace(0,1,6,endpoint=True))) – Filter values to read based on the selected quality flags. Values for locations that are not assigned any of the here passed flags are replaced with NaN (by default only the missing-data, i.e. flag=-1, are filtered out). If None is passed, no flags are considered.

  • oper (bool, optional (default: False)) – Boolean operator distinguishing between the SMOS L4 RZSM Scientific and Operational products. Distinction is made due to differences in quality flag variable naming, values and their significance (see docs/varnames.rst).

  • float_fillval (float or None, optional (default: np.nan)) – Fill Value for masked pixels, this is only applied to float variables. Therefore e.g. mask variables are never filled but use the fill value as in the data.

default_fname_template = 'SM_*_MIR_CLF4RD*_{datetime}T000000_{datetime}T235959_*_*_*.DBL.nc'
class smos.smos_l4.interface_l4.SMOS_L4_Img(filename, mode='r', parameters=None, flatten=False, grid=<smos.grid.EASE25CellGrid object>, read_flags=array([0., 0.2, 0.4, 0.6, 0.8, 1. ]), oper=False, float_fillval=nan)[source]

Bases: SMOSImg

Child-class for reading one SMOS L4 CATDS - CESBIO RZSM netcdf image file.

Parameters:
  • filename (str) – filename of the SMOS nc image file

  • mode (str, optional (default: 'r')) – mode of opening the file, only ‘r’ is implemented at the moment

  • parameters (str or list, optional (default: None)) – one or list of parameters to read. We add ‘Quality_Flags’ if ‘read_flags’ is not None. All parameters are described in docs/varnames.rst. If None is passed, all parameters are read.

  • flatten (bool, optional (default: False)) – If set then the data is read into 1D arrays. This is used to e.g reshuffle the data.

  • grid (pygeogrids.CellGrid, optional (default: EASE25CellGrid)) – Grid that the image data is organised on, by default the global EASE25 grid is used.

  • read_flags (tuple, list, np.array or None, optional (default: np.linspace(0,1,6,endpoint=True))) – Filter values to read based on the selected quality flags. Values for locations that are not assigned any of the here passed flags are replaced with NaN (by default only the missing-data, i.e. flag=-1, are filtered out). If None is passed, no flags are considered.

  • oper (bool, optional (default: False)) – Boolean operator distinguishing between the SMOS L4 RZSM Scientific and Operational products. Distinction is made due to differences in quality flag variable naming, values and their significance (see docs/varnames.rst).

  • float_fillval (float or None, optional (default: np.nan)) – Fill Value for masked pixels, this is only applied to float variables. Therefore e.g. mask variables are never filled but use the fill value as in the data.

smos.smos_l4.reshuffle_l4 module

Module for a command line interface to convert the SMOS image data into a time series format using the repurpose package

smos.smos_l4.reshuffle_l4.main(args)[source]

Main routine used for command line interface. :param args: Command line arguments. :type args: list of str

smos.smos_l4.reshuffle_l4.reshuffle(input_root, outputpath, startdate, enddate, imgbuffer=200, **ds_kwargs)[source]

Reshuffle method applied to SMOS image data.

Parameters:
  • input_root (string) – input path where smos L4 data was downloaded to (yearly folders)

  • outputpath (string) – Output path.

  • startdate (datetime) – Start date.

  • enddate (datetime) – End date.

  • imgbuffer (int, optional) – How many images to read at once before writing time series.

  • ds_kwargs (dict) – Kwargs that are passed to the image datastack class

smos.smos_l4.reshuffle_l4.run()[source]

Module contents

from pkg_resources import get_distribution, DistributionNotFound

try:

# Change here if project is renamed and does not equal the package name dist_name = __name__ __version__ = get_distribution(dist_name).version

except DistributionNotFound:

__version__ = ‘unknown’

finally:

del get_distribution, DistributionNotFound

from smos.smos_l4.interface_l4 import SMOS_L4_Ds, SMOS_L4_Img from smos.interface import SMOSTs