I have a satellite file which contains longitude within the range of (0,360) while I want to convert it to (-180,180).In order to do that I found a way here that is using xarray.where HERE but this xr.where() only works well for " xarray dataset " and not "numpy.array". (After plotting there are some gaps in satellite orbit trajectories). So I would appreciate your favor if you can advise me how to convert the numpy array into xarray.dataset?
#Reading the basic file type(orbit['lon']) >> numpyarray type(orbit['lat']) >> numpyarray etc.
Here first part changes longitudes (180, 360) to negative and sorting orders the longitude in ascending order.
ds = ds.assign_coords(lon=(((ds.lon + 180) % 360) - 180)).sortby("lon")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.