PyTROLL/pycoast 1.6.0 is out


Ernst Lobsiger
 

Dear SatPy users,

if you haven't noticed yet, pycoast 1.6.0 is out. This is a major update that among other things:
- fixes the 'Ireland has no coast' bug
- fixes the 'horizontal and vertical scratches' bug when areas cross the dateline
- adds a couple of new symbols like triangle, pentagon, hexagon, star5, star6, star7 ...
- allows for user defined shape files
- brings back cities from city files
- improves overlay caching
- has refactored code
- etc, etc.

Update with conda while you are in the (pytroll) environment (check version first):
conda list pycoast
conda update pycoast

Cheers,
Ernst



fvalk@...
 

Excellent Ernst, very welcome. Thanks for your work on this.

 

Ferdinand

 

From: MSG-1@groups.io On Behalf Of Ernst Lobsiger via groups.io
Sent: Thursday, 27 October, 2022 07:14
To: MSG-1@groups.io
Subject: [MSG-1] PyTROLL/pycoast 1.6.0 is out

 

Dear SatPy users,

if you haven't noticed yet, pycoast 1.6.0 is out. This is a major update that among other things:
- fixes the 'Ireland has no coast' bug
- fixes the 'horizontal and vertical scratches' bug when areas cross the dateline
- adds a couple of new symbols like triangle, pentagon, hexagon, star5, star6, star7 ...
- allows for user defined shape files
- brings back cities from city files
- improves overlay caching
- has refactored code
- etc, etc.

Update with conda while you are in the (pytroll) environment (check version first):
conda list pycoast
conda update pycoast

Cheers,
Ernst


Douglas Deans
 

On 27/10/2022 08:14, Ernst Lobsiger via groups.io wrote:
Dear SatPy users,
if you haven't noticed yet, pycoast 1.6.0 is out. This is a major update that among other things:
- fixes the 'Ireland has no coast' bug
- fixes the 'horizontal and vertical scratches' bug when areas cross the dateline
- adds a couple of new symbols like triangle, pentagon, hexagon, star5, star6, star7 ...
- allows for user defined shape files
- brings back cities from city files
- improves overlay caching
- has refactored code
- etc, etc.
Update with conda while you are in the (pytroll) environment (check version first):
conda list pycoast
conda update pycoast
Cheers,
Ernst
==========================================================================

Many thanks for the information Ernst.
I had not checked that so will get the update done.

Best regards,
Douglas.


g-woolf@sky.com
 

Hi Ernst

