
import netCDF4 as nc
import numpy as np
import sys
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap

np.set_printoptions(threshold=sys.maxsize)

filepath = '/esarchive/scratch/lpalma/geo_em.d01.nc.peninsula-paso1'
file = nc.Dataset(filepath)


LAT = file.variables["XLAT_M"]
LON = file.variables["XLONG_M"]

lat = np.array(LAT[:])
lon = np.array(LON[:])

def get_data(lat_input, long_input):
   lat_index  = np.nanargmin((lat-lat_input)**2)
   long_index = np.nanargmin((lon-long_input)**2)
   return lat_index,long_index

get_data(41.384960,2.117082)



m = Basemap(llcrnrlon=-3,llcrnrlat=38.,urcrnrlon=4,urcrnrlat=45,
            projection='lcc',lat_1=39.,lat_2=42.,lon_0=-2,
            resolution ='l',area_thresh=1000.)

plt.plot(2,41))
plt.show()




