Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example to the documentation using multiple readers #2071

Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 21 additions & 5 deletions satpy/scene.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2017 Satpy developers
# Copyright (c) 2010-2022 Satpy developers
#
# This file is part of satpy.
#
Expand Down Expand Up @@ -71,14 +71,30 @@ def __init__(self, filenames=None, reader=None, filter_parameters=None,
reader_kwargs=None):
"""Initialize Scene with Reader and Compositor objects.

To load data `filenames` and preferably `reader` must be specified. If `filenames` is provided without `reader`
then the available readers will be searched for a Reader that can support the provided files. This can take
a considerable amount of time so it is recommended that `reader` always be provided. Note without `filenames`
the Scene is created with no Readers available requiring Datasets to be added manually::
To load data `filenames` and preferably `reader` must be specified::

scn = Scene(filenames=glob('/path/to/viirs/sdr/files/*'), reader='viirs_sdr')


If ``filenames`` is provided without ``reader`` then the available readers
will be searched for a Reader that can support the provided files. This
can take a considerable amount of time so it is recommended that
``reader`` always be provided. Note without ``filenames`` the Scene is
created with no Readers available requiring Datasets to be added
manually::

scn = Scene()
scn['my_dataset'] = Dataset(my_data_array, **my_info)

Further, notice that it is also possible to load a combination of files
or sets of files each requiring their specific reader. For that
``filenames`` needs to be a `dict` (see parameters list below), like
e.g.::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The like might be redundant or unnecessary here. It reads a little funny.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. Done.


scn = Scene(filenames={'nwcsaf-pps_nc': glob('/path/to/nwc/saf/pps/files/*'),
'modis_l1b': glob('/path/to/modis/lvl1/files/*')})


Args:
filenames (iterable or dict): A sequence of files that will be used to load data from. A ``dict`` object
should map reader names to a list of filenames for that reader.
Expand Down