I have done the update and I am now getting the following error and my scripts dont complete

   self._draw_major_lines(
  File "c:\Users\graha\miniconda3\envs\pytroll\lib\site-packages\pycoast\cw_base.py", line 1660, in _draw_major_lines
    index_array,
UnboundLocalError: local variable 'index_array' referenced before assignment

Any ideas

Thanks

Graham



On Thursday, 27 October 2022 at 07:14:20 UTC, Ernst Lobsiger via groups.io <ernst.lobsiger@...> wrote:


Dear SatPy users,

if you haven't noticed yet, pycoast 1.6.0 is out. This is a major update that among other things:
- fixes the 'Ireland has no coast' bug
- fixes the 'horizontal and vertical scratches' bug when areas cross the dateline
- adds a couple of new symbols like triangle, pentagon, hexagon, star5, star6, star7 ...
- allows for user defined shape files
- brings back cities from city files
- improves overlay caching
- has refactored code
- etc, etc.

Update with conda while you are in the (pytroll) environment (check version first):
conda list pycoast
conda update pycoast

Cheers,
Ernst



Ernst Lobsiger
 

Graham,

Have you done the pycoast update while being in environment (pytroll)?

Maybe you should also update satpy (note your current version first)?

It works here on Luna and Kallisto without problems.

(pytroll) eumetcast@luna:~$ conda list satpy
# Name                 Version                   Build  Channel
satpy                     0.37.1             pyhd8ed1ab_1    conda-forge

(pytroll) eumetcast@luna:~$ conda list pycoast
# packages in environment at /home/eumetcast/miniconda3/envs/pytroll:
#
# Name                   Version                   Build  Channel
pycoast                   1.6.0              pyhd8ed1ab_0    conda-forge



Cheers,
Ernst


Manu
 

Graham
 
Did you solve the problem?
 
I also have the same problem despite having updated conda and satpy:

# Name                    Version                   Build  Channel
satpy                     0.37.1             pyhd8ed1ab_1    conda-forge

# Name                    Version                   Build  Channel
pycoast                   1.6.0              pyhd8ed1ab_0    conda-forge

File "C:\Users\MANU\miniconda3\envs\pytroll\lib\site-packages\pycoast\cw_base.py", line 1660, in _draw_major_lines
    index_array,
UnboundLocalError: local variable 'index_array' referenced before assignment

At the moment the error occurs on only 1 script (DAYNIGHT-WITH-BLACKMARBLE)

Manu


g-woolf@sky.com
 

Hi Emanual

No I didnt - I went back to pycoast 1.5.0

Regards

Graham

On Saturday, 5 November 2022 at 09:15:17 UTC, Emmanuel via groups.io <dupre.emmanuel@...> wrote:


Graham
 
Did you solve the problem?
 
I also have the same problem despite having updated conda and satpy:

# Name                    Version                   Build  Channel
satpy                     0.37.1             pyhd8ed1ab_1    conda-forge

# Name                    Version                   Build  Channel
pycoast                   1.6.0              pyhd8ed1ab_0    conda-forge

File "C:\Users\MANU\miniconda3\envs\pytroll\lib\site-packages\pycoast\cw_base.py", line 1660, in _draw_major_lines
    index_array,
UnboundLocalError: local variable 'index_array' referenced before assignment

At the moment the error occurs on only 1 script (DAYNIGHT-WITH-BLACKMARBLE)

Manu


Ernst Lobsiger
 

On Sat, Nov 5, 2022 at 02:15 AM, Emmanuel wrote:
File "C:\Users\MANU\miniconda3\envs\pytroll\lib\site-packages\pycoast\cw_base.py", line 1660, in _draw_major_lines
    index_array,
UnboundLocalError: local variable 'index_array' referenced before assignment
Manu,

AFAIK this is Dave's code. The problem seems to show up when you are labeling major long lat lines.
First check that you have defined a font for that. Then try to do the plot without labels (write_text: False).
If you nailed down the problem consider to open an issue at  https://github.com/pytroll/pycoast/issues
or at least describe the problem on the PyTROLL google list  https://groups.google.com/g/pytroll


Ernst


Manu
 

I modified the script by replacing "write_text: True" with "write_text: False":

my_grid  = {'major_lonlat': (10,10), 'minor_lonlat': (2, 2),
            # Opacity 0 will hide the line, values 0 ... 255  EL
            'outline': (255, 255, 255) , 'outline_opacity': 255,
            'minor_outline': (200, 200, 200),'minor_outline_opacity': 127,
            'width': 1.5, 'minor_width': 1.0, 'minor_is_tick': False,
            'write_text': False, 'lat_placement': 'lr', 'lon_placement': 'b',
            'font': datdrp + '/EMCdata/fonts/DejaVuSerif.ttf', 'font_size': fs}


The script works again without displaying the longitude and latitude values.
 
I don't really understand since on other scripts the syntax works!
 
For the moment the result will suit me very well! 


Ernst Lobsiger
 

On Sat, Nov 5, 2022 at 04:18 AM, Emmanuel wrote:
I don't really understand since on other scripts the syntax works!
Manu,

does this mean that the syntax works on other full globe images?? IIRC labeling lat/lon lines
never really worked on full globe images. Normally only the equator got a label left and right.
As a matter of fact the syntax of placing labels left/right/top/bottom doesn't make sense here.

The labels work fine on projections that fill your image as the one I attached above. Of course
that if the code cannot handle labels for full disk images in pycoast 1.6.0 this seems like a BUG.


Ernst



Graham Woolf
 

Hi

I have the same problem

The attached script produces the same error

Regards

Graham


Ernst Lobsiger
 

On Sat, Nov 5, 2022 at 06:43 AM, Graham Woolf wrote:
The attached script produces the same error
Graham,

this is exactly the kind of posts that drive me crazy ;-(. Why can't English
Windows users read their own plain English error messages? A quick look
would show that this is *NOT* about "cw_base.py", there is not even a "cw"
in the whole error text. But it clearly states on top that the error is all yours:
...
Traceback (most recent call last):
  File "T:\PythonScripts\WindowsScripts\NPP\Suomi_NPP_Snow_Age.py", line 191, in <module>
...

It even gives you the exact line number to check in your own script:
...
    scn.save_dataset(composite,imgdir+'/VIIRS_'+str(orbmax)+'-'+
                     'SnoAge-'+Yea+Mon+Day+'-'+composite+'-'+proj+'.jpg',
                     fill_value=0)
...

And this simply reveals that after all these years you have not learnt
to make a Python continuation line without having a ',' at hand ...



Ernst


Graham Woolf
 

Ernst

This script has worked flawlessly up until four days ago when I updated satpy and pycoast

I have the images to prove it so why should it suddenly stop working

Regards

Graham


Manu
 

Ernst
 
after looking at all my scripts, only the scripts where I have the whole globe displayed are problematic. In that case, you just have to remove the text display. 
You are right, for a globe display the text doesn't make sense.
 
On the old version of Satpy the display on the equator line worked. This is not the case in the new version
 
There must be a reason but my programming skills are limited!
 
After this display is really not important, everyone should be able to find the equator!
 
Anyway, thanks for your help!
 
Manu


Ernst Lobsiger
 

On Sat, Nov 5, 2022 at 09:06 AM, Graham Woolf wrote:
This script has worked flawlessly up until four days ago when I updated satpy and pycoast
Graham,

then (if not the Holy Ghost?) it must have been the "Good Times" virus that entered a malicious return and produced this Python syntax error:

<CITE>

Good Times will rewrite your hard drive. Not only that, it will scramble any disks that are even close to your computer. It will re-calibrate your refrigerator's thermostat so that all your ice cream melts. It will demagnetize the strips on all your credit cards, screw up the tracking on your VCR and use subspace field harmonics to scratch any CD's you try to play. It will give your ex-girlfriend your new phone number. It will mix Cool-Aid in your fish tank. It will drink all your beer and leave its socks out on the coffee table when there is company coming. It will put a dead kitten in the back pocket of your good suit pants and hide your car keys when you are late for work.

Good Times will make you fall in love with a penguin. It will give you nightmares about circus midgets. It will pour sugar in your gas tank and shave off both your eyebrows, while dating your current girlfriend behind your back and billing the dinner and hotel room to your Visa card Such is the power of Good Times: it reaches out beyond the grave to sully those things we hold most dear.

Good Times moves your car randomly around parking lots so that you can't find it. It will kick your dog. It will leave libidinous messages on your boss' voice mail in your voice! It is insidious and subtle, it is dangerous and terrifying to behold. It is also a rather interesting shade of mauve.

Good Times will give you Dutch elm disease. It will make a batch of methamphetamine in your bathtub and then leave bacon cooking on the stove while it goes out to chase primary school students with your new snowblower.

Listen to me. Good Times does not exist. It can not do anything to you But I can. I am sending this message to everyone in the world. Tell your friends, tell your family. If anyone else sends me another email about this fake Good Time virus, I will turn hating them into a religion. I will do things to them that would make a horse's head in your bed look like Sunday brunch.

</CITE>

Ernst


Graham Woolf
 

Hi

I wonder if someone can help me

I have two identical scripts as attached below

The only difference is that the composite has changed from true_color to snow_age in the Snow age script

The script for the visible image runs with no errors but the snow age script produces the attached errors

The error points to line 200 in the Snow age script but it is identical to the line in the Visible image script so I cant see why it fails in the snow age script

Its really confusing me

Many thanks

Graham


Ernst Lobsiger
 

On Sun, Nov 6, 2022 at 01:56 AM, Graham Woolf wrote:
Its really confusing me
Graham,

in this message you stated that the syntax broken script
you published has worked before (which is not possible).

https://groups.io/g/MSG-1/message/33548

Now you publish a script where you fixed the syntax
and wonder why it does still not work for 'snow_age'.

You also say that you have images to prove that (some
other version of the script) issued 'snow_age' images
before you have updated SatPy. So it should be rather
easy to go back to the SatPy version you had before.

If you can prove that it works for your previous SatPy
version 0.??.? (I told you to note the version) but not
for the latest SatPy version 0.37.1 then this is a bug.

In that case please file a SatPy bug report including a
minimal script that reproduces this 'snow_age' bug.

https://github.com/pytroll/satpy/issues


Cheers,
Ernst

P.S.
I already filed my findings for the PyCoast 1.6.0 bug:

https://groups.google.com/g/pytroll/c/JW90QP9QXys



Ernst Lobsiger
 

Dear All,

this is from my V 4.0 SNPP scripts and IIRC has been tested to work under SatPy 0.36.0:

# Available DAY composites: See files ../satpy/etc/composites/visir.yaml and viirs.yaml
# *************************************************************************************
# ['ash', 'cloudtop_daytime', 'dust', 'false_color', 'fire_temperature',
#  'fire_temperature_39refl', 'fire_temperature_awips', 'fire_temperature_eumetsat',
#  'fog', 'ir108_3d', 'ir_cloud_day', 'natural_color', 'natural_color_sun_lowres',
#  'natural_with_night_fog', 'night_fog', 'ocean_color', 'overview', 'snow_age',
#  'snow_lowres', 'true_color', 'true_color_crefl', 'true_color_lowres', 'true_color_lowres_crefl',
#  'true_color_lowres_land','true_color_lowres_marine_tropical', 'true_color_raw']
# NIG composites for DAY passes will not work if they use DNB channels

# Available NIG composites: See files ../satpy/etc/composites/visir.yaml and viirs.yaml
# *************************************************************************************
# ['adaptive_dnb', 'ash', 'dust', 'dynamic_dnb', 'fog', 'histogram_dnb', 'hncc_dnb',
#  'ir108_3d', 'natural_with_night_fog', 'night_fog', 'night_overview']
# DAY composites for NIG passes will be black, use DNB for Auroras

All these composites still work with SatPy 0.37.1 except for, you name it: 'snow_age'.

I'll file a satpy issue on github for that. Maybe this can be fixed at the coming PCW.

Regards,
Ernst


Ernst Lobsiger
 

Dear All,

PyCoast 1.6.1 solving the problem with lon/lat grid labels on full disk images is out on github.
You will probably have to wait until tomorrow for a miniconda update package to be available.

Ernst


Ernst Lobsiger
 

Dear All,

Satpy 0.38.0 is out and available on conda-forge. It has these improvements:

https://github.com/pytroll/satpy/releases

VIIRS 'snow_age' works again and there are additional composites for MTG that
will be fine tuned as soon as real FCI data is available. In case you update and
find that something does not work as it used to work before you can downgrade
again with (this may take some time to figure out all dependencies, be patient):

(pytroll) conda install satpy=0.36.0

Many thanks to Martin and Dave.

Ernst