matplotlib - Python netcdf plot data onto grid -


i using lat, lon data , average sample_data within grid cell (say 1km x 1km) uniformly across whole area, , plot similar post, basemap, i'm bit stuck start: heatmap text in each cell matplotlib's pyplot

the code below plots values through each time point, , i'd average data within defined grid squares across whole data area @ each time point, , plot average value onto basemap grid @ set time intervals (ie. make set of images timelapse/movie).

import matplotlib.pyplot plt mpl_toolkits.basemap import basemap netcdf4 import dataset import matplotlib.cm cm  data = dataset(netcdf_data,'r')  lat = data.variables['lat'][:] lon = data.variables['lon'][:] time = data.variables['time'][:]   fig = plt.figure(figsize=(1800,1200)) m = basemap(projection='ortho',lon_0=5,lat_0=35,resolution='l') m.drawcoastlines()   value in range(0,len(sample_data)):     m.plot(lat[:,value], lon[:,value], alpha=1, latlon=true)  plt.show() 

well, can maximum , minimum of latitude , longitude.

and age of sample_data @ particular time t using:

data_within_box = sample_data[minlat:maxlat,minlon:maxlon,:,t] avg_age = numpy.average(data_within_box)  

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -