xarray.Dataset (2024)

A multi-dimensional, in memory, array database.

A dataset resembles an in-memory representation of a NetCDF file,and consists of variables, coordinates and attributes whichtogether form a self describing dataset.

Dataset implements the mapping interface with keys given by variablenames and values given by DataArray objects for each variable name.

By default, pandas indexes are created for one dimensional variables withname equal to their dimension (i.e., Dimension coordinate) so thosevariables can be readily used as coordinates for label based indexing. When aCoordinates object is passed to coords, any existingindex(es) built from those coordinates will be added to the Dataset.

To load data from a file or file-like object, use the open_datasetfunction.

In this example dataset, we will represent measurements of the temperatureand pressure that were made under various conditions:

>>> np.random.seed(0)>>> temperature = 15 + 8 * np.random.randn(2, 3, 4)>>> precipitation = 10 * np.random.rand(2, 3, 4)>>> lon = [-99.83, -99.32]>>> lat = [42.25, 42.21]>>> instruments = ["manufac1", "manufac2", "manufac3"]>>> time = pd.date_range("2014-09-06", periods=4)>>> reference_time = pd.Timestamp("2014-09-05")

Here, we initialize the dataset with multiple dimensions. We use the string“loc” to represent the location dimension of the data, the string“instrument” to represent the instrument manufacturer dimension, and thestring “time” for the time dimension.

>>> ds = xr.Dataset(...  data_vars=dict(...  temperature=(["loc", "instrument", "time"], temperature),...  precipitation=(["loc", "instrument", "time"], precipitation),...  ),...  coords=dict(...  lon=("loc", lon),...  lat=("loc", lat),...  instrument=instruments,...  time=time,...  reference_time=reference_time,...  ),...  attrs=dict(description="Weather related data."),... )>>> ds<xarray.Dataset> Size: 552BDimensions: (loc: 2, instrument: 3, time: 4)Coordinates: lon (loc) float64 16B -99.83 -99.32 lat (loc) float64 16B 42.25 42.21 * instrument (instrument) <U8 96B 'manufac1' 'manufac2' 'manufac3' * time (time) datetime64[ns] 32B 2014-09-06 ... 2014-09-09 reference_time datetime64[ns] 8B 2014-09-05Dimensions without coordinates: locData variables: temperature (loc, instrument, time) float64 192B 29.11 18.2 ... 9.063 precipitation (loc, instrument, time) float64 192B 4.562 5.684 ... 1.613Attributes: description: Weather related data.

Find out where the coldest temperature was and what values theother variables had:

__init__([data_vars,coords,attrs])

all([dim,keep_attrs])

Reduce this Dataset's data by applying all along some dimension(s).

any([dim,keep_attrs])

Reduce this Dataset's data by applying any along some dimension(s).

apply(func[,keep_attrs,args])

Backward compatible implementation of map

argmax([dim])

Indices of the maxima of the member variables.

argmin([dim])

Indices of the minima of the member variables.

argsort([axis,kind,order])

Returns the indices that would sort this array.

as_numpy()

Coerces wrapped data and coordinates into numpy arrays, returning a Dataset.

assign([variables])

Assign new data variables to a Dataset, returning a new object with all the original variables in addition to the new ones.

assign_attrs(*args,**kwargs)

Assign new attrs to this object.

assign_coords([coords])

Assign new coordinates to this object.

astype(dtype,*[,order,casting,subok,...])

Copy of the xarray object, with data cast to a specified type.

bfill(dim[,limit])

Fill NaN values by propagating values backward

broadcast_equals(other)

Two Datasets are broadcast equal if they are equal after broadcasting all variables against each other.

broadcast_like(other[,exclude])

Broadcast this DataArray against another Dataset or DataArray.

chunk([chunks,name_prefix,token,lock,...])

Coerce all arrays in this dataset into dask arrays with the given chunks.

clip([min,max,keep_attrs])

Return an array whose values are limited to [min, max].

close()

Release any resources linked to this object.

coarsen([dim,boundary,side,coord_func])

Coarsen object for Datasets.

combine_first(other)

Combine two Datasets, default to data_vars of self.

compute(**kwargs)

Manually trigger loading and/or computation of this dataset's data from disk or a remote source into memory and return a new dataset.

conj()

Complex-conjugate all elements.

conjugate()

Return the complex conjugate, element-wise.

