Note that there are two set of convention for spherical coordinates, “physics convention” or “mathematical convention”:

physics conventionmathematics convention
Spherical coordinates 1.svg3D_Spherical_2.svg
polar angle and azimuthal angle The meanings of and is swapped