Skip to content

Commit

Permalink
Hopefully fixing all flake8 compliance problems
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldenes committed Jun 4, 2024
1 parent ed1ce9d commit 7824ed4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
24 changes: 12 additions & 12 deletions tests/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ def make_simple_fieldset():

def make_standard_simulation_settings():
simulation_settings = {'startdate': datetime.strptime('2020-01-04-00:00:00', '%Y-%m-%d-%H:%M:%S'),
'runtime': timedelta(days=2),
'outputdt': timedelta(hours=1),
'dt': timedelta(minutes=20),
}
'runtime': timedelta(days=2),
'outputdt': timedelta(hours=1),
'dt': timedelta(minutes=20),
}
return simulation_settings


def make_standard_plastictype_settings():
plastictype_settings = {'wind_coefficient' : 0.01, # Percentage of wind to apply to particles
'plastic_diameter' : 0.01, # Plastic particle diameter (m)
'plastic_density' : 1030., # Plastic particle density (kg/m^3)
}
plastictype_settings = {'wind_coefficient': 0.01, # Percentage of wind to apply to particles
'plastic_diameter': 0.01, # Plastic particle diameter (m)
'plastic_density': 1030., # Plastic particle density (kg/m^3)
}
return plastictype_settings


Expand Down Expand Up @@ -76,8 +76,8 @@ def test_create_particleset_from_map(initialisation_map):
settings['plastictype'] = make_standard_plastictype_settings()

settings['release'] = {'initialisation_type': initialisation_map,
'country': 'Italy',
}
'country': 'Italy',
}

fieldset = make_simple_fieldset()
pset = pp.constructors.create_particleset_from_map(fieldset, settings)
Expand All @@ -97,8 +97,8 @@ def test_create_particleset_from_map_concentrations(concentration_type):
settings['plastictype'] = make_standard_plastictype_settings()

settings['release'] = {'initialisation_type': 'global_concentrations',
'concentration_type': concentration_type,
}
'concentration_type': concentration_type,
}

fieldset = make_simple_fieldset()
pset = pp.constructors.create_particleset_from_map(fieldset, settings)
Expand Down
26 changes: 13 additions & 13 deletions tests/test_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@

def make_standard_simulation_settings():
simulation_settings = {'startdate': datetime.strptime('2020-01-04-00:00:00', '%Y-%m-%d-%H:%M:%S'),
'runtime': timedelta(days=2),
'outputdt': timedelta(hours=1),
'dt': timedelta(minutes=20),
}
'runtime': timedelta(days=2),
'outputdt': timedelta(hours=1),
'dt': timedelta(minutes=20),
}
return simulation_settings


def make_standard_plastictype_settings():
#Use tiny wind percentage because test data set is not large and wind speeds are quick!
plastictype_settings = {'wind_coefficient' : 0.0001, # Percentage of wind to apply to particles
'plastic_diameter' : 0.001, # Plastic particle diameter (m)
'plastic_density' : 1030., # Plastic particle density (kg/m^3)
}
# Use tiny wind percentage because test data set is not large and wind speeds are quick!
plastictype_settings = {'wind_coefficient': 0.0001, # Percentage of wind to apply to particles
'plastic_diameter': 0.001, # Plastic particle diameter (m)
'plastic_density': 1030., # Plastic particle density (kg/m^3)
}
return plastictype_settings


Expand All @@ -30,7 +30,7 @@ def make_standard_particleset(fieldset, settings):
pset = pp.constructors.create_particleset_from_map(fieldset, settings)

# Only keep particles in the test domain
keep_particles = (pset.lon >17) & (pset.lon <20) & (pset.lat < 36) & (pset.lat > 34)
keep_particles = (pset.lon > 17) & (pset.lon < 20) & (pset.lat < 36) & (pset.lat > 34)
pset.remove_booleanvector(~keep_particles)

return pset
Expand Down Expand Up @@ -59,7 +59,7 @@ def test_advection_only(use_3D):
kernels = [parcels.application_kernels.AdvectionRK4_3D, pp.kernels.checkThroughBathymetry, pp.kernels.checkErrorThroughSurface, pp.kernels.deleteParticle]
else:
kernels = [parcels.application_kernels.AdvectionRK4, pp.kernels.deleteParticle]

pset = make_standard_particleset(fieldset, settings)

start_lons = pset.lon.copy()
Expand Down Expand Up @@ -222,8 +222,8 @@ def test_mixing():
pp.kernels.checkErrorThroughSurface, pp.kernels.deleteParticle]

kernels_mixing = [parcels.application_kernels.AdvectionRK4_3D, pp.kernels.VerticalMixing,
pp.kernels.checkThroughBathymetry, pp.kernels.checkErrorThroughSurface,
pp.kernels.deleteParticle]
pp.kernels.checkThroughBathymetry, pp.kernels.checkErrorThroughSurface,
pp.kernels.deleteParticle]

pset = make_standard_particleset(fieldset, settings)
pset_mixing = make_standard_particleset(fieldset, settings)
Expand Down

0 comments on commit 7824ed4

Please sign in to comment.