convert_calendar(calendar[,dim,align_on,...])

Convert the Dataset to another calendar.

copy([deep,data])

Returns a copy of this dataset.

count([dim,keep_attrs])

Reduce this Dataset's data by applying count along some dimension(s).

cumprod([dim,skipna,keep_attrs])

Reduce this Dataset's data by applying cumprod along some dimension(s).

c*msum([dim,skipna,keep_attrs])

Reduce this Dataset's data by applying c*msum along some dimension(s).

cumulative(dim[,min_periods])

Accumulating object for Datasets

cumulative_integrate(coord[,datetime_unit])

Integrate along the given coordinate using the trapezoidal rule.

curvefit(coords,func[,reduce_dims,...])

Curve fitting optimization for arbitrary functions.

diff(dim[,n,label])

Calculate the n-th order discrete difference along given axis.

differentiate(coord[,edge_order,datetime_unit])

Differentiate with the second order accurate central differences.

drop([labels,dim,errors])

Backward compatible method based on drop_vars and drop_sel

drop_dims(drop_dims,*[,errors])

Drop dimensions and associated variables from this dataset.

drop_duplicates(dim,*[,keep])

Returns a new Dataset with duplicate dimension values removed.

drop_encoding()

Return a new Dataset without encoding on the dataset or any of its variables/coords.

drop_indexes(coord_names,*[,errors])

Drop the indexes assigned to the given coordinates.

drop_isel([indexers])

Drop index positions from this Dataset.

drop_sel([labels,errors])

Drop index labels from this dataset.

drop_vars(names,*[,errors])

Drop variables from this dataset.

dropna(dim,*[,how,thresh,subset])

Returns a new dataset with dropped labels for missing values along the provided dimension.

dump_to_store(store,**kwargs)

Store dataset contents to a backends.*DataStore object.

equals(other)

Two Datasets are equal if they have matching variables and coordinates, all of which are equal.

eval(statement,*[,parser])

Calculate an expression supplied as a string in the context of the dataset.

expand_dims([dim,axis,...])

Return a new object with an additional axis (or axes) inserted at the corresponding position in the array shape.

ffill(dim[,limit])

Fill NaN values by propagating values forward

fillna(value)

Fill missing values in this object.

filter_by_attrs(**kwargs)

Returns a Dataset with variables that match specific conditions.

from_dataframe(dataframe[,sparse])

Convert a pandas.DataFrame into an xarray.Dataset

from_dict(d)

Convert a dictionary into an xarray.Dataset.

get(k[,d])

get_index(key)

Get an index for a dimension, with fall-back to a default RangeIndex

groupby(group[,squeeze,restore_coord_dims])

Returns a DatasetGroupBy object for performing grouped operations.

groupby_bins(group,bins[,right,labels,...])

Returns a DatasetGroupBy object for performing grouped operations.

head([indexers])

Returns a new dataset with the first n values of each array for the specified dimension(s).

identical(other)

Like equals, but also checks all dataset attributes and the attributes on all variables and coordinates.

idxmax([dim,skipna,fill_value,keep_attrs])

Return the coordinate label of the maximum value along a dimension.

idxmin([dim,skipna,fill_value,keep_attrs])

Return the coordinate label of the minimum value along a dimension.

info([buf])

Concise summary of a Dataset variables and attributes.

integrate(coord[,datetime_unit])

Integrate along the given coordinate using the trapezoidal rule.

interp([coords,method,assume_sorted,...])

Interpolate a Dataset onto new coordinates

interp_calendar(target[,dim])

Interpolates the Dataset to another calendar based on decimal year measure.

interp_like(other[,method,assume_sorted,...])

Interpolate this object onto the coordinates of another object, filling the out of range values with NaN.

interpolate_na([dim,method,limit,...])

Fill in NaNs by interpolating according to different methods.

isel([indexers,drop,missing_dims])

Returns a new dataset with each array indexed along the specified dimension(s).

isin(test_elements)

Tests each value in the array for whether it is in test elements.

isnull([keep_attrs])

Test each value in the array for whether it is a missing value.

items()

keys()

load(**kwargs)

Manually trigger loading and/or computation of this dataset's data from disk or a remote source into memory and return this dataset.

load_store(store[,decoder])

Create a new dataset from the contents of a backends.*DataStore object

map(func[,keep_attrs,args])

Apply a function to each data variable in this dataset

