Skip to content
Snippets Groups Projects

[ISSUE#1] Moved int() to x_new and y_new

Open Alberto.Rovetta requested to merge ISSUE#1 into master
1 file
+ 7
6
Compare changes
  • Side-by-side
  • Inline
+ 7
6
@@ -6,7 +6,7 @@ from matplotlib import colors
import pandas as pd
import os
#import pathlib as path
#TEST LINE 9
#map_path = path.Path("/gl-latlong-1km-landcover.bsq")
#map_numpy = np.fromfile('gl-latlong-1km-landcover.bsq', shape = (43200,21600), dtype = np.int8)
map_numpy = np.memmap('gl-latlong-1km-landcover.bsq', shape = (21600,43200,), dtype = np.int8)
@@ -36,11 +36,11 @@ y= 53 #NORD/SOUTH
def is_this_land(x:float, y:float, map_transform):
TRANSF_CONST = 180/map_transform.shape[0]
x_new = (x + 180)/TRANSF_CONST
y_new = (90 - y)/TRANSF_CONST
x_new = int((x + 180)/TRANSF_CONST)
y_new = int((90 - y)/TRANSF_CONST)
try:
ans = map_transform[int(y_new), int(x_new)] > 0
return ans, int(x_new), y_new, TRANSF_CONST, map_transform[int(y_new), int(x_new)]
ans = map_transform[y_new, x_new] > 0
return ans, x_new, y_new, TRANSF_CONST, map_transform[y_new, x_new]
except:
print("coordinates out of limit")
pass
@@ -56,4 +56,5 @@ print(is_this_land(x,y,map_numpy))
#erq_file = np.loadtxt('events_4.5(1).txt', delimiter = ";", dtype = str, encoding= 'latin1')
#print(erq_file[1,:])
\ No newline at end of file
#print(erq_file[1,:])
Loading