mpop package¶
Submodules¶
mpop.plugin_base module¶
The mpop.plugin_base
module defines the plugin API.
mpop.projectable module¶
Projectable objects.
-
class
mpop.projectable.
Projectable
¶ Bases:
mpop.projectable.Dataset
-
resample
(destination_area, **kwargs)¶ Resample the current projectable and return the resampled one.
Parameters: - destination_area – The destination onto which to project the data, either a full blown area definition or
- string corresponding to the name of the area as defined in the area file. (a) –
- **kwargs – The extra parameters to pass to the resampling functions.
Returns: A resampled projectable, with updated .info[“area”] field
-
mpop.resample module¶
Shortcuts to resampling stuff.
-
class
mpop.resample.
BaseResampler
(source_geo_def, target_geo_def)¶ Bases:
object
The base resampler class. Abstract.
-
__call__
(*args, **kwargs)¶ Shortcut for the
resample()
method
-
compute
(data, **kwargs)¶ Do the actual resampling
-
dump
(filename)¶ Dump the projection info to filename.
-
precompute
(**kwargs)¶ Do the precomputation
-
resample
(data, cache_dir=False, **kwargs)¶ Resample the data, saving the projection info on disk if precompute evaluates to True.
-
-
class
mpop.resample.
KDTreeResampler
(source_geo_def, target_geo_def)¶ Bases:
mpop.resample.BaseResampler
Resample using nearest neighbour.
-
caches
= OrderedDict()¶
-
compute
(data, weight_funcs=None, fill_value=None, with_uncert=False, **kwargs)¶
-
get_hash
(**kwargs)¶ Get hash for the current resample with the given kwargs.
-
static
hash_area
(area)¶ Get (and set) the hash for the area.
-
precompute
(radius_of_influence=10000, epsilon=0, reduce_data=True, nprocs=1, segments=None, cache_dir=False, **kwargs)¶
-
-
mpop.resample.
get_area_def
(area_name)¶ Get the definition of area_name from file. The file is defined to use is to be placed in the $PPP_CONFIG_DIR directory, and its name is defined in mpop’s configuration file.
-
mpop.resample.
get_area_file
()¶
-
mpop.resample.
resample
(source_area, data, destination_area, resampler=<class 'mpop.resample.KDTreeResampler'>, **kwargs)¶ Do the resampling
mpop.scene module¶
Scene objects to hold satellite data.
-
class
mpop.scene.
Scene
(filenames=None, ppp_config_dir=None, reader_name=None, base_dir=None, **info)¶ Bases:
mpop.projectable.InfoObject
The almighty scene class.
-
available_composites
()¶ Return the list of available composites for the current scene.
-
available_datasets
(reader_name=None)¶ Return the available datasets, globally or just for reader_name if specified.
-
compute
(*requirements)¶ Compute all the composites contained in requirements.
-
get_writer
(writer='geotiff', **kwargs)¶
-
get_writer_by_ext
(extension, **kwargs)¶
-
images
()¶ Generate images for all the datasets from the scene.
-
load
(wishlist, calibration=None, resolution=None, polarization=None, metadata=None, **kwargs)¶ Read, compute and unload.
-
load_writer_config
(config_files, **kwargs)¶
-
read
(dataset_keys, calibration=None, resolution=None, polarization=None, metadata=None, **kwargs)¶ Read the composites called dataset_keys or their prerequisites.
-
resample
(destination, datasets=None, compute=True, unload=True, **kwargs)¶ Resample the datasets and return a new scene.
-
save_dataset
(dataset_id, filename=None, writer=None, **kwargs)¶ Save the dataset_id to file using writer (geotiff by default).
-
save_datasets
(writer='geotiff', **kwargs)¶ Save all the datasets present in a scene to disk using writer.
-
show
(dataset_id)¶ Show the dataset on screen as an image.
-
unload
(keepables=None)¶ Unload all loaded composites.
-
mpop.tools module¶
Helper functions for eg. performing Sun zenith angle correction.
-
mpop.tools.
sunzen_corr_cos
(data, cos_zen, limit=80.0)¶ Perform Sun zenith angle correction to the given data using cosine of the zenith angle (cos_zen). The correction is limited to limit degrees (default: 80.0 degrees). For larger zenith angles, the correction is the same as at the limit. Both data and cos_zen are given as 2-dimensional Numpy arrays or Numpy MaskedArrays, and they should have equal shapes.
mpop.utils module¶
Module defining various utilities.
-
class
mpop.utils.
NullHandler
(level=0)¶ Bases:
logging.Handler
Empty handler.
-
emit
(record)¶ Record a message.
-
-
class
mpop.utils.
OrderedConfigParser
(*args, **kwargs)¶ Bases:
object
Intercepts read and stores ordered section names. Cannot use inheritance and super as ConfigParser use old style classes.
-
read
(filename)¶ Reads config file
-
sections
()¶ Get sections from config file
-
-
mpop.utils.
debug_on
()¶ Turn debugging logging on.
-
mpop.utils.
ensure_dir
(filename)¶ Checks if the dir of f exists, otherwise create it.
-
mpop.utils.
get_logger
(name)¶ Return logger with null handle
-
mpop.utils.
logging_off
()¶ Turn logging off.
-
mpop.utils.
logging_on
(level=30)¶ Turn logging on.
-
mpop.utils.
strftime
(utctime, format_string)¶ Like datetime.strftime, except it works with string formatting conversion specifier items on windows, making the assumption that all conversion specifiers use mapping keys.
E.g.: >>> from datetime import datetime >>> t = datetime.utcnow() >>> a = “blabla%Y%d%m-%H%M%S-%(value)s” >>> strftime(t, a) ‘blabla20120911-211448-%(value)s’
Module contents¶
MPOP Package initializer.
-
mpop.
config_search_paths
(filename, *search_dirs, **kwargs)¶
-
mpop.
get_config
(filename, *search_dirs, **kwargs)¶ Blends the different configs, from package defaults to .
-
mpop.
get_config_path
(filename, *search_dirs)¶ Get the appropriate path for a filename, in that order: filename, ., PPP_CONFIG_DIR, package’s etc dir.
-
mpop.
get_environ_config_dir
(default='/home/docs/checkouts/readthedocs.org/user_builds/mpop/envs/feature-simplify/lib/python2.7/site-packages/mpop-1.1.0-py2.7.egg/etc')¶
-
mpop.
glob_config
(pattern, *search_dirs)¶ Return glob results for all possible configuration locations.
- Note: This method does not check the configuration “base” directory if the pattern includes a subdirectory.
- This is done for performance since this is usually used to find all configs for a certain component.
-
mpop.
runtime_import
(object_path)¶ Import at runtime