ich benutze python im zusammenhang mit ozeandaten (netCDF). ich versuche gerade, thermoclines u.a. darzustellen.. im gegensatz zu ganzen karten, brauche ich hier ja eine konkrete ortsangabe (lat,lon).
ich habe die variablen
Code: Alles auswählen
double lon(y, x) ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
lon:standard_name = "longitude" ;
lon:_CoordinateAxisType = "Lon" ;
double lat(y, x) ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
lat:standard_name = "latitude" ;
lat:_CoordinateAxisType = "Lat" ;
Code: Alles auswählen
float tho(time, depth, y, x) ;
tho:long_name = "Sea water potential temperature" ;
tho:standard_name = "sea_water_potential_temperature" ;
tho:units = "C" ;
tho:code = 2 ;
tho:coordinates = "lon lat" ;
tho:_FillValue = -9.e+33f ;
Code: Alles auswählen
import matplotlib as mpl
mpl.use('Qt4Agg')
import matplotlib.pyplot as plt
import numpy as np
import netCDF4
from netCDF4 import Dataset
# import data
infile = 'MeinDatensatz'
# open the data set
f = netCDF4.MFDataset(infile)
lons = f.variables['lon'][:,:]
lats = f.variables['lat'][:,:]
xx = np.where(lons == 65)
yy = np.where(lats == 15)
depth = f.variables['depth']
tho = f.variables['tho'][0,:,yy,xx]
figure1 = plt.figure()
ax1 = figure1.add_subplot(111)
ax1.plot(tho, depth, 'o-')
# draw x label
ax1.set_xlabel('Sea water potential temperature')
ax1.xaxis.set_label_position('top')
ax1.xaxis.set_ticks_position('top')
# draw y label
ax1.set_ylabel('depth')
ax1.set_ylim(ax1.get_ylim()[::-1])
Code: Alles auswählen
IndexError: Index cannot be multidimensional.
lieben dank im voraus für eure hilfe!