Could you please tell me how to initialize particles in a square grid pattern with equal spacing using a Parcels ParticleSet? #2691
-
QuestionQuestionI've been using start, finish, and size to initialize particles along a line, but I'm struggling to figure out how to set them up in a regular grid pattern. What is the best way to achieve a 2D grid layout in Parcels? from datetime import timedelta import matplotlib.pyplot as plt import parcels import cartopy.crs as ccrs 1.variables={ 2.dimensions={ } fieldsetの作成。from_netcdf を使って読み込むfieldset = parcels.FieldSet.from_netcdf( 確認print(fieldset) #particleset作成。fieldsetを用いる print(pset) #particlefileの作成。particlesetを用いる print(output_file) #実行 #作成したzarrデータをxarrayで読み込む print(ds) fig=plt.figure(figsize=(12,8)) 2. 地図の機能を追加(陸地・海など)ax.add_feature(cfeature.LAND, facecolor="white") #粒子の挙動の描画 開始地点をドットで強調ax.plot(ds.lon.T.loc[0], ds.lat.T.loc[0], "o", color="red", label="Start") #ax.pcolormesh(fieldset.U.grid.lon,fieldset.U.grid.lat,fieldset.U.data[0,:,:]) plt.xlabel("lon") === 緯度・経度グリッド線の追加 === 12/16gl = ax.gridlines( 画面に表示plt.show() |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi @nbuaan0211-stack , you can use the |
Beta Was this translation helpful? Give feedback.
Hi @nbuaan0211-stack , you can use the
from_list()function to do this. Create a list of longitudes and latitudes using numpy, for example usingmeshgrid, and pass these intofrom_list(see https://docs.parcels-code.org/en/latest/reference/particles.html#parcels.particleset.ParticleSet.from_list)