Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

xarray add coordinate

>>> da = xr.DataArray(
...     np.random.rand(4),
...     coords=[np.array([358, 359, 0, 1])],
...     dims="lon",
... )
>>> da
<xarray.DataArray (lon: 4)>
array([0.5488135 , 0.71518937, 0.60276338, 0.54488318])
Coordinates:
  * lon      (lon) int64 358 359 0 1
  
>>> da.assign_coords(lon=(((da.lon + 180) % 360) - 180))
<xarray.DataArray (lon: 4)>
array([0.5488135 , 0.71518937, 0.60276338, 0.54488318])
Coordinates:
  * lon      (lon) int64 -2 -1 0 1
Comment

PREVIOUS NEXT
Code Example
Python :: get local timezone python 
Python :: python turtle square 
Python :: how to find runner up score in python 
Python :: django how to set a navbar active 
Python :: python sys is not defined 
Python :: draw spiral in matplotlib 
Python :: save images cv2 
Python :: read video with opencv 
Python :: set os environment variable python 
Python :: pip install chatterbot 
Python :: how to make turtle invisible python 
Python :: argparse mutually exclusive 
Python :: how to install nltk 
Python :: .astype datetime 
Python :: Change the user agent selenium 
Python :: python calc days between dates 
Python :: python -m pip install --upgrade 
Python :: selenium page down key python 
Python :: api xml response to json python 
Python :: python code to drop columns from dataframe 
Python :: fibonacci python 
Python :: remove x label matplotlib 
Python :: recursionerror maximum recursion depth 
Python :: how to create a car game using python 
Python :: pandas plot disable legend 
Python :: simplify fractions python 
Python :: virtualenv in mac 
Python :: update link python is python 3 
Python :: json not readable python 
Python :: mp4 to wav python 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =