Это мой код Python. Он работал один раз, но после того, как я что-то изменил, и я не помню, что я изменил, теперь он возвращает эту ошибку:
повышение RuntimeError («Невозможно поместить одного исполнителя в» RuntimeError: Может
не помещать одного художника в более чем одну фигуру
Любая помощь по этому вопросу
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy.ma as ma
import netCDF4
import os
import datetime
mydate='20181110' #(put today date)
myhour = '00' # in UTC timezone
url='http://nomads.ncep.noaa.gov:9090/dods/hrrr/hrrr%s/hrrr_sfc.t%sz' %(mydate,myhour)
print url
# make sure folder exists
folder_path = 'pcptype/%s/%sz' %(mydate,myhour)
if not os.path.exists(folder_path):
os.makedirs(folder_path)
# Read data
t = 10
file = netCDF4.Dataset(url)
lat = file.variables['lat'][:]
lon = file.variables['lon'][:]
time = file.variables['time'][:]
rad_ref = file.variables['refcclm'][t,:,:]
#### plotting data
m=Basemap(projection='merc',lat_ts=0,llcrnrlon=-81.0, \
urcrnrlon=-66,llcrnrlat=41.0,urcrnrlat=49.0, resolution='i')
bounds_rain = [0,5,10,15,20,25,30,35,40,100]
bounds_ref = [10,25,30,35,40,100] cmap=mpl.colors.ListedColormap(['#99CCFF','#0099FF','#00FF66','#00CC00','#009900','#006600','#FFFF33','#FFCC00','#FF9900','#FF6600','#FF0000','#FF0299','#9933CC','#660099'])
xx,yy = np.meshgrid(lon,lat)
x,y =m(xx,yy)
m.drawstates()
m.drawcoastlines()
m.drawcountries()
m.drawmapboundary()
norm_ref = mpl.colors.BoundaryNorm(bounds_ref, cmap.N)
first_date = datetime.datetime(1,1,1,0,0,0)
init_datetime = first_date+ datetime.timedelta(time[0])
#for t in range(1, len(time)):
print 'processing time %i ' %t
fct_datetime = first_date + datetime.timedelta(time[t])
fig_name = 'pcp_type_%s' %(fct_datetime.strftime("%Y%m%d_%H00"))
print fig_name
fig=plt.figure(figsize=(10, 10))
map1=m.contourf(x, y, rad_ref,len(bounds_ref),norm=norm_ref,cmap=cmap,levels=bounds_rain)
plt.title("RADAR | Init : %s Valid: %s" \
%(init_datetime.strftime("%HZ %Y-%m-%d"),fct_datetime.strftime("%HZ %Y-%m-%d")),loc='left')
plt.savefig("%s/%s.png" %(folder_path,fig_name), dpi=200,bbox_inches='tight' )