depth_time_contour error

12 views
Skip to first unread message

Erik Guldbech

unread,
Apr 25, 2024, 6:49:00 PM4/25/24
to pitlakq-users
Hi,

While using the depth_time_contour function to plot temperature, the following error is generated. A plot is generated; however, the legend is missing. Running python 3.9.19 with Pitlakq 1.7.3. 

Thanks,
Erik 

--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[17], line 4 2 # (nc_out, species, location, tar, time_slot, show_ice, save, show, no_show_below, lower_border, show_water_level, upper_border) 3 species=[{"name": "t2", "levels": "auto"}] ----> 4 depth_time_contour.main(out_dir + "/out.nc", species=species, location=9) File ~\.conda\envs\pitlakq310\lib\site-packages\pitlakq\postprocessing\depth_time_contour.py:595, in main(nc_out, species, location, tar, time_slot, show_ice, save, show, no_show_below, lower_border, show_water_level, upper_border) 593 contour.read_data() 594 if show: --> 595 contour.show() 596 if save: 597 contour.save_figure() File ~\.conda\envs\pitlakq310\lib\site-packages\pitlakq\postprocessing\depth_time_contour.py:321, in Contour.show(self) 319 print(name) 320 if name not in self._figures: --> 321 fig = self._draw(specie) 322 self._figures[name] = fig 323 fig = self._figures[name] File ~\.conda\envs\pitlakq310\lib\site-packages\pitlakq\postprocessing\depth_time_contour.py:382, in Contour._draw(self, specie) 380 zcoord = self.zcoord[::-1][:] 381 for axis_name in all_axies: --> 382 cont = self._draw_subplot(all_axies[axis_name], titles[axis_name], 383 data[axis_name], zcoord, levels, cmap, 384 set_label[axis_name]) 385 plt.subplots_adjust(bottom=XAXIS['bottom'], right=0.8, top=0.9) 386 cax = plt.axes([0.85, 0.1, 0.03, 0.8]) File ~\.conda\envs\pitlakq310\lib\site-packages\pitlakq\postprocessing\depth_time_contour.py:435, in Contour._draw_subplot(self, axis, title, data, zcoord, levels, cmap, set_label) 433 axis.xaxis.set_major_formatter(plt.FixedFormatter([])) 434 for tick in axis.xaxis.majorTicks: --> 435 tick.label._rotation = XAXIS['rotation'] 436 tick.label._fontproperties = FontProperties( 437 size=XAXIS['font_size']) 438 text = PROJECT['description'] AttributeError: 'XTick' object has no attribute 'label'

Screenshot 2024-04-25 162011.png

Erik Guldbech

unread,
Apr 25, 2024, 6:53:13 PM4/25/24
to pitlakq-users
Second attempt at better text formatting:

--------------------------------------------------------------------------- AttributeError Traceback (most recent call last)
Cell In[20], line 4

Dr. Mike Mueller

unread,
Apr 26, 2024, 2:10:52 AM4/26/24
to pitlak...@googlegroups.com
Hi Erik,

What version of Matplotlib are you using? Please type:

conda list matplotlib

and paste the output in your reply.

Also, what operating system are you on?

Best,
Mike


PS: Pasting the traceback was good. This really helped to understand what
happened. But the line breaks were gone. Everything was one long line.
Maybe you can find a way to keep the line breaks when pasting. This would
help considerable to read and understand the pasted text. One way could be
to past the text in an editor first and then do another copy-paste from
the editor into your message. But a one-line traceback is much better than
none. ;)

