Can you explain what you are trying to do? Why using the np.meshgrid
?
Where are you obtaining the error? When calculating [phi, theta]
or when obtainting the divergence
?
Are you trying to change the resolution from 0.25 to 0.5 and obtain the divergence (d
variable) at a specific time?
I think should be better to access the data at the time=time with the function .isel
as:
divergence = ds.isel(time=time).d.data
But still I'm not sure what you are doing, probably there is some `xarray` function that will do what you're expecting.