map_blocks(func[,args,kwargs,template])

Apply a function to each block of this Dataset.

max([dim,skipna,keep_attrs])

Reduce this Dataset's data by applying max along some dimension(s).

mean([dim,skipna,keep_attrs])

Reduce this Dataset's data by applying mean along some dimension(s).

median([dim,skipna,keep_attrs])

Reduce this Dataset's data by applying median along some dimension(s).

merge(other[,overwrite_vars,compat,join,...])

Merge the arrays of two datasets into a single dataset.

min([dim,skipna,keep_attrs])

Reduce this Dataset's data by applying min along some dimension(s).

notnull([keep_attrs])

Test each value in the array for whether it is not a missing value.

pad([pad_width,mode,stat_length,...])

Pad this dataset along one or more dimensions.

persist(**kwargs)

Trigger computation, keeping data as dask arrays

pipe(func,*args,**kwargs)

Apply func(self, *args, **kwargs)

polyfit(dim,deg[,skipna,rcond,w,full,cov])

Least squares polynomial fit.

prod([dim,skipna,min_count,keep_attrs])

Reduce this Dataset's data by applying prod along some dimension(s).

quantile(q[,dim,method,numeric_only,...])

Compute the qth quantile of the data along the specified dimension.

query([queries,parser,engine,missing_dims])

Return a new dataset with each array indexed along the specified dimension(s), where the indexers are given as strings containing Python expressions to be evaluated against the data variables in the dataset.

rank(dim,*[,pct,keep_attrs])

Ranks the data.

reduce(func[,dim,keep_attrs,keepdims,...])

Reduce this dataset by applying func along some dimension(s).

reindex([indexers,method,tolerance,copy,...])

Conform this object onto a new set of indexes, filling in missing values with fill_value.

reindex_like(other[,method,tolerance,...])

Conform this object onto the indexes of another object, for indexes which the objects share.

rename([name_dict])

Returns a new object with renamed variables, coordinates and dimensions.

rename_dims([dims_dict])

Returns a new object with renamed dimensions only.

rename_vars([name_dict])

Returns a new object with renamed variables including coordinates

reorder_levels([dim_order])

Rearrange index levels using input order.

resample([indexer,skipna,closed,label,...])

Returns a Resample object for performing resampling operations.

reset_coords([names,drop])

Given names of coordinates, reset them to become variables

reset_encoding()

reset_index(dims_or_levels,*[,drop])

Reset the specified index(es) or multi-index level(s).

roll([shifts,roll_coords])

Roll this dataset by an offset along one or more dimensions.

rolling([dim,min_periods,center])

Rolling window object for Datasets.

rolling_exp([window,window_type])

Exponentially-weighted moving window.

round(*args,**kwargs)

Round an array to the given number of decimals.

sel([indexers,method,tolerance,drop])

Returns a new dataset with each array indexed by tick labels along the specified dimension(s).

set_close(close)

Register the function that releases any resources linked to this object.

set_coords(names)

Given names of one or more variables, set them as coordinates

set_index([indexes,append])

Set Dataset (multi-)indexes using one or more existing coordinates or variables.

set_xindex(coord_names[,index_cls])

Set a new, Xarray-compatible index from one or more existing coordinate(s).

shift([shifts,fill_value])

Shift this dataset by an offset along one or more dimensions.

sortby(variables[,ascending])

Sort object by labels or values (along an axis).

squeeze([dim,drop,axis])

Return a new object with squeezed data.

stack([dim,create_index,index_cls])

Stack any number of existing dimensions into a single new dimension.

std([dim,skipna,ddof,keep_attrs])

Reduce this Dataset's data by applying std along some dimension(s).

sum([dim,skipna,min_count,keep_attrs])

Reduce this Dataset's data by applying sum along some dimension(s).

swap_dims([dims_dict])

Returns a new object with swapped dimensions.

tail([indexers])

Returns a new dataset with the last n values of each array for the specified dimension(s).

thin([indexers])

Returns a new dataset with each array indexed along every n-th value for the specified dimension(s)

to_array([dim,name])

Deprecated version of to_dataarray

to_dask_dataframe([dim_order,set_index])

Convert this dataset into a dask.dataframe.DataFrame.

to_dataarray([dim,name])

Convert this dataset into an xarray.DataArray

to_dataframe([dim_order])

Convert this dataset into a pandas.DataFrame.

to_dict([data,encoding])

