pytroll / pytroll-examples

Collection of examples for pytroll satellite data processing
GNU General Public License v3.0
76 stars 34 forks source link

Possible example to demonstrate manipulating data #10

Open Rankicker795 opened 5 years ago

Rankicker795 commented 5 years ago

My group and I are learning SatPy and one of our requirements were to manipulate HRIT data with some limb-correcting schemes. It took us several hours to figure out that we needed to satpy.get to access the data array. Would it be possible to include an example (any satellite platform) that can help demonstrate how to access and change the data array using satpy.get, etc.?

djhoese commented 5 years ago

We are actively working on various tutorials that should do a better job of introducing things like this. That said, doesn't the "Quickstart" page of the documentation answer this question? https://satpy.readthedocs.io/en/latest/quickstart.html

You mention satpy.get, what do you mean by that? You should be using scn['name'] for the products you want to load. Also, the reason we have a mailing list, documentation, and a slack channel is so users shouldn't have to spend hours learning something. Don't be afraid to come talk to us. We will work on improving the documentation the best we can with the time we have. Thanks again for creating this issue.

Rankicker795 commented 5 years ago

@djhoese Thanks for the reply.

Let me rephrase what I meant by satpy.get because I realized I said the wrong thing.

So, we have created the Scene object and loaded our wavelength or channel as what was included in the QuickStart guide. What held us up and wasn't included in the QuickStart is that to get the data array in the Scene object is to use scn.get(wavelength) to actually interact with the environment. That "get" call is what I would suggest to include in a tutorial.

As we dive deeper into satpy, we will probably be in contact with your group. I am sure we will have a lot more questions as we go. Thanks again.

djhoese commented 5 years ago

See the last line of this quick start section: https://satpy.readthedocs.io/en/latest/quickstart.html#loading-and-accessing-data

You should be using scn[wavelength] or scn['name'] in most cases. I think the issue in the case of the quick start is that it is at the bottom of the section after a huge long print out. @mraspaud we could probably swap these.

Note: The Scene object can be accessed a lot like a dictionary (dict) after data has been loaded so scn['name'] gets the item with the name 'name', scn['name'] = xr.DataArray(...) sets the item, and scn.get('name', default) will get the item from the Scene (same as the bracket/getitem syntax scn['name']), but if it isn't there then return default...which itself defaults to None. This get operation is equivalent to a python dictionary's get method.