Python Forum
Putting many coordinates number inside codes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Putting many coordinates number inside codes
#1
Hi everyone,
I have a coordinate list. This ranges from (0,0) to (10,10). Each x and y coordinate increases by 1, this is like

(0,0) (0,1) (0,2) (0,3) ... (0,10)
(1,0) (1,1) (1,2) (1,3) ... (1,10)
.
.
.
(10,0) (10,1) (10,2) (10,3) ... (10,10).

I need to put all these coordinates inside my codes respectively without entering the numbers manually.

My code is supposed to be like that:

"inpNETCDF ='abc.nc'
dataset = Dataset(inpNETCDF, mode='r')
lat_site, lon_site = 0, 0"

"inpNETCDF ='abc.nc'"
dataset = Dataset(inpNETCDF, mode='r')
lat_site, lon_site = 0, 1"
...

Could you help me do that?
Thank you.
Reply
#2
I didn't work with netcdf, but you can create desired array of coordinates using list comprehension in Python:
coordinates = [(i, j ) for i in range(11) for j in range(11)]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  List / arrays putting in sentence Kurta 3 2,572 Dec-25-2020, 11:29 AM
Last Post: Larz60+
  Putting a condition Jiwan 3 2,728 Apr-25-2020, 11:28 AM
Last Post: anbu23
  Grabbing comma separed values from SQLite and putting them in a list PythonNPC 8 4,039 Apr-10-2020, 02:39 PM
Last Post: buran
  Putting frames on separate lines kenwatts275 3 2,430 Dec-16-2019, 04:52 PM
Last Post: kenwatts275
  reading txt file putting in list function Expel 7 3,770 Jul-17-2019, 03:18 PM
Last Post: Expel
  Putting text on images from excel/csv file sam77am 1 2,201 Apr-05-2019, 07:36 AM
Last Post: Larz60+
  Putting an array for each string that is printed to a loop ClaudioSimonetti 1 2,347 Feb-05-2019, 12:52 PM
Last Post: perfringo
  Number of cmds inside subprocess pannis 5 3,894 Sep-26-2017, 07:18 PM
Last Post: nilamo
  Putting GPS data into a file kendias 0 3,302 May-28-2017, 06:56 PM
Last Post: kendias

Forum Jump:

User Panel Messages

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