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

Issue with user-defined text legend scale #106

Open
Lucanta opened this issue Feb 6, 2024 · 4 comments
Open

Issue with user-defined text legend scale #106

Lucanta opened this issue Feb 6, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Lucanta
Copy link

Lucanta commented Feb 6, 2024

What happened?

There is a magics bug in python/metview by which when specifying a user-defined text legend scale (egend_text_composition="user_text_only"), the penultimate value of the legend is missing and is instead moved to the last position, while the last element doesn't appear at all. See image attached below.

spr_norm_t

What are the steps to reproduce the bug?

Below the python script I run.
NB. file is available in a public path in my home


import metview as mv

ens_t = mv.read(source="ens_t.grib",number=[1,2,3,4,5,6,7,8,9,10])

spr_t = mv.stdev(ens_t)
max_t = mv.maxvalue(ens_t)
spr_t_norm = spr_t/max_t

print(mv.minvalue(spr_t_norm),mv.maxvalue(spr_t_norm))

cont_spread = mv.mcont(
legend = "on",
contour = "off",
contour_label = "off",
contour_level_selection_type = "level_list",
contour_max_level = 1000.,
contour_min_level = 0.,
contour_level_list = [0,0.001,0.002,0.003,0.004,0.005,0.006,0.007,0.008,0.009,0.01],
contour_shade = "on",
contour_shade_colour_method = "palette",
contour_shade_method = "area_fill",
contour_shade_palette_name = "colorbrewer_ext_YlGn_10_r",
)

coast = mv.mcoast(
map_coastline_colour="charcoal",
map_coastline_resolution="medium",
map_coastline_land_shade="on",
map_coastline_land_shade_colour="beige",
map_coastline_sea_shade="on",
map_coastline_sea_shade_colour="RGB(0.8178,0.9234,0.9234)",
map_grid_colour="RGB(0.4,0.4,0.4)",
map_label_height=0.35,
)

title = mv.mtext(text_line_1="Normalised spread",text_font_size=1.2)
legend = mv.mlegend(legend_text_font_size=0.5,legend_title_font_size=1.0,legend_text_composition="user_text_only",legend_user_lines=["0","0.1%","0.2%","0.3%","0.4%","0.5%","0.6%","0.7%","0.8%","0.9%","1%"])

view = mv.geoview(coastlines=coast)

dw = mv.plot_superpage(pages=mv.mvl_regular_layout(view,1,1,1,1,[0,100,0,100]))

mv.setoutput(mv.png_output(output_name="spr_norm_t",output_name_first_page_number="off",output_width=1600))
mv.plot(dw,spr_t_norm,cont_spread,legend,title)

Version

Python 3.6.8, metview-python 1.14.0

Platform (OS and architecture)

Linux VDI (release 1.40)

Relevant log output

No log available (no error is produced).

Accompanying data

/home/dalc/Public/ens_t.grib

Organisation

ECMWF

@Lucanta Lucanta added the bug Something isn't working label Feb 6, 2024
@sylvielamythepaut
Copy link
Contributor

Hi,
Thanks for your bug report.
I think I have enough information to reproduce the problem.
Sylvie

@sylvielamythepaut
Copy link
Contributor

Hi,
I am trying to fix this issue, but I have a question that will help me to understand :
Was it working in a previous version of Metview ?
Thanks a lot for your help
Sylvie

@Lucanta
Copy link
Author

Lucanta commented Mar 8, 2024 via email

@sylvielamythepaut
Copy link
Contributor

sylvielamythepaut commented Mar 8, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants