diff --git a/yt/data_objects/profiles.py b/yt/data_objects/profiles.py index 0b1b790785..15a266e96d 100644 --- a/yt/data_objects/profiles.py +++ b/yt/data_objects/profiles.py @@ -1314,7 +1314,7 @@ def create_profile( for f in bin_fields + fields ] if wf is not None: - is_local.append(wf.sampling_type == "local") + is_local.append(data_source.ds.field_info[wf].sampling_type == "local") is_local_or_pfield = [ pf or lf for (pf, lf) in zip(is_pfield, is_local, strict=True) ] diff --git a/yt/data_objects/tests/test_profiles.py b/yt/data_objects/tests/test_profiles.py index b68f2fb55e..6a8245c34d 100644 --- a/yt/data_objects/tests/test_profiles.py +++ b/yt/data_objects/tests/test_profiles.py @@ -534,6 +534,12 @@ def test_profile_sph_data(): [("gas", "kinetic_energy_density")], weight_field=None, ) + yt.create_profile( + ds.all_data(), + [("gas", "density"), ("gas", "temperature")], + [("gas", "kinetic_energy_density")], + weight_field=("gas", "density"), + ) def test_profile_override_limits():