Convert this dataset to a dictionary following xarray naming conventions.

to_netcdf([path,mode,format,group,...])

Write dataset contents to a netCDF file.

to_pandas()

Convert this dataset into a pandas object without changing the number of dimensions.

to_stacked_array(new_dim,sample_dims[,...])

Combine variables of differing dimensionality into a DataArray without broadcasting.

to_zarr([store,chunk_store,mode,...])

Write dataset contents to a zarr group.

transpose(*dim[,missing_dims])

Return a new Dataset object with all array dimensions transposed.

unify_chunks()

Unify chunk size along all chunked dimensions of this Dataset.

unstack([dim,fill_value,sparse])

Unstack existing dimensions corresponding to MultiIndexes into multiple new dimensions.

update(other)

Update this dataset's variables with those from another dataset.

values()

var([dim,skipna,ddof,keep_attrs])

Reduce this Dataset's data by applying var along some dimension(s).

weighted(weights)

Weighted Dataset operations.

where(cond[,other,drop])

Filter elements from this object according to a condition.

xarray.Dataset (2024)
Top Articles
Urban Dictionary: sperf
Homemade Salsa Verde
Citi Trends Watches
Swissport Timecard
Karl Torp Height
ALLEN 'CHAINSAW' KESSLER | LAS VEGAS, NV, United States
Hk Jockey Club Result
Wow Rock Wall Locked
6 Underground movie review & film summary (2019) | Roger Ebert
Equipment Hypixel Skyblock
Chevrolet Colorado - Infos, Preise, Alternativen
Ups Cc Center
Elgin Il Building Department
Northern Whooping Crane Festival highlights conservation and collaboration in Fort Smith, N.W.T. | CBC News
Great Clips Coupons → 20% Off | Sep 2024
My Scheduler Hca Cloud
Ge Tracker Awakener Orb
Krystal Murphy Below Deck Net Worth
Food Stamp System Down
Reforge Update – Which Reforges Are The Best? – Hypixel Skyblock - Sirknightj
Frontier Channel Lineup Dallas
Rancho Medanos Schedule
SpaceX Polaris Dawn spacewalk - latest: 'It's gorgeous' - billionaire Jared Isaacman's awed reaction as he steps out of capsule on historic spacewalk
Xsammybearxox
Nwi Police Blotter
Clay County Tax Collector Auto Middleburg Photos
-apostila-de-ingles-cn-epcar-eam-essa-eear-espcex-afa-efomm-en-e-ita-pr f3476c8ab0af975f02f2f651664c5f13 - Matemática
Hahs Sentral
Top Songs On Octane 2022
Huntress Neighborhood Watch
Loss Payee And Lienholder Addresses And Contact Information Updated Daily Free List Bank Of America
What Does FYP Mean on TikTok?
Ok Google Zillow
Taco Bell Fourth Of July Hours
My Meet Scores Online Gymnastics
Logisticare Transportation Provider Login
REGULAMENTUL CAMPANIEI "Extra Smart Week" valabil in perioada 12-18 septembrie 2024
Leonards Truck Caps
Strange World Showtimes Near Twin County Cinema
Diminutiv: Definition, Bedeutung und Beispiele
Wgu Admissions Login
Zip Tv Guide
Tcu Jaggaer
Natick Mall Directory Map
600 Aviator Court Vandalia Oh 45377
Clea-Lacy Juhn: Schwerer Schicksalsschlag kurz nach Zwillingsgeburt
German American Bank Owenton Ky
Gasmonkeygarage.com Cars For Sale
The Crew 2 Cheats für PS4, Xbox One und PC ▷➡️
Saulr80683
Siôn Parry: The Welshman in the red of Canada
The Swarthmorean, 1932-05 | TriCollege Libraries Digital Collections
Latest Posts
Article information

Author: Allyn Kozey

Last Updated:

Views: 6146

Rating: 4.2 / 5 (43 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Allyn Kozey

Birthday: 1993-12-21

Address: Suite 454 40343 Larson Union, Port Melia, TX 16164

Phone: +2456904400762

Job: Investor Administrator

Hobby: Sketching, Puzzles, Pet, Mountaineering, Skydiving, Dowsing, Sports

Introduction: My name is Allyn Kozey, I am a outstanding, colorful, adventurous, encouraging, zealous, tender, helpful person who loves writing and wants to share my knowledge and understanding with you.