Trying to create day microphysics image using satpy

102 views
Skip to first unread message

אליקום ודיסלבסקי

unread,
Mar 1, 2021, 8:24:41 AM3/1/21
to pyt...@googlegroups.com

Dear Pytroll group,

 

My name is Elyakom and I work in the Israel Meteorological Service R&D department.

 

We've been using successfully and operationally the python-pytroll package for 3 years now.

 

I was trying to create a "day microphysics" from MSG-IODC data using satpy, and got the attached error.

 

I wonder maybe you have solution?

 

If necessary I can send code and data to run it.

 

Thank you in advance,

 

Best regards,

 

Elyakom Vadislavsky

R&D department

IMS

 

 

 

Error message:

 

File "/usr/local/lib/python3.6/site-packages/satpy/modifiers/spectral.py", line 70, in __call__

    return self._get_reflectance_as_dataarray(projectables, optional_datasets)

  File "/usr/local/lib/python3.6/site-packages/satpy/modifiers/spectral.py", line 81, in _get_reflectance_as_dataarray

    reflectance = self._get_reflectance_as_dask(da_nir, da_tb11, da_tb13_4, da_sun_zenith, _nir.attrs)

  File "/usr/local/lib/python3.6/site-packages/satpy/modifiers/spectral.py", line 124, in _get_reflectance_as_dask

    reflectance_3x_calculator = self._init_reflectance_calculator(metadata)

  File "/usr/local/lib/python3.6/site-packages/satpy/modifiers/spectral.py", line 135, in _init_reflectance_calculator

    masking_limit=self.masking_limit)

TypeError: __init__() got an unexpected keyword argument 'masking_limit'

 

 

 

Raspaud Martin

unread,
Mar 1, 2021, 9:31:07 AM3/1/21
to pyt...@googlegroups.com
Dear Elyakom,

Nice to hear that IMS is using pytroll operationally :)

Regarding your problem, I would start by making sure you have the
latest pyspectral and satpy installed.

Best regards,
Martin

אליקום ודיסלבסקי

unread,
Mar 2, 2021, 2:24:32 AM3/2/21
to pyt...@googlegroups.com, Vladimir Meerson
Dear Martin,

Good to hear from you, hope all is O.K

We appreciate very much the major help you gave us in the past, so thank you.

I've checked the versions as you suggested:

satpy: 0.25.1
pyspectral: 0.10.0

are this versions are ok?

Also in another matter, is there an already made product for water vapor channel like the old ".wv_high()" option.

Thank you,

Best regards,

Elyakom
--
You received this message because you are subscribed to the Google Groups "pytroll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytroll+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pytroll/ad11ddec7fb78f13e8e16541c3440f38ccaa8eaa.camel%40smhi.se.

Raspaud Martin

unread,
Mar 2, 2021, 3:44:21 AM3/2/21
to pyt...@googlegroups.com, meer...@ims.gov.il
Dear Elyakom,

Thanks for asking! everything is fine for me here, even with the
pandemic ongoing... I hope everything is fine for you too.

Pyspectral has had a release 0.10.4 that you would need to update to.
It should make the day microphysics work better.

As for the water vapor channel, there is no predifined composite for it
in satpy, however it should be simple to add your own, as described
here:
https://satpy.readthedocs.io/en/latest/composites.html#creating-composite-configuration-files
and for a single channel, the compositor to use is
`SingleBandCompositor`.

Best regards,
Martin

אליקום ודיסלבסקי

unread,
Mar 2, 2021, 6:11:23 AM3/2/21
to pyt...@googlegroups.com, Vladimir Meerson, Eyal Amitai, Yoav Levi, Amit Savir
Dear Martin,

Thank you for major help and fast response, we appreciated very much.
Here all is fine too, thank you:-)

Since our python version is 3.6.8 we couldn’t manage to install the latest pyspectral package,
it requires a minimum of python 3.7.

Right now we will manage to work without the day microphysics RGB composite.
We plan to use the MSG-IODC as backup system to MSG-EUROPE system.

Our MSG -EUROPE (HRIT & HRIT RSS) are all based on the python2 pytroll old packages.