Am 26.04.24 um 00:49 schrieb Erik Guldbech:
> Hi,
>
> While using the depth_time_contour function to plot temperature, the
> following error is generated. A plot is generated; however, the legend is
> missing. Running python 3.9.19 with Pitlakq 1.7.3.
>
> Thanks, Erik
>
> ---------------------------------------------------------------------------
> AttributeError Traceback (most recent call last) Cell In[17], line 4 2 #
> (nc_out, species, location, tar, time_slot, show_ice, save, show,
> no_show_below, lower_border, show_water_level, upper_border) 3
> species=[{"name": "t2", "levels": "auto"}] ----> 4
> depth_time_contour.main(out_dir+"/out.nc",species=species,location=9) File
> ~\.conda\envs\pitlakq310\lib\site-packages\pitlakq\postprocessing\depth_time_contour.py:595
> <http://localhost:8889/lab/tree/pitlakq_work/models/Berkeley_Pit_Project/Python_processing/~/.conda/envs/pitlakq310/lib/site-packages/pitlakq/postprocessing/depth_time_contour.py#line=594>,
> in main(nc_out, species, location, tar, time_slot, show_ice, save, show,
> no_show_below, lower_border, show_water_level, upper_border) 593
> contour.read_data() 594 if show: --> 595 contour.show() 596 if save: 597
> contour.save_figure() File
> ~\.conda\envs\pitlakq310\lib\site-packages\pitlakq\postprocessing\depth_time_contour.py:321
> <http://localhost:8889/lab/tree/pitlakq_work/models/Berkeley_Pit_Project/Python_processing/~/.conda/envs/pitlakq310/lib/site-packages/pitlakq/postprocessing/depth_time_contour.py#line=320>,
> in Contour.show(self) 319 print(name) 320 if name not in self._figures: -->
> 321 fig = self._draw(specie) 322 self._figures[name] = fig 323 fig =
> self._figures[name] File
> ~\.conda\envs\pitlakq310\lib\site-packages\pitlakq\postprocessing\depth_time_contour.py:382
> <http://localhost:8889/lab/tree/pitlakq_work/models/Berkeley_Pit_Project/Python_processing/~/.conda/envs/pitlakq310/lib/site-packages/pitlakq/postprocessing/depth_time_contour.py#line=381>,
> in Contour._draw(self, specie) 380 zcoord = self.zcoord[::-1][:] 381 for
> axis_name in all_axies: --> 382 cont =
> self._draw_subplot(all_axies[axis_name],titles[axis_name], 383
> data[axis_name],zcoord,levels,cmap, 384 set_label[axis_name]) 385
> plt.subplots_adjust(bottom=XAXIS['bottom'], right=0.8, top=0.9) 386 cax =
> plt.axes([0.85, 0.1, 0.03, 0.8]) File
> ~\.conda\envs\pitlakq310\lib\site-packages\pitlakq\postprocessing\depth_time_contour.py:435
> <http://localhost:8889/lab/tree/pitlakq_work/models/Berkeley_Pit_Project/Python_processing/~/.conda/envs/pitlakq310/lib/site-packages/pitlakq/postprocessing/depth_time_contour.py#line=434>,
> in Contour._draw_subplot(self, axis, title, data, zcoord, levels, cmap,
> set_label) 433 axis.xaxis.set_major_formatter(plt.FixedFormatter([])) 434
> for tick in axis.xaxis.majorTicks: --> 435 tick.label._rotation =
> XAXIS['rotation'] 436 tick.label._fontproperties = FontProperties( 437
> size=XAXIS['font_size']) 438 text = PROJECT['description'] AttributeError:
> 'XTick' object has no attribute 'label'
>
> Screenshot 2024-04-25 162011.png
>
> -- You received this message because you are subscribed to the Google Groups
> "pitlakq-users" group. To unsubscribe from this group and stop receiving
> emails from it, send an email to pitlakq-user...@googlegroups.com
> <mailto:pitlakq-user...@googlegroups.com>. To view this
> discussion on the web visit
> https://groups.google.com/d/msgid/pitlakq-users/533f7c0f-f63a-4267-b819-6f978ba20588n%40googlegroups.com
> <https://groups.google.com/d/msgid/pitlakq-users/533f7c0f-f63a-4267-b819-6f978ba20588n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Dr. Mike Mueller

