'Xarray DataArray Coordinates (step)

I have an xarray DataArray of 2 steps which correspond to forecast months (in this case step 1 = 30 days for 2022-04-01 and 31 days (61 days - 30 days) for 2022-05-01. I don't know how to extract data specified by step 1 or step 2 or both steps. I've read the documentation and the mention is for extracting data by using the 'dim' keyword argument which doesn't seem to work for "step". Thank you for your help. Here is my xarray DataArray called 'emda':

I can find the minimum by dim='latitude' or dim='longitude'

emda.min(dim='longitude') 

but I need to find the minimum for example by step 1 (April 2022) and step 2 (May 2022) and both April and May 2022.

emda
Out[40]: 
<xarray.DataArray 'si10' (step: 2, latitude: 36, longitude: 68)>
array([[[1.5103707, 1.6204782, 1.6697946, ..., 4.290156 , 5.054072 ,
         3.5775094],
        [1.4664254, 1.6675973, 1.8153024, ..., 4.2549996, 6.894404 ,
         4.7303414],
        [1.1026559, 1.337275 , 1.3763375, ..., 4.9539742, 5.8294625,
         4.608271 ],
        ...,
        [6.926142 , 6.8504586, 6.75207  , ..., 6.7232614, 6.695185 ,
         6.6978707],
        [7.182734 , 7.061152 , 7.0169625, ..., 6.8399606, 6.788203 ,
         6.923945 ],
        [7.4061227, 7.325312 , 7.1961617, ..., 6.983271 , 7.1138864,
         7.087275 ]],

       [[1.7636629, 1.899161 , 1.9396883, ..., 4.663565 , 4.616446 ,
         3.0563874],
        [1.586661 , 1.8371493, 2.0095124, ..., 4.38378  , 6.4089265,
         4.204825 ],
        [1.130118 , 1.4511629, 1.524161 , ..., 4.8845124, 5.538565 ,
         4.098868 ],
        ...,
        [6.689688 , 6.6516023, 6.581534 , ..., 5.8447175, 5.8430085,
         5.899161 ],
        [6.9052644, 6.826407 , 6.809073 , ..., 5.8600984, 5.790274 ,
         5.9128327],
        [7.154776 , 7.069327 , 6.9662995, ..., 5.876456 , 5.9699616,
         5.9121003]]], dtype=float32)
Coordinates:
    number      int32 0
    time        datetime64[ns] 2022-03-01
  * step        (step) timedelta64[ns] 31 days 61 days
    surface     float64 0.0
  * latitude    (latitude) float64 58.0 57.0 56.0 55.0 ... 26.0 25.0 24.0 23.0
  * longitude   (longitude) float64 -130.0 -129.0 -128.0 ... -65.0 -64.0 -63.0
    valid_time  (step) datetime64[ns] 2022-04-01 2022-05-01
Attributes:
    GRIB_paramId:                             207
    GRIB_dataType:                            em
    GRIB_numberOfPoints:                      2448
    GRIB_typeOfLevel:                         surface
    GRIB_stepUnits:                           1
    GRIB_stepType:                            instant
    GRIB_gridType:                            regular_ll
    GRIB_NV:                                  0
    GRIB_Nx:                                  68
    GRIB_Ny:                                  36
    GRIB_cfName:                              unknown
    GRIB_cfVarName:                           si10
    GRIB_gridDefinitionDescription:           Latitude/Longitude Grid
    GRIB_iDirectionIncrementInDegrees:        1.0
    GRIB_iScansNegatively:                    0
    GRIB_jDirectionIncrementInDegrees:        1.0
    GRIB_jPointsAreConsecutive:               0
    GRIB_jScansPositively:                    0
    GRIB_latitudeOfFirstGridPointInDegrees:   58.0
    GRIB_latitudeOfLastGridPointInDegrees:    23.0
    GRIB_longitudeOfFirstGridPointInDegrees:  -130.0
    GRIB_longitudeOfLastGridPointInDegrees:   -63.0
    GRIB_missingValue:                        9999
    GRIB_name:                                10 metre wind speed
    GRIB_shortName:                           10si
    GRIB_totalNumber:                         0
    GRIB_units:                               m s**-1
    long_name:                                10 metre wind speed
    units:                                    m s**-1
    standard_name:                            unknown


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source