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 information to Quickstart on basics of getting measurement values and navigation #1018

Merged
merged 5 commits into from
Dec 22, 2019
Merged
Changes from all 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
36 changes: 36 additions & 0 deletions doc/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,22 @@ To access the loaded data use the wavelength or name:
For more information on loading datasets by resolution, calibration, or other
advanced loading methods see the :doc:`readers` documentation.


Calculating measurement values and navigation coordinates
=========================================================

Once loaded, measurement values can be calculated from a DataArray within a scene, using .values to get a fully calculated numpy array:
mraspaud marked this conversation as resolved.
Show resolved Hide resolved

>>> vis006 = global_scene["VIS006"]
>>> vis006_meas = vis006.values

Note that for very large images, such as half-kilometer geostationary imagery, calculated measurement arrays may require multiple gigabytes of memory; using deferred computation and/or subsetting of datasets may be preferred in such cases.

The 'area' attribute of the DataArray, if present, can be converted to latitude and longitude arrays. For some instruments (typically polar-orbiters), the get_lonlats() may result in arrays needing an additional .compute() or .values extraction.

>>> vis006_lon, vis006_lat = vis006.attrs['area'].get_lonlats()


Visualizing data
================

Expand Down Expand Up @@ -246,6 +262,26 @@ output format and to provide the best looking image. For more information
on saving datasets and customizing enhancements see the documentation on
:doc:`writers`.


Slicing and subsetting scenes
=============================

Array slicing can be done at the scene level in order to get subsets with consistent navigation throughout. Note that this does not take into account scenes that may include channels at multiple resolutions, i.e. index slicing does not account for dataset spatial resolution.

>>> scene_slice = global_scene[2000:2004, 2000:2004]
>>> vis006_slice = scene_slice['VIS006']
>>> vis006_slice_meas = vis006_slice.values
>>> vis006_slice_lon, vis006_slice_lat = vis006_slice.attrs['area'].get_lonlats()

To subset multi-resolution data consistently, use the :meth:`~satpy.scene.Scene.crop` method.

>>> scene_llbox = global_scene.crop(ll_bbox=(-4.0, -3.9, 3.9, 4.0))
mraspaud marked this conversation as resolved.
Show resolved Hide resolved
>>> vis006_llbox = scene_llbox['VIS006']
>>> vis006_llbox_meas = vis006_llbox.values
>>> vis006_llbox_lon, vis006_llbox_lat = vis006_llbox.attrs['area'].get_lonlats()



Troubleshooting
===============

Expand Down