unread,
Apr 26, 2024, 2:17:27 AM4/26/24
to pitlak...@googlegroups.com
Just found your second message with the nicely formatted output in a different
system. It somehow did make it through my email client. So, forget the PS.
Problem solved. ;)

Am 26.04.24 um 08:10 schrieb Dr. Mike Mueller:

Erik Guldbech

unread,
Apr 26, 2024, 9:28:29 PM4/26/24
to pitlak...@googlegroups.com
Hi Mike,

Thanks for the quick response and that you were able to find the second email with reformatted text. 

With respect to matplotlib:
Screenshot 2024-04-26 090334.png

I am running Windows 11 Pro Version 23H2 (OS Build 22631.3447)

Thanks,
Erik 

To unsubscribe from this group and stop receiving emails from it, send an email to pitlakq-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pitlakq-users/b3bf8f34-f686-4852-8d56-9b9258102fa3%40hydrocomputing.com.

Dr. Mike Mueller

unread,
Apr 27, 2024, 2:55:13 AM4/27/24
to pitlak...@googlegroups.com
Hi Erik,

Thanks for your response. I can reproduce the problem. Matplotlib changed some
API calls. I need to make a new release. Please downgrade matplotlib for now:

conda install matplotlib=3.7

This should fix it.

Best,
Mike

Am 26.04.24 um 17:08 schrieb Erik Guldbech:
> Hi Mike,
>
> Thanks for the quick response and that you were able to find the second
> email with reformatted text.
>
> With respect to matplotlib: Screenshot 2024-04-26 090334.png
> <http://out.nc>",species=species,location=9) File
> <mailto:pitlakq-users%2Bunsu...@googlegroups.com>
>>> <mailto:pitlakq-user...@googlegroups.com
> <mailto:pitlakq-users%2Bunsu...@googlegroups.com>>. To view this
> <https://groups.google.com/d/msgid/pitlakq-users/533f7c0f-f63a-4267-b819-6f978ba20588n%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/pitlakq-users/533f7c0f-f63a-4267-b819-6f978ba20588n%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> -- You received this message because you are subscribed to the Google
> Groups "pitlakq-users" group. To unsubscribe from this group and stop
> receiving emails from it, send an email to
> pitlakq-user...@googlegroups.com
> <mailto:pitlakq-users%2Bunsu...@googlegroups.com>. To view this
> discussion on the web visit
> https://groups.google.com/d/msgid/pitlakq-users/b3bf8f34-f686-4852-8d56-9b9258102fa3%40hydrocomputing.com
> <https://groups.google.com/d/msgid/pitlakq-users/b3bf8f34-f686-4852-8d56-9b9258102fa3%40hydrocomputing.com>.
>
> -- You received this message because you are subscribed to the Google
> Groups "pitlakq-users" group. To unsubscribe from this group and stop
> receiving emails from it, send an email to
> pitlakq-user...@googlegroups.com
> <mailto:pitlakq-user...@googlegroups.com>. To view this discussion
> on the web visit
> https://groups.google.com/d/msgid/pitlakq-users/CA%2BH1BetVD6JGS097wP8ksnV8QmwB0wFKGcukbBpxNp%3Doycn%3Dww%40mail.gmail.com
> <https://groups.google.com/d/msgid/pitlakq-users/CA%2BH1BetVD6JGS097wP8ksnV8QmwB0wFKGcukbBpxNp%3Doycn%3Dww%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Erik Guldbech

unread,
Apr 27, 2024, 2:27:52 PM4/27/24
to pitlak...@googlegroups.com
Hi Mike,

Downgrading Matplotlib worked. Much appreciated!

-Erik 

To unsubscribe from this group and stop receiving emails from it, send an email to pitlakq-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pitlakq-users/08567792-bd61-4524-b806-6fa36a89bcbf%40hydrocomputing.com.
Reply all
Reply to author
Forward
0 new messages