Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Array Indices?
#1
Hi
My learning curve for Python is long.

I'm running a script that was used in someone else's project and I need to change some parameters to suit mine. Trouble is I have no idea what these are and what they do, other than they feed into matplotlib.pyplot to form contours.


cmax=500 # color scale
lmin=400 # cutting from east 
lmax=550 # cutting from west
rmin=520 # north of caldera
rmax=700 # south of caldera

###### kolumbo data
kxx=xx[rmin:rmax,lmin:lmax]
kyy=yy[rmin:rmax,lmin:lmax]
kelevation=elevation[rmin:rmax,lmin:lmax]
This is the error message when running the script:
Error:
C:/Users/David/PycharmProjects/pythonProject2/venv/init_collapse.py:107: UserWarning: No contour levels were found within the data range. cs=contour(kxx,kyy,-kelevation,[collapse_depth]) Traceback (most recent call last): File "C:/Users/David/PycharmProjects/pythonProject2/venv/init_collapse.py", line 108, in <module> csp=cs.collections[0].get_paths()[2] # path IndexError: list index out of range
The problem may relate to my input file of xyz coordinates that are used to form the contours.
Sample:

Output:
3574891.703 -3394097.321 -626.23 3574901.703 -3394097.321 -628.934 3574911.703 -3394097.321 -630.779 3574921.703 -3394097.321 -632.311 3574931.703 -3394097.321 -633.843 3574941.703 -3394097.321 -635.375 3574951.703 -3394097.321 -636.907 3574961.703 -3394097.321 -638.645 3574971.703 -3394097.321 -641.317 3574981.703 -3394097.321 -643.989 3574991.703 -3394097.321 -646.66 3575001.703 -3394097.321 -649.332 3575011.703 -3394097.321 -652.004 3575021.703 -3394097.321 -654.439 3575031.703 -3394097.321 -656.735 3575041.703 -3394097.321 -659.031
I hope you can help.
Thank you
Larz60+ write Mar-19-2022, 02:08 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time, please use BBCode on future posts.

Note: input data is shown in output tags. There aren't any input tags available, but output works.
Reply
#2
what are xx, yy and elevation?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Getting largest indices of array less than or equal to an array of numbers schniefen 5 2,653 Nov-02-2020, 08:14 PM
Last Post: schniefen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020