[docs]defseries(values,name,start="2000-01-01"):"""Create a DataArray with time, lon and lat dimensions."""coords=collections.OrderedDict()fordim,ninzip(("time","lon","lat"),values.shape):ifdim=="time":coords[dim]=pd.date_range(start,periods=n,freq="D")else:coords[dim]=xr.IndexVariable(dim,np.arange(n))ifname=="tas":attrs={"standard_name":"air_temperature","cell_methods":"time: mean within days","units":"K","kind":"+",}elifname=="pr":attrs={"standard_name":"precipitation_flux","cell_methods":"time: sum over day","units":"kg m-2 s-1","kind":"*",}else:raiseValueError(f"Name `{name}` not supported.")returnxr.DataArray(values,coords=coords,dims=list(coords.keys()),name=name,attrs=attrs,)