smos.smos_ic package

Submodules

smos.smos_ic.download module

smos.smos_ic.interface_ic module

class smos.smos_ic.interface_ic.SMOS_IC_Ds(data_path, parameters=None, flatten=False, grid=<smos.grid.EASE25CellGrid object>, filename_templ=None, read_flags=(0, 1), float_fillval=nan)[source]

Bases: SMOSDs

Class for reading SMOS IC images in nc format. Images are orgnaised in subdirs for each year.

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

  • parameter (str or list, optional (default: None)) – one or list of parameters to read, see SMOS documentation for more information (default: ‘Soil_Moisture’).

  • 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 or None, optional (default: (0, 1))) – Filter values to read based on the selected QUALITY_FLAGS. Values for locations that are not assigned any of the here passed flags are replaces with NaN (by default only the missing-data, i.e. flag=2, locations are filtered out).

  • 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_RE06_MIR_CDF3S*_{datetime}T000000_{datetime}T235959_105_*_8.DBL.nc'
class smos.smos_ic.interface_ic.SMOS_IC_Img(filename, mode='r', parameters=None, flatten=False, grid=<smos.grid.EASE25CellGrid object>, read_flags=(0, 1), float_fillval=nan)[source]

Bases: SMOSImg

Class for reading one SMOS IC 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 are 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 or None, optional (default: (0, 1))) – Filter values to read based on the selected QUALITY_FLAGS. Values for locations that are not assigned any of the here passed flags are replaces with NaN (by default only the missing-data, i.e. flag=2, locations are filtered out). If None is passed, no flags are considered.

  • 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_ic.reshuffle_ic module

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

smos.smos_ic.reshuffle_ic.main(args)[source]

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

smos.smos_ic.reshuffle_ic.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 ic 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_ic.reshuffle_ic.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_ic.interface_ic import SMOS_IC_Ds, SMOS_IC_Img from smos.interface import SMOSTs