1- class NemoCurvilinear :
1+ from argparse import ArgumentParser
2+ from datetime import timedelta
3+ from glob import glob
4+
5+ import numpy as np
6+ import pytest
7+ import parcels
8+
9+ # ptype = {"scipy": parcels.ScipyParticle, "jit": parcels.JITParticle}
10+ # advection = {"RK4": parcels.AdvectionRK4, "AA": parcels.AdvectionAnalytical}
11+ path_nemo = "~/Documents/PhD/projects/2025-02_parcels_benchmarking/NemoCurvilinear_data"
12+
13+ class NemoCurvilinearJIT :
14+ particle_type = parcels .JITParticle
15+
216 def setup (self ):
3- pass
17+ filenames = {
18+ "U" : {
19+ "lon" : f"{ path_nemo } /mesh_mask.nc4" ,
20+ "lat" : f"{ path_nemo } /mesh_mask.nc4" ,
21+ "data" : f"{ path_nemo } /U_purely_zonal-ORCA025_grid_U.nc4" ,
22+ },
23+ "V" : {
24+ "lon" : f"{ path_nemo } /mesh_mask.nc4" ,
25+ "lat" : f"{ path_nemo } /mesh_mask.nc4" ,
26+ "data" : f"{ path_nemo } /V_purely_zonal-ORCA025_grid_V.nc4" ,
27+ },
28+ }
29+ variables = {"U" : "U" , "V" : "V" }
30+
31+ dimensions = {"lon" : "glamf" , "lat" : "gphif" , "time" : "time_counter" }
32+
33+ fieldset = parcels .FieldSet .from_nemo (
34+ filenames , variables , dimensions , allow_time_extrapolation = True
35+ )
36+
37+ # Start 20 particles on a meridional line at 180W
38+ npart = 20
39+ lonp = - 180 * np .ones (npart )
40+ latp = [i for i in np .linspace (- 70 , 85 , npart )]
41+
42+ self .pset = parcels .ParticleSet .from_list (fieldset , self .particle_type , lon = lonp , lat = latp )
43+ # pfile = parcels.ParticleFile("nemo_particles", pset, outputdt=timedelta(days=1))
44+
45+
446
547 def time_run_experiment (self ):
6- pass
7-
48+ self .pset .execute (
49+ parcels .AdvectionRK4 ,
50+ runtime = timedelta (days = 30 ),
51+ dt = timedelta (hours = 6 ),
52+ # output_file=pfile,
53+ )
54+
55+ class NemoCurvilinearScipy (NemoCurvilinearJIT ):
56+ particle_type = parcels .ScipyParticle
0 commit comments