|
str | dir1 = "./sampledata/scale-5.4.5/scale-rm/test/tutorial/real/experiment/run/" |
|
int | PRC_NUM_X = 2 |
|
int | PRC_NUM_Y = 2 |
|
str | ftype = "history" |
|
str | domainlabel = "_d01" |
|
str | timelabel = "" |
|
str | varname1 = "T2" |
| Value (e.g., PREC) 2D (spatial) + time.
|
|
str | varunit1 = "(K)" |
|
int | varfact1 = 1 |
|
| varlevels1 = np.linspace(265,305,41) |
|
str | varcmap1 = "jet" |
|
int | blct = 1 |
|
int | blcy = 15 |
|
int | blcx = 15 |
|
| args = sys.argv |
|
| PRC_NUM_X_ANL = int(args[1]) |
|
| PRC_NUM_Y_ANL = int(args[2]) |
|
str | dir_out = "./fig/" |
|
str | horaxis = "LATLON" |
|
bool | withmap = True |
|
| lonticks = np.arange(80,180+1,10) |
|
| latticks = np.arange(10,60+1,10) |
|
int | slon = 120 |
|
int | elon = 150 |
|
int | slat = 25 |
|
int | elat = 45 |
|
bool | savefig = True |
|
| comm |
|
| size |
|
| rank |
|
| PRC_NUM_X_PER_ANL |
|
| PRC_NUM_Y_PER_ANL |
|
| fpathlist = get_fpathlist_mpi(dir1,ftype,domainlabel,timelabel,PRC_NUM_X,PRC_NUM_Y,PRC_NUM_X_ANL,PRC_NUM_Y_ANL,size,rank) |
|
| PRC_NUM_ARR0 = check_prcnum_mpi(PRC_NUM_X,PRC_NUM_Y,PRC_NUM_X_ANL,PRC_NUM_Y_ANL,size,rank) |
|
| xrvar = get_xrvar(fpathlist) |
|
| var2d_avg = get_blcavg(xrvar,varname1,blct,blcy,blcx) |
|
| sendbuf = np.array(var2d_avg,"d") |
|
| recvbuf = None |
|
| root |
|
| var2d_avg_combined = combine_var2d_blockavg(sendbuf,recvbuf,PRC_NUM_Y_ANL,PRC_NUM_X_ANL) |
|
| time = xrvar.coords["time"] |
|
| tsize = len(time) |
|
str | tlabel = f"{t*blct:04d}-{(t+1)*blct-1:04d}" |
|
| lon = xrvar.coords["lon"] |
|
| lat = xrvar.coords["lat"] |
|
| fig = plt.figure(figsize=(8,5)) |
|
| ax = fig.add_subplot(111,projection=ccrs.PlateCarree()) |
|
| color |
|
| crs |
|
| xlocs |
|
| ylocs |
|
| figsize |
|
| cax = ax.contourf(lon[blcy//2::blcy,blcx//2::blcx],lat[blcy//2::blcy,blcx//2::blcx],varfact1*var2d_avg_combined[t,:,:],levels=varlevels1,cmap=varcmap1) |
|
str | figtitle = f"mpi_xarray_coarsened_ll_{varname1}_blct{blct:04d}blcy{blcy:04d}blcx{blcx:04d}_t{tlabel}.png" |
|
| x = xrvar.coords["x"] |
|
| y = xrvar.coords["y"] |
|
| cbar = plt.colorbar(cax,ax=ax,fraction=0.02) |
|
MPI 並列を用いた水平粗視化・描画
MPI並列(MPI Gather)を用いた二次元変数の粗視化分布
- Author
- Tomoro Yanase, Team SCALE
- Note
- 実行例: $ mpirun -n 2 python mpi_xarray_coarsened_xy.py 1 2