Ich bin nach Jahren mit MATLAB (dank meiner Klassen während des College, wo sie meist Matlab verwendeten) in Python (mit Pycharm) gezogen. So sehr ich die Sprache auch viel mehr mag, ich bemerkte, dass die Zeit zum Kompilieren von Handlungen fast 2 Minuten dauert (was für meine vorherige Arbeit "viel" erscheint). Ich möchte Sie fragen, ob es eine Möglichkeit gibt, wie ich meinen Code langsamer zu kompilieren kann. Oder ist es nur so, wie es funktioniert? /> PCP_MJO: Eine Liste mit 4 Xarray -Datensätzen, die jeweils eine der Dimensionen lat: 73 Lon: 144, die die OLR -Variable derselben Dimensionen enthält.
import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
from cartopy.util import add_cyclic_point
import cmaps
# Rangos de contornos
clevs=np.arange(-25,26,2.5)
nrows=4
ncols=1
# Define the figure and each axis for the 3 rows and 3 columns
fig, axs = plt.subplots(nrows=nrows,ncols=ncols,
subplot_kw={'projection': ccrs.PlateCarree(central_longitude=-180)},
figsize=(6,20))
# getting the original colormap using cm.get_cmap() function
orig_map=cmaps.NEO_div_vegetation_c
# reversing the original colormap using reversed() function
reversed_map = orig_map.reversed()
# axs is a 2 dimensional array of `GeoAxes`. We will flatten it into a 1-D array
axs=axs.flatten()
#Loop over all of the models
for i,olrms in enumerate(F_mjo):
# Select the week 1 forecast from the specified model
data=PCP_MJO[i]
# Add the cyclic point
data,lons=add_cyclic_point(data,coord=ds['lon'])
# Contour plot
cs=axs[i].contourf(lons,ds['lat'],data,clevs,
transform = ccrs.PlateCarree(),
cmap=reversed_map,extend='both')
# Draw the coastines for each subplot
axs[i].coastlines()
gl = axs[i].gridlines(color='black',alpha=0.2)
axs[i].set_extent([50,-60, -35, 35], crs=ccrs.PlateCarree(central_longitude=-180))
# Longitude labels
if i == 3:
axs[i].set_xticks(np.arange(50,301,50), crs=ccrs.PlateCarree())
lon_formatter = cticker.LongitudeFormatter()
axs[i].xaxis.set_major_formatter(lon_formatter)
else:
axs[i].set_xticks(np.arange(50,301,50), crs=ccrs.PlateCarree())
axs[i].set_xticklabels([])
# Latitude labels
axs[i].set_yticks(np.arange(-35,36,20), crs=ccrs.PlateCarree())
lat_formatter = cticker.LatitudeFormatter()
axs[i].yaxis.set_major_formatter(lat_formatter)
# Title each subplot with the name of the model
axs[i].set_ylabel(olrms)
axs[i].set_title(str(days[i])+' days',loc='right',fontsize=10)
# Adjust the location of the subplots on the page to make room for the colorbar
fig.subplots_adjust(bottom=0.05, top=0.4, left=0.1, right=0.9,
wspace=0.01, hspace=0.3)
# Add a colorbar axis at the bottom of the graph
cbar_ax = fig.add_axes([0.2, 0.005, 0.6, 0.015])
# Draw the colorbar
rango= np.arange(-25,26,5)
cbar=fig.colorbar(cs, cax=cbar_ax,orientation='horizontal',ticks=rango)
#plt.title('OLR ($W/m^{2}$)')
cbar.set_label('OLR ($W/m^{2}$)')
Ich bin nach Jahren mit MATLAB (dank meiner Klassen während des College, wo sie meist Matlab verwendeten) in Python (mit Pycharm) gezogen. So sehr ich die Sprache auch viel mehr mag, ich bemerkte, dass die Zeit zum Kompilieren von Handlungen fast 2 Minuten dauert (was für meine vorherige Arbeit "viel" erscheint). [url=viewtopic.php?t=14917]Ich möchte[/url] Sie fragen, ob es eine Möglichkeit gibt, wie ich meinen Code langsamer zu kompilieren kann. Oder ist es nur so, wie es funktioniert? /> PCP_MJO: Eine Liste mit 4 Xarray -Datensätzen, die jeweils eine der Dimensionen lat: 73 Lon: 144, die die OLR -Variable derselben Dimensionen enthält.[code]import numpy as np import matplotlib.pyplot as plt import cartopy.crs as ccrs from cartopy.util import add_cyclic_point import cmaps
# Rangos de contornos clevs=np.arange(-25,26,2.5) nrows=4 ncols=1
# Define the figure and each axis for the 3 rows and 3 columns fig, axs = plt.subplots(nrows=nrows,ncols=ncols, subplot_kw={'projection': ccrs.PlateCarree(central_longitude=-180)}, figsize=(6,20))
# getting the original colormap using cm.get_cmap() function orig_map=cmaps.NEO_div_vegetation_c
# reversing the original colormap using reversed() function reversed_map = orig_map.reversed() # axs is a 2 dimensional array of `GeoAxes`. We will flatten it into a 1-D array axs=axs.flatten()
#Loop over all of the models for i,olrms in enumerate(F_mjo): # Select the week 1 forecast from the specified model data=PCP_MJO[i]
# Add the cyclic point data,lons=add_cyclic_point(data,coord=ds['lon'])
# Draw the coastines for each subplot axs[i].coastlines() gl = axs[i].gridlines(color='black',alpha=0.2) axs[i].set_extent([50,-60, -35, 35], crs=ccrs.PlateCarree(central_longitude=-180))
# Longitude labels if i == 3: axs[i].set_xticks(np.arange(50,301,50), crs=ccrs.PlateCarree()) lon_formatter = cticker.LongitudeFormatter() axs[i].xaxis.set_major_formatter(lon_formatter) else: axs[i].set_xticks(np.arange(50,301,50), crs=ccrs.PlateCarree()) axs[i].set_xticklabels([])
# Latitude labels axs[i].set_yticks(np.arange(-35,36,20), crs=ccrs.PlateCarree()) lat_formatter = cticker.LatitudeFormatter() axs[i].yaxis.set_major_formatter(lat_formatter) # Title each subplot with the name of the model axs[i].set_ylabel(olrms)
axs[i].set_title(str(days[i])+' days',loc='right',fontsize=10) # Adjust the location of the subplots on the page to make room for the colorbar fig.subplots_adjust(bottom=0.05, top=0.4, left=0.1, right=0.9, wspace=0.01, hspace=0.3)
# Add a colorbar axis at the bottom of the graph cbar_ax = fig.add_axes([0.2, 0.005, 0.6, 0.015])
Ich bin nach Jahren mit MATLAB (dank meiner Klassen während des College, wo sie meist Matlab verwendeten) in Python (mit Pycharm) gezogen. So sehr ich die Sprache auch viel mehr mag, ich bemerkte,...
Warum läuft der erste von Matplotlib oder pandas df.plot verarbeitete Plot im Vergleich zu allen nachfolgenden Plots extrem langsam? Dies tritt sogar dann auf, wenn die nachfolgenden Diagramme völlig...
Ich möchte eine netCDF -Ressource über WCS unter Verwendung von Mapserver Python -Bindungen bedienen. https: // mydomain/get_wcs/test/wcs
Meine API basiert auf Fastapi und die Methode get_wcs sieht...
Ich fange gerade erst mit ML an, also würde ich mich über einen Rat freuen. Die Daten sind stark unausgewogen (~ 96% Normal gegenüber ~ 4% betrügerisch). Speicherzuweisungsfehler:...
Ich hatte eine Vorstellung von einem neuen Sortieralgorithmus, der sich teilt und erobert, indem er einen zufälligen Index aufnimmt und das Array in zwei separate Arrays aufteilt. Algorithmusarbeit?...