-
Notifications
You must be signed in to change notification settings - Fork 168
Closed
Labels
Description
In pursuit of #1581, I encountered the following error message:
NotImplementedError: Cannot convert 'parcels' used in kernel to C-code
See the following minimal example. Doing the suggested change causes the error message:
import parcels
- from parcels import ParcelsRandom
example_dataset_folder = parcels.download_example_dataset("GlobCurrent_example_data")
filenames = {
"U": f"{example_dataset_folder}/20*.nc",
"V": f"{example_dataset_folder}/20*.nc",
}
variables = {
"U": "eastward_eulerian_current_velocity",
"V": "northward_eulerian_current_velocity",
}
dimensions = {"lat": "lat", "lon": "lon", "time": "time"}
fieldset = parcels.FieldSet.from_netcdf(filenames, variables, dimensions)
def nudge_kernel(particle, fieldset, time):
- dlat = ParcelsRandom.normalvariate(0.0, 1.0)
+ dlat = parcels.ParcelsRandom.normalvariate(0.0, 1.0)
particle_dlat += dlat
time = np.arange(0, 43200, 3600)
lon = [29] * len(time)
lat = [-33] * len(time)
pset = parcels.ParticleSet(fieldset=fieldset, pclass=parcels.JITParticle, lon=lon, lat=lat, time=time)
pset.execute(
nudge_kernel,
runtime=timedelta(days=7),
dt=timedelta(minutes=5),
output_file=output_file,
)Likely culplit is code here:
https://github.com/OceanParcels/parcels/blob/035159a1b4002bc1550cebd275f93c0adaa8513d/parcels/compilation/codegenerator.py#L251-L265
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done