If there is an interest I can share the code I wrote for MSG-IODC system (python3 & satpy) with the group.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pytroll/8ff7f30e2c5c5ce8fca86e7848e17816ba771679.camel%40smhi.se.

Raspaud Martin

unread,
Mar 2, 2021, 6:28:20 AM3/2/21
to pyt...@googlegroups.com, ami...@ims.gov.il, lev...@ims.gov.il, sav...@ims.gov.il, meer...@ims.gov.il
Dear Elyakom,

I can recommend miniconda for installing satpy and its dependencies. It
will allow you to upgrade your python version in a contained
environment.
Here at SMHI we use miniconda for this purpose too, as we use RHEL8
which has python 3.6.8.

Best regards,
Martin

אליקום ודיסלבסקי

unread,
Mar 2, 2021, 10:07:22 AM3/2/21
to pyt...@googlegroups.com, Vladimir Meerson
Dear Martin

Thank you for your recommendation regarding miniconda.

I've tried to create the WV image - went fine, but when trying to add coastline - failed (attached functions and error message below)

* the code fails in the function "addcoastline"

are you familiar with this error message "bad mode"?

Thank you,

Best regards,

Elyakom

-------------------------------------------------------------------------
Error message:

Traceback (most recent call last):
File "multiplot_IODC_HRIT.py", line 480, in <module>
plotSatImage(4)
File "multiplot_IODC_HRIT.py", line 359, in plotSatImage
plot_WV()
File "multiplot_IODC_HRIT.py", line 191, in plot_WV
addcoastline(fout1,Europe_and_west_Asia) # add coastlines
File "multiplot_IODC_HRIT.py", line 42, in addcoastline
cw.add_coastlines(img, area, resolution='h', level=3)
File "/usr/local/lib/python3.6/site-packages/pycoast/cw_agg.py", line 459, in add_coastlines
y_offset=y_offset)
File "/usr/local/lib/python3.6/site-packages/pycoast/cw_base.py", line 636, in _add_feature
x_offset=x_offset, y_offset=y_offset, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pycoast/cw_base.py", line 553, in add_shapes
draw = self._get_canvas(image)
File "/usr/local/lib/python3.6/site-packages/pycoast/cw_agg.py", line 45, in _get_canvas
return aggdraw.Draw(image)
ValueError: bad mode

plot_wv_high.py.pdf

Raspaud Martin

unread,
Mar 2, 2021, 10:41:35 AM3/2/21
to pyt...@googlegroups.com, meer...@ims.gov.il
Dear Elyakom,

That error means that the mode of the image is incorrect for the
coastlines to be added.

So you could convert the imaged like this before you add the
coastlines:
rgb_img = img.convert('RGB')

Best regards,
Martin

אליקום ודיסלבסקי

unread,
Mar 2, 2021, 10:52:57 AM3/2/21
to pyt...@googlegroups.com, Vladimir Meerson

Dear Martin,

 

Thank you very much for your help.

 

It worked well, attached the screenshot of the image.

 

Many thanks,

 

Best regards,

 

Elyakom

 

 

 

 

 

 

-----Original Message-----
From: pyt...@googlegroups.com [mailto:pyt...@googlegroups.com] On Behalf Of Raspaud Martin
Sent: Tuesday, March 2, 2021 5:42 PM
To: pyt...@googlegroups.com
Cc: Vladimir Meerson <meer...@ims.gov.il>
Subject: Re: [pytroll] Trying to create day microphysics image using satpy

 

Dear Elyakom,

--

You received this message because you are subscribed to the Google Groups "pytroll" group.

To unsubscribe from this group and stop receiving emails from it, send an email to pytroll+u...@googlegroups.com.

Raspaud Martin

unread,
Mar 2, 2021, 10:59:56 AM3/2/21
to pyt...@googlegroups.com, meer...@ims.gov.il
Dear Elyakom,

Glad to hear I could help!

Best regards,
Martin

On Tue, 2021-03-02 at 15:52 +0000, אליקום ודיסלבסקי wrote:
> Dear Martin,
>
> Thank you very much for your help.
>
> It worked well, attached the screenshot of the image.
>
> Many thanks,
>
> Best regards,
>
> Elyakom
>
>
>
>
>
>
>
Reply all
Reply to author
Forward
0 new messages