added method to set coord_type

Does this look okay?
The logic has changed compared to the original code. Normally, coord_wrap should not be used for scalar coord_type either. Maybe you can try and keep the code more similar to before to keep the same logic?