WRF data and Xarray

WRF data, from the Weather Research and Forecasting Model, is supported by and commonly used by NCAR scientists. Unfortunately, WRF datafiles are not formatted by the now-popular CF conventions that make it easy to load them into an Xarray dataset: WRF time is in bytes and lat-lon coordinates are stored in a separate file from the data itself.

We encourage scientists to use Xarray because it provides data structures for in-memory analytics that utilize and preserve labels.

While it may take a few extra steps, WRF data is still compatible with Xarray. We acknowled that these steps are not intuitive to scientists that have been using WRF for years but are new to Xarray or Python in general.

This notebook demonstrates using a WRF datafile with the Xarray module and the manipulations necessary to get the dataset into CF conventions understood by Xarray.

[1]:
import xarray as xr
import matplotlib.pyplot as plt
import pandas as pd
from ngallery_utils import DATASETS

First, take a look at the WRF dataset:

[2]:
path = DATASETS.fetch("T2_RR_F_2014_08.nc")
ds_wrf = xr.open_dataset(path)
ds_wrf
Downloading file 'T2_RR_F_2014_08.nc' from 'ftp://ftp.cgd.ucar.edu/archive/aletheia-data/tutorial-data/T2_RR_F_2014_08.nc' to '/home/jovyan/aletheia-data/tutorial-data'.
[2]:
<xarray.Dataset>
Dimensions:      (Time: 720, south_north: 159, west_east: 159)
Dimensions without coordinates: Time, south_north, west_east
Data variables:
    PREC_ACC_NC  (Time, south_north, west_east) float32 ...
    T2           (Time, south_north, west_east) float32 ...
    Times        (Time) |S19 b'2014-08-01_00:00:00' ... b'2014-08-30_23:00:00'
    U10          (Time, south_north, west_east) float32 ...
    V10          (Time, south_north, west_east) float32 ...
Attributes:
    TITLE:                            OUTPUT FROM WRF V3.9 MODEL
    START_DATE:                      2014-08-01_00:00:00
    SIMULATION_START_DATE:           2014-08-01_00:00:00
    WEST-EAST_GRID_DIMENSION:        160
    SOUTH-NORTH_GRID_DIMENSION:      160
    BOTTOM-TOP_GRID_DIMENSION:       51
    DX:                              1000.0
    DY:                              1000.0
    SKEBS_ON:                        0
    SPEC_BDY_FINAL_MU:               1
    USE_Q_DIABATIC:                  0
    GRIDTYPE:                        C
    DIFF_OPT:                        1
    KM_OPT:                          4
    DAMP_OPT:                        3
    DAMPCOEF:                        0.2
    KHDIF:                           0.0
    KVDIF:                           0.0
    MP_PHYSICS:                      28
    RA_LW_PHYSICS:                   4
    RA_SW_PHYSICS:                   4
    SF_SFCLAY_PHYSICS:               1
    SF_SURFACE_PHYSICS:              4
    BL_PBL_PHYSICS:                  1
    CU_PHYSICS:                      0
    SF_LAKE_PHYSICS:                 0
    SURFACE_INPUT_SOURCE:            1
    SST_UPDATE:                      1
    GRID_FDDA:                       0
    GFDDA_INTERVAL_M:                0
    GFDDA_END_H:                     0
    GRID_SFDDA:                      0
    SGFDDA_INTERVAL_M:               0
    SGFDDA_END_H:                    0
    HYPSOMETRIC_OPT:                 2
    USE_THETA_M:                     0
    GWD_OPT:                         0
    SF_URBAN_PHYSICS:                0
    SF_OCEAN_PHYSICS:                0
    SHCU_PHYSICS:                    0
    MFSHCONV:                        0
    FEEDBACK:                        0
    SMOOTH_OPTION:                   2
    SWRAD_SCAT:                      1.0
    W_DAMPING:                       1
    DT:                              5.0
    RADT:                            10.0
    BLDT:                            0.0
    CUDT:                            0.0
    AER_OPT:                         3
    SWINT_OPT:                       0
    AER_TYPE:                        1
    AER_AOD550_OPT:                  1
    AER_ANGEXP_OPT:                  1
    AER_SSA_OPT:                     1
    AER_ASY_OPT:                     1
    AER_AOD550_VAL:                  0.12
    AER_ANGEXP_VAL:                  1.3
    AER_SSA_VAL:                     0.85
    AER_ASY_VAL:                     0.9
    MOIST_ADV_OPT:                   1
    SCALAR_ADV_OPT:                  1
    TKE_ADV_OPT:                     1
    DIFF_6TH_OPT:                    0
    DIFF_6TH_FACTOR:                 0.12
    OBS_NUDGE_OPT:                   0
    BUCKET_MM:                       100.0
    BUCKET_J:                        1000000000.0
    PREC_ACC_DT:                     60.0
    ISFTCFLX:                        0
    ISHALLOW:                        0
    ISFFLX:                          1
    ICLOUD:                          1
    ICLOUD_CU:                       0
    TRACER_PBLMIX:                   1
    SCALAR_PBLMIX:                   1
    YSU_TOPDOWN_PBLMIX:              0
    GRAV_SETTLING:                   0
    OPT_SFC:                         1
    DVEG:                            4
    OPT_CRS:                         1
    OPT_BTR:                         2
    OPT_RUN:                         1
    OPT_FRZ:                         1
    OPT_INF:                         1
    OPT_RAD:                         3
    OPT_ALB:                         2
    OPT_SNF:                         4
    OPT_TBOT:                        1
    OPT_STC:                         1
    OPT_GLA:                         1
    OPT_RSF:                         1
    DFI_OPT:                         0
    SIMULATION_INITIALIZATION_TYPE:  REAL-DATA CASE
    WEST-EAST_PATCH_START_UNSTAG:    1
    WEST-EAST_PATCH_END_UNSTAG:      159
    WEST-EAST_PATCH_START_STAG:      1
    WEST-EAST_PATCH_END_STAG:        160
    SOUTH-NORTH_PATCH_START_UNSTAG:  1
    SOUTH-NORTH_PATCH_END_UNSTAG:    159
    SOUTH-NORTH_PATCH_START_STAG:    1
    SOUTH-NORTH_PATCH_END_STAG:      160
    BOTTOM-TOP_PATCH_START_UNSTAG:   1
    BOTTOM-TOP_PATCH_END_UNSTAG:     50
    BOTTOM-TOP_PATCH_START_STAG:     1
    BOTTOM-TOP_PATCH_END_STAG:       51
    GRID_ID:                         2
    PARENT_ID:                       1
    I_PARENT_START:                  85
    J_PARENT_START:                  89
    PARENT_GRID_RATIO:               3
    CEN_LAT:                         60.36686
    CEN_LON:                         7.049286
    TRUELAT1:                        30.0
    TRUELAT2:                        50.0
    MOAD_CEN_LAT:                    60.0
    STAND_LON:                       5.59998
    POLE_LAT:                        90.0
    POLE_LON:                        0.0
    GMT:                             0.0
    JULYR:                           2014
    JULDAY:                          214
    MAP_PROJ:                        1
    MAP_PROJ_CHAR:                   Lambert Conformal
    MMINLU:                          USGS
    NUM_LAND_CAT:                    28
    ISWATER:                         16
    ISLAKE:                          28
    ISICE:                           24
    ISURBAN:                         1
    ISOILWATER:                      14
    HYBRID_OPT:                      -1
    ETAC:                            0.0
    history:                         Tue Feb  5 11:36:06 2019: ncrcat all_T2_...
    NCO:                             netCDF Operators version 4.7.4 (http://n...
    nco_openmp_thread_number:        1
    history_of_appended_files:       Tue Feb  5 11:36:06 2019: Appended file ...

Problem #1: Time in bytes.

Currently our time information is stored in the ‘Times’ variable in string byte formatting. We need to create a time coordinate in datetime64 formatting.

Let’s take a look at our time variable so far:

[3]:
da_time = ds_wrf['Times']
da_time
[3]:
<xarray.DataArray 'Times' (Time: 720)>
array([b'2014-08-01_00:00:00', b'2014-08-01_01:00:00', b'2014-08-01_02:00:00',
       ..., b'2014-08-30_21:00:00', b'2014-08-30_22:00:00',
       b'2014-08-30_23:00:00'], dtype='|S19')
Dimensions without coordinates: Time

If the time coordinate is not in datetime64 formatting you cannot use some of the time-aware functionality in Xarray (see blog post here).

For example, the xarray.DataArray.sel functionality will fail.

prc_aug01_aug08 = ds_wrf['PREC_ACC_NC'].sel(Times=slice('2014-08-01', '2014-08-08'))

returns the error:

ValueError: dimensions or multi-index levels ['Times'] do not exist

This isn’t that surprising. .sel works along a dimension, and our variable Times is just that, a variable, with dimension Time. If we use .sel along the Time dimension we see:

prc_aug01_aug08 = ds_wrf['PREC_ACC_NC'].sel(Time=slice('2014-08-01', '2015-08-08'))

returns the error:

TypeError: 'str' object cannot be interpreted as an integer

This is because our Time dimension is an index list.

[4]:
ds_wrf['Time']
[4]:
<xarray.DataArray 'Time' (Time: 720)>
array([  0,   1,   2, ..., 717, 718, 719])
Dimensions without coordinates: Time

So let’s convert our Times variable to datetime64 using pandas.to_datetime:

time_datetime = pd.to_datetime(da_time)

returns the error:

TypeError: <class 'bytes'> is not convertible to datetime

Available arguments for to_datetime are: - integer - float - string - datetime - list - tuple - 1-d array - Series

So let’s convert to a string!

[5]:
time_strs = [str(i.values)[1:] for i in da_time]
time_strs
[5]:
["'2014-08-01_00:00:00'",
 "'2014-08-01_01:00:00'",
 "'2014-08-01_02:00:00'",
 "'2014-08-01_03:00:00'",
 "'2014-08-01_04:00:00'",
 "'2014-08-01_05:00:00'",
 "'2014-08-01_06:00:00'",
 "'2014-08-01_07:00:00'",
 "'2014-08-01_08:00:00'",
 "'2014-08-01_09:00:00'",
 "'2014-08-01_10:00:00'",
 "'2014-08-01_11:00:00'",
 "'2014-08-01_12:00:00'",
 "'2014-08-01_13:00:00'",
 "'2014-08-01_14:00:00'",
 "'2014-08-01_15:00:00'",
 "'2014-08-01_16:00:00'",
 "'2014-08-01_17:00:00'",
 "'2014-08-01_18:00:00'",
 "'2014-08-01_19:00:00'",
 "'2014-08-01_20:00:00'",
 "'2014-08-01_21:00:00'",
 "'2014-08-01_22:00:00'",
 "'2014-08-01_23:00:00'",
 "'2014-08-02_00:00:00'",
 "'2014-08-02_01:00:00'",
 "'2014-08-02_02:00:00'",
 "'2014-08-02_03:00:00'",
 "'2014-08-02_04:00:00'",
 "'2014-08-02_05:00:00'",
 "'2014-08-02_06:00:00'",
 "'2014-08-02_07:00:00'",
 "'2014-08-02_08:00:00'",
 "'2014-08-02_09:00:00'",
 "'2014-08-02_10:00:00'",
 "'2014-08-02_11:00:00'",
 "'2014-08-02_12:00:00'",
 "'2014-08-02_13:00:00'",
 "'2014-08-02_14:00:00'",
 "'2014-08-02_15:00:00'",
 "'2014-08-02_16:00:00'",
 "'2014-08-02_17:00:00'",
 "'2014-08-02_18:00:00'",
 "'2014-08-02_19:00:00'",
 "'2014-08-02_20:00:00'",
 "'2014-08-02_21:00:00'",
 "'2014-08-02_22:00:00'",
 "'2014-08-02_23:00:00'",
 "'2014-08-03_00:00:00'",
 "'2014-08-03_01:00:00'",
 "'2014-08-03_02:00:00'",
 "'2014-08-03_03:00:00'",
 "'2014-08-03_04:00:00'",
 "'2014-08-03_05:00:00'",
 "'2014-08-03_06:00:00'",
 "'2014-08-03_07:00:00'",
 "'2014-08-03_08:00:00'",
 "'2014-08-03_09:00:00'",
 "'2014-08-03_10:00:00'",
 "'2014-08-03_11:00:00'",
 "'2014-08-03_12:00:00'",
 "'2014-08-03_13:00:00'",
 "'2014-08-03_14:00:00'",
 "'2014-08-03_15:00:00'",
 "'2014-08-03_16:00:00'",
 "'2014-08-03_17:00:00'",
 "'2014-08-03_18:00:00'",
 "'2014-08-03_19:00:00'",
 "'2014-08-03_20:00:00'",
 "'2014-08-03_21:00:00'",
 "'2014-08-03_22:00:00'",
 "'2014-08-03_23:00:00'",
 "'2014-08-04_00:00:00'",
 "'2014-08-04_01:00:00'",
 "'2014-08-04_02:00:00'",
 "'2014-08-04_03:00:00'",
 "'2014-08-04_04:00:00'",
 "'2014-08-04_05:00:00'",
 "'2014-08-04_06:00:00'",
 "'2014-08-04_07:00:00'",
 "'2014-08-04_08:00:00'",
 "'2014-08-04_09:00:00'",
 "'2014-08-04_10:00:00'",
 "'2014-08-04_11:00:00'",
 "'2014-08-04_12:00:00'",
 "'2014-08-04_13:00:00'",
 "'2014-08-04_14:00:00'",
 "'2014-08-04_15:00:00'",
 "'2014-08-04_16:00:00'",
 "'2014-08-04_17:00:00'",
 "'2014-08-04_18:00:00'",
 "'2014-08-04_19:00:00'",
 "'2014-08-04_20:00:00'",
 "'2014-08-04_21:00:00'",
 "'2014-08-04_22:00:00'",
 "'2014-08-04_23:00:00'",
 "'2014-08-05_00:00:00'",
 "'2014-08-05_01:00:00'",
 "'2014-08-05_02:00:00'",
 "'2014-08-05_03:00:00'",
 "'2014-08-05_04:00:00'",
 "'2014-08-05_05:00:00'",
 "'2014-08-05_06:00:00'",
 "'2014-08-05_07:00:00'",
 "'2014-08-05_08:00:00'",
 "'2014-08-05_09:00:00'",
 "'2014-08-05_10:00:00'",
 "'2014-08-05_11:00:00'",
 "'2014-08-05_12:00:00'",
 "'2014-08-05_13:00:00'",
 "'2014-08-05_14:00:00'",
 "'2014-08-05_15:00:00'",
 "'2014-08-05_16:00:00'",
 "'2014-08-05_17:00:00'",
 "'2014-08-05_18:00:00'",
 "'2014-08-05_19:00:00'",
 "'2014-08-05_20:00:00'",
 "'2014-08-05_21:00:00'",
 "'2014-08-05_22:00:00'",
 "'2014-08-05_23:00:00'",
 "'2014-08-06_00:00:00'",
 "'2014-08-06_01:00:00'",
 "'2014-08-06_02:00:00'",
 "'2014-08-06_03:00:00'",
 "'2014-08-06_04:00:00'",
 "'2014-08-06_05:00:00'",
 "'2014-08-06_06:00:00'",
 "'2014-08-06_07:00:00'",
 "'2014-08-06_08:00:00'",
 "'2014-08-06_09:00:00'",
 "'2014-08-06_10:00:00'",
 "'2014-08-06_11:00:00'",
 "'2014-08-06_12:00:00'",
 "'2014-08-06_13:00:00'",
 "'2014-08-06_14:00:00'",
 "'2014-08-06_15:00:00'",
 "'2014-08-06_16:00:00'",
 "'2014-08-06_17:00:00'",
 "'2014-08-06_18:00:00'",
 "'2014-08-06_19:00:00'",
 "'2014-08-06_20:00:00'",
 "'2014-08-06_21:00:00'",
 "'2014-08-06_22:00:00'",
 "'2014-08-06_23:00:00'",
 "'2014-08-07_00:00:00'",
 "'2014-08-07_01:00:00'",
 "'2014-08-07_02:00:00'",
 "'2014-08-07_03:00:00'",
 "'2014-08-07_04:00:00'",
 "'2014-08-07_05:00:00'",
 "'2014-08-07_06:00:00'",
 "'2014-08-07_07:00:00'",
 "'2014-08-07_08:00:00'",
 "'2014-08-07_09:00:00'",
 "'2014-08-07_10:00:00'",
 "'2014-08-07_11:00:00'",
 "'2014-08-07_12:00:00'",
 "'2014-08-07_13:00:00'",
 "'2014-08-07_14:00:00'",
 "'2014-08-07_15:00:00'",
 "'2014-08-07_16:00:00'",
 "'2014-08-07_17:00:00'",
 "'2014-08-07_18:00:00'",
 "'2014-08-07_19:00:00'",
 "'2014-08-07_20:00:00'",
 "'2014-08-07_21:00:00'",
 "'2014-08-07_22:00:00'",
 "'2014-08-07_23:00:00'",
 "'2014-08-08_00:00:00'",
 "'2014-08-08_01:00:00'",
 "'2014-08-08_02:00:00'",
 "'2014-08-08_03:00:00'",
 "'2014-08-08_04:00:00'",
 "'2014-08-08_05:00:00'",
 "'2014-08-08_06:00:00'",
 "'2014-08-08_07:00:00'",
 "'2014-08-08_08:00:00'",
 "'2014-08-08_09:00:00'",
 "'2014-08-08_10:00:00'",
 "'2014-08-08_11:00:00'",
 "'2014-08-08_12:00:00'",
 "'2014-08-08_13:00:00'",
 "'2014-08-08_14:00:00'",
 "'2014-08-08_15:00:00'",
 "'2014-08-08_16:00:00'",
 "'2014-08-08_17:00:00'",
 "'2014-08-08_18:00:00'",
 "'2014-08-08_19:00:00'",
 "'2014-08-08_20:00:00'",
 "'2014-08-08_21:00:00'",
 "'2014-08-08_22:00:00'",
 "'2014-08-08_23:00:00'",
 "'2014-08-09_00:00:00'",
 "'2014-08-09_01:00:00'",
 "'2014-08-09_02:00:00'",
 "'2014-08-09_03:00:00'",
 "'2014-08-09_04:00:00'",
 "'2014-08-09_05:00:00'",
 "'2014-08-09_06:00:00'",
 "'2014-08-09_07:00:00'",
 "'2014-08-09_08:00:00'",
 "'2014-08-09_09:00:00'",
 "'2014-08-09_10:00:00'",
 "'2014-08-09_11:00:00'",
 "'2014-08-09_12:00:00'",
 "'2014-08-09_13:00:00'",
 "'2014-08-09_14:00:00'",
 "'2014-08-09_15:00:00'",
 "'2014-08-09_16:00:00'",
 "'2014-08-09_17:00:00'",
 "'2014-08-09_18:00:00'",
 "'2014-08-09_19:00:00'",
 "'2014-08-09_20:00:00'",
 "'2014-08-09_21:00:00'",
 "'2014-08-09_22:00:00'",
 "'2014-08-09_23:00:00'",
 "'2014-08-10_00:00:00'",
 "'2014-08-10_01:00:00'",
 "'2014-08-10_02:00:00'",
 "'2014-08-10_03:00:00'",
 "'2014-08-10_04:00:00'",
 "'2014-08-10_05:00:00'",
 "'2014-08-10_06:00:00'",
 "'2014-08-10_07:00:00'",
 "'2014-08-10_08:00:00'",
 "'2014-08-10_09:00:00'",
 "'2014-08-10_10:00:00'",
 "'2014-08-10_11:00:00'",
 "'2014-08-10_12:00:00'",
 "'2014-08-10_13:00:00'",
 "'2014-08-10_14:00:00'",
 "'2014-08-10_15:00:00'",
 "'2014-08-10_16:00:00'",
 "'2014-08-10_17:00:00'",
 "'2014-08-10_18:00:00'",
 "'2014-08-10_19:00:00'",
 "'2014-08-10_20:00:00'",
 "'2014-08-10_21:00:00'",
 "'2014-08-10_22:00:00'",
 "'2014-08-10_23:00:00'",
 "'2014-08-11_00:00:00'",
 "'2014-08-11_01:00:00'",
 "'2014-08-11_02:00:00'",
 "'2014-08-11_03:00:00'",
 "'2014-08-11_04:00:00'",
 "'2014-08-11_05:00:00'",
 "'2014-08-11_06:00:00'",
 "'2014-08-11_07:00:00'",
 "'2014-08-11_08:00:00'",
 "'2014-08-11_09:00:00'",
 "'2014-08-11_10:00:00'",
 "'2014-08-11_11:00:00'",
 "'2014-08-11_12:00:00'",
 "'2014-08-11_13:00:00'",
 "'2014-08-11_14:00:00'",
 "'2014-08-11_15:00:00'",
 "'2014-08-11_16:00:00'",
 "'2014-08-11_17:00:00'",
 "'2014-08-11_18:00:00'",
 "'2014-08-11_19:00:00'",
 "'2014-08-11_20:00:00'",
 "'2014-08-11_21:00:00'",
 "'2014-08-11_22:00:00'",
 "'2014-08-11_23:00:00'",
 "'2014-08-12_00:00:00'",
 "'2014-08-12_01:00:00'",
 "'2014-08-12_02:00:00'",
 "'2014-08-12_03:00:00'",
 "'2014-08-12_04:00:00'",
 "'2014-08-12_05:00:00'",
 "'2014-08-12_06:00:00'",
 "'2014-08-12_07:00:00'",
 "'2014-08-12_08:00:00'",
 "'2014-08-12_09:00:00'",
 "'2014-08-12_10:00:00'",
 "'2014-08-12_11:00:00'",
 "'2014-08-12_12:00:00'",
 "'2014-08-12_13:00:00'",
 "'2014-08-12_14:00:00'",
 "'2014-08-12_15:00:00'",
 "'2014-08-12_16:00:00'",
 "'2014-08-12_17:00:00'",
 "'2014-08-12_18:00:00'",
 "'2014-08-12_19:00:00'",
 "'2014-08-12_20:00:00'",
 "'2014-08-12_21:00:00'",
 "'2014-08-12_22:00:00'",
 "'2014-08-12_23:00:00'",
 "'2014-08-13_00:00:00'",
 "'2014-08-13_01:00:00'",
 "'2014-08-13_02:00:00'",
 "'2014-08-13_03:00:00'",
 "'2014-08-13_04:00:00'",
 "'2014-08-13_05:00:00'",
 "'2014-08-13_06:00:00'",
 "'2014-08-13_07:00:00'",
 "'2014-08-13_08:00:00'",
 "'2014-08-13_09:00:00'",
 "'2014-08-13_10:00:00'",
 "'2014-08-13_11:00:00'",
 "'2014-08-13_12:00:00'",
 "'2014-08-13_13:00:00'",
 "'2014-08-13_14:00:00'",
 "'2014-08-13_15:00:00'",
 "'2014-08-13_16:00:00'",
 "'2014-08-13_17:00:00'",
 "'2014-08-13_18:00:00'",
 "'2014-08-13_19:00:00'",
 "'2014-08-13_20:00:00'",
 "'2014-08-13_21:00:00'",
 "'2014-08-13_22:00:00'",
 "'2014-08-13_23:00:00'",
 "'2014-08-14_00:00:00'",
 "'2014-08-14_01:00:00'",
 "'2014-08-14_02:00:00'",
 "'2014-08-14_03:00:00'",
 "'2014-08-14_04:00:00'",
 "'2014-08-14_05:00:00'",
 "'2014-08-14_06:00:00'",
 "'2014-08-14_07:00:00'",
 "'2014-08-14_08:00:00'",
 "'2014-08-14_09:00:00'",
 "'2014-08-14_10:00:00'",
 "'2014-08-14_11:00:00'",
 "'2014-08-14_12:00:00'",
 "'2014-08-14_13:00:00'",
 "'2014-08-14_14:00:00'",
 "'2014-08-14_15:00:00'",
 "'2014-08-14_16:00:00'",
 "'2014-08-14_17:00:00'",
 "'2014-08-14_18:00:00'",
 "'2014-08-14_19:00:00'",
 "'2014-08-14_20:00:00'",
 "'2014-08-14_21:00:00'",
 "'2014-08-14_22:00:00'",
 "'2014-08-14_23:00:00'",
 "'2014-08-15_00:00:00'",
 "'2014-08-15_01:00:00'",
 "'2014-08-15_02:00:00'",
 "'2014-08-15_03:00:00'",
 "'2014-08-15_04:00:00'",
 "'2014-08-15_05:00:00'",
 "'2014-08-15_06:00:00'",
 "'2014-08-15_07:00:00'",
 "'2014-08-15_08:00:00'",
 "'2014-08-15_09:00:00'",
 "'2014-08-15_10:00:00'",
 "'2014-08-15_11:00:00'",
 "'2014-08-15_12:00:00'",
 "'2014-08-15_13:00:00'",
 "'2014-08-15_14:00:00'",
 "'2014-08-15_15:00:00'",
 "'2014-08-15_16:00:00'",
 "'2014-08-15_17:00:00'",
 "'2014-08-15_18:00:00'",
 "'2014-08-15_19:00:00'",
 "'2014-08-15_20:00:00'",
 "'2014-08-15_21:00:00'",
 "'2014-08-15_22:00:00'",
 "'2014-08-15_23:00:00'",
 "'2014-08-16_00:00:00'",
 "'2014-08-16_01:00:00'",
 "'2014-08-16_02:00:00'",
 "'2014-08-16_03:00:00'",
 "'2014-08-16_04:00:00'",
 "'2014-08-16_05:00:00'",
 "'2014-08-16_06:00:00'",
 "'2014-08-16_07:00:00'",
 "'2014-08-16_08:00:00'",
 "'2014-08-16_09:00:00'",
 "'2014-08-16_10:00:00'",
 "'2014-08-16_11:00:00'",
 "'2014-08-16_12:00:00'",
 "'2014-08-16_13:00:00'",
 "'2014-08-16_14:00:00'",
 "'2014-08-16_15:00:00'",
 "'2014-08-16_16:00:00'",
 "'2014-08-16_17:00:00'",
 "'2014-08-16_18:00:00'",
 "'2014-08-16_19:00:00'",
 "'2014-08-16_20:00:00'",
 "'2014-08-16_21:00:00'",
 "'2014-08-16_22:00:00'",
 "'2014-08-16_23:00:00'",
 "'2014-08-17_00:00:00'",
 "'2014-08-17_01:00:00'",
 "'2014-08-17_02:00:00'",
 "'2014-08-17_03:00:00'",
 "'2014-08-17_04:00:00'",
 "'2014-08-17_05:00:00'",
 "'2014-08-17_06:00:00'",
 "'2014-08-17_07:00:00'",
 "'2014-08-17_08:00:00'",
 "'2014-08-17_09:00:00'",
 "'2014-08-17_10:00:00'",
 "'2014-08-17_11:00:00'",
 "'2014-08-17_12:00:00'",
 "'2014-08-17_13:00:00'",
 "'2014-08-17_14:00:00'",
 "'2014-08-17_15:00:00'",
 "'2014-08-17_16:00:00'",
 "'2014-08-17_17:00:00'",
 "'2014-08-17_18:00:00'",
 "'2014-08-17_19:00:00'",
 "'2014-08-17_20:00:00'",
 "'2014-08-17_21:00:00'",
 "'2014-08-17_22:00:00'",
 "'2014-08-17_23:00:00'",
 "'2014-08-18_00:00:00'",
 "'2014-08-18_01:00:00'",
 "'2014-08-18_02:00:00'",
 "'2014-08-18_03:00:00'",
 "'2014-08-18_04:00:00'",
 "'2014-08-18_05:00:00'",
 "'2014-08-18_06:00:00'",
 "'2014-08-18_07:00:00'",
 "'2014-08-18_08:00:00'",
 "'2014-08-18_09:00:00'",
 "'2014-08-18_10:00:00'",
 "'2014-08-18_11:00:00'",
 "'2014-08-18_12:00:00'",
 "'2014-08-18_13:00:00'",
 "'2014-08-18_14:00:00'",
 "'2014-08-18_15:00:00'",
 "'2014-08-18_16:00:00'",
 "'2014-08-18_17:00:00'",
 "'2014-08-18_18:00:00'",
 "'2014-08-18_19:00:00'",
 "'2014-08-18_20:00:00'",
 "'2014-08-18_21:00:00'",
 "'2014-08-18_22:00:00'",
 "'2014-08-18_23:00:00'",
 "'2014-08-19_00:00:00'",
 "'2014-08-19_01:00:00'",
 "'2014-08-19_02:00:00'",
 "'2014-08-19_03:00:00'",
 "'2014-08-19_04:00:00'",
 "'2014-08-19_05:00:00'",
 "'2014-08-19_06:00:00'",
 "'2014-08-19_07:00:00'",
 "'2014-08-19_08:00:00'",
 "'2014-08-19_09:00:00'",
 "'2014-08-19_10:00:00'",
 "'2014-08-19_11:00:00'",
 "'2014-08-19_12:00:00'",
 "'2014-08-19_13:00:00'",
 "'2014-08-19_14:00:00'",
 "'2014-08-19_15:00:00'",
 "'2014-08-19_16:00:00'",
 "'2014-08-19_17:00:00'",
 "'2014-08-19_18:00:00'",
 "'2014-08-19_19:00:00'",
 "'2014-08-19_20:00:00'",
 "'2014-08-19_21:00:00'",
 "'2014-08-19_22:00:00'",
 "'2014-08-19_23:00:00'",
 "'2014-08-20_00:00:00'",
 "'2014-08-20_01:00:00'",
 "'2014-08-20_02:00:00'",
 "'2014-08-20_03:00:00'",
 "'2014-08-20_04:00:00'",
 "'2014-08-20_05:00:00'",
 "'2014-08-20_06:00:00'",
 "'2014-08-20_07:00:00'",
 "'2014-08-20_08:00:00'",
 "'2014-08-20_09:00:00'",
 "'2014-08-20_10:00:00'",
 "'2014-08-20_11:00:00'",
 "'2014-08-20_12:00:00'",
 "'2014-08-20_13:00:00'",
 "'2014-08-20_14:00:00'",
 "'2014-08-20_15:00:00'",
 "'2014-08-20_16:00:00'",
 "'2014-08-20_17:00:00'",
 "'2014-08-20_18:00:00'",
 "'2014-08-20_19:00:00'",
 "'2014-08-20_20:00:00'",
 "'2014-08-20_21:00:00'",
 "'2014-08-20_22:00:00'",
 "'2014-08-20_23:00:00'",
 "'2014-08-21_00:00:00'",
 "'2014-08-21_01:00:00'",
 "'2014-08-21_02:00:00'",
 "'2014-08-21_03:00:00'",
 "'2014-08-21_04:00:00'",
 "'2014-08-21_05:00:00'",
 "'2014-08-21_06:00:00'",
 "'2014-08-21_07:00:00'",
 "'2014-08-21_08:00:00'",
 "'2014-08-21_09:00:00'",
 "'2014-08-21_10:00:00'",
 "'2014-08-21_11:00:00'",
 "'2014-08-21_12:00:00'",
 "'2014-08-21_13:00:00'",
 "'2014-08-21_14:00:00'",
 "'2014-08-21_15:00:00'",
 "'2014-08-21_16:00:00'",
 "'2014-08-21_17:00:00'",
 "'2014-08-21_18:00:00'",
 "'2014-08-21_19:00:00'",
 "'2014-08-21_20:00:00'",
 "'2014-08-21_21:00:00'",
 "'2014-08-21_22:00:00'",
 "'2014-08-21_23:00:00'",
 "'2014-08-22_00:00:00'",
 "'2014-08-22_01:00:00'",
 "'2014-08-22_02:00:00'",
 "'2014-08-22_03:00:00'",
 "'2014-08-22_04:00:00'",
 "'2014-08-22_05:00:00'",
 "'2014-08-22_06:00:00'",
 "'2014-08-22_07:00:00'",
 "'2014-08-22_08:00:00'",
 "'2014-08-22_09:00:00'",
 "'2014-08-22_10:00:00'",
 "'2014-08-22_11:00:00'",
 "'2014-08-22_12:00:00'",
 "'2014-08-22_13:00:00'",
 "'2014-08-22_14:00:00'",
 "'2014-08-22_15:00:00'",
 "'2014-08-22_16:00:00'",
 "'2014-08-22_17:00:00'",
 "'2014-08-22_18:00:00'",
 "'2014-08-22_19:00:00'",
 "'2014-08-22_20:00:00'",
 "'2014-08-22_21:00:00'",
 "'2014-08-22_22:00:00'",
 "'2014-08-22_23:00:00'",
 "'2014-08-23_00:00:00'",
 "'2014-08-23_01:00:00'",
 "'2014-08-23_02:00:00'",
 "'2014-08-23_03:00:00'",
 "'2014-08-23_04:00:00'",
 "'2014-08-23_05:00:00'",
 "'2014-08-23_06:00:00'",
 "'2014-08-23_07:00:00'",
 "'2014-08-23_08:00:00'",
 "'2014-08-23_09:00:00'",
 "'2014-08-23_10:00:00'",
 "'2014-08-23_11:00:00'",
 "'2014-08-23_12:00:00'",
 "'2014-08-23_13:00:00'",
 "'2014-08-23_14:00:00'",
 "'2014-08-23_15:00:00'",
 "'2014-08-23_16:00:00'",
 "'2014-08-23_17:00:00'",
 "'2014-08-23_18:00:00'",
 "'2014-08-23_19:00:00'",
 "'2014-08-23_20:00:00'",
 "'2014-08-23_21:00:00'",
 "'2014-08-23_22:00:00'",
 "'2014-08-23_23:00:00'",
 "'2014-08-24_00:00:00'",
 "'2014-08-24_01:00:00'",
 "'2014-08-24_02:00:00'",
 "'2014-08-24_03:00:00'",
 "'2014-08-24_04:00:00'",
 "'2014-08-24_05:00:00'",
 "'2014-08-24_06:00:00'",
 "'2014-08-24_07:00:00'",
 "'2014-08-24_08:00:00'",
 "'2014-08-24_09:00:00'",
 "'2014-08-24_10:00:00'",
 "'2014-08-24_11:00:00'",
 "'2014-08-24_12:00:00'",
 "'2014-08-24_13:00:00'",
 "'2014-08-24_14:00:00'",
 "'2014-08-24_15:00:00'",
 "'2014-08-24_16:00:00'",
 "'2014-08-24_17:00:00'",
 "'2014-08-24_18:00:00'",
 "'2014-08-24_19:00:00'",
 "'2014-08-24_20:00:00'",
 "'2014-08-24_21:00:00'",
 "'2014-08-24_22:00:00'",
 "'2014-08-24_23:00:00'",
 "'2014-08-25_00:00:00'",
 "'2014-08-25_01:00:00'",
 "'2014-08-25_02:00:00'",
 "'2014-08-25_03:00:00'",
 "'2014-08-25_04:00:00'",
 "'2014-08-25_05:00:00'",
 "'2014-08-25_06:00:00'",
 "'2014-08-25_07:00:00'",
 "'2014-08-25_08:00:00'",
 "'2014-08-25_09:00:00'",
 "'2014-08-25_10:00:00'",
 "'2014-08-25_11:00:00'",
 "'2014-08-25_12:00:00'",
 "'2014-08-25_13:00:00'",
 "'2014-08-25_14:00:00'",
 "'2014-08-25_15:00:00'",
 "'2014-08-25_16:00:00'",
 "'2014-08-25_17:00:00'",
 "'2014-08-25_18:00:00'",
 "'2014-08-25_19:00:00'",
 "'2014-08-25_20:00:00'",
 "'2014-08-25_21:00:00'",
 "'2014-08-25_22:00:00'",
 "'2014-08-25_23:00:00'",
 "'2014-08-26_00:00:00'",
 "'2014-08-26_01:00:00'",
 "'2014-08-26_02:00:00'",
 "'2014-08-26_03:00:00'",
 "'2014-08-26_04:00:00'",
 "'2014-08-26_05:00:00'",
 "'2014-08-26_06:00:00'",
 "'2014-08-26_07:00:00'",
 "'2014-08-26_08:00:00'",
 "'2014-08-26_09:00:00'",
 "'2014-08-26_10:00:00'",
 "'2014-08-26_11:00:00'",
 "'2014-08-26_12:00:00'",
 "'2014-08-26_13:00:00'",
 "'2014-08-26_14:00:00'",
 "'2014-08-26_15:00:00'",
 "'2014-08-26_16:00:00'",
 "'2014-08-26_17:00:00'",
 "'2014-08-26_18:00:00'",
 "'2014-08-26_19:00:00'",
 "'2014-08-26_20:00:00'",
 "'2014-08-26_21:00:00'",
 "'2014-08-26_22:00:00'",
 "'2014-08-26_23:00:00'",
 "'2014-08-27_00:00:00'",
 "'2014-08-27_01:00:00'",
 "'2014-08-27_02:00:00'",
 "'2014-08-27_03:00:00'",
 "'2014-08-27_04:00:00'",
 "'2014-08-27_05:00:00'",
 "'2014-08-27_06:00:00'",
 "'2014-08-27_07:00:00'",
 "'2014-08-27_08:00:00'",
 "'2014-08-27_09:00:00'",
 "'2014-08-27_10:00:00'",
 "'2014-08-27_11:00:00'",
 "'2014-08-27_12:00:00'",
 "'2014-08-27_13:00:00'",
 "'2014-08-27_14:00:00'",
 "'2014-08-27_15:00:00'",
 "'2014-08-27_16:00:00'",
 "'2014-08-27_17:00:00'",
 "'2014-08-27_18:00:00'",
 "'2014-08-27_19:00:00'",
 "'2014-08-27_20:00:00'",
 "'2014-08-27_21:00:00'",
 "'2014-08-27_22:00:00'",
 "'2014-08-27_23:00:00'",
 "'2014-08-28_00:00:00'",
 "'2014-08-28_01:00:00'",
 "'2014-08-28_02:00:00'",
 "'2014-08-28_03:00:00'",
 "'2014-08-28_04:00:00'",
 "'2014-08-28_05:00:00'",
 "'2014-08-28_06:00:00'",
 "'2014-08-28_07:00:00'",
 "'2014-08-28_08:00:00'",
 "'2014-08-28_09:00:00'",
 "'2014-08-28_10:00:00'",
 "'2014-08-28_11:00:00'",
 "'2014-08-28_12:00:00'",
 "'2014-08-28_13:00:00'",
 "'2014-08-28_14:00:00'",
 "'2014-08-28_15:00:00'",
 "'2014-08-28_16:00:00'",
 "'2014-08-28_17:00:00'",
 "'2014-08-28_18:00:00'",
 "'2014-08-28_19:00:00'",
 "'2014-08-28_20:00:00'",
 "'2014-08-28_21:00:00'",
 "'2014-08-28_22:00:00'",
 "'2014-08-28_23:00:00'",
 "'2014-08-29_00:00:00'",
 "'2014-08-29_01:00:00'",
 "'2014-08-29_02:00:00'",
 "'2014-08-29_03:00:00'",
 "'2014-08-29_04:00:00'",
 "'2014-08-29_05:00:00'",
 "'2014-08-29_06:00:00'",
 "'2014-08-29_07:00:00'",
 "'2014-08-29_08:00:00'",
 "'2014-08-29_09:00:00'",
 "'2014-08-29_10:00:00'",
 "'2014-08-29_11:00:00'",
 "'2014-08-29_12:00:00'",
 "'2014-08-29_13:00:00'",
 "'2014-08-29_14:00:00'",
 "'2014-08-29_15:00:00'",
 "'2014-08-29_16:00:00'",
 "'2014-08-29_17:00:00'",
 "'2014-08-29_18:00:00'",
 "'2014-08-29_19:00:00'",
 "'2014-08-29_20:00:00'",
 "'2014-08-29_21:00:00'",
 "'2014-08-29_22:00:00'",
 "'2014-08-29_23:00:00'",
 "'2014-08-30_00:00:00'",
 "'2014-08-30_01:00:00'",
 "'2014-08-30_02:00:00'",
 "'2014-08-30_03:00:00'",
 "'2014-08-30_04:00:00'",
 "'2014-08-30_05:00:00'",
 "'2014-08-30_06:00:00'",
 "'2014-08-30_07:00:00'",
 "'2014-08-30_08:00:00'",
 "'2014-08-30_09:00:00'",
 "'2014-08-30_10:00:00'",
 "'2014-08-30_11:00:00'",
 "'2014-08-30_12:00:00'",
 "'2014-08-30_13:00:00'",
 "'2014-08-30_14:00:00'",
 "'2014-08-30_15:00:00'",
 "'2014-08-30_16:00:00'",
 "'2014-08-30_17:00:00'",
 "'2014-08-30_18:00:00'",
 "'2014-08-30_19:00:00'",
 "'2014-08-30_20:00:00'",
 "'2014-08-30_21:00:00'",
 "'2014-08-30_22:00:00'",
 "'2014-08-30_23:00:00'"]

But it isn’t that simple!

time_datetime = pd.to_datetime(time_strs)

returns the error:

ValueError: ('Unknown string format:', "'2014-08-01_00:00:00'")

We need to remove those pesky underscores.

[6]:
time_strs = [str(i.values)[1:].replace("_"," ") for i in da_time]
time_strs
[6]:
["'2014-08-01 00:00:00'",
 "'2014-08-01 01:00:00'",
 "'2014-08-01 02:00:00'",
 "'2014-08-01 03:00:00'",
 "'2014-08-01 04:00:00'",
 "'2014-08-01 05:00:00'",
 "'2014-08-01 06:00:00'",
 "'2014-08-01 07:00:00'",
 "'2014-08-01 08:00:00'",
 "'2014-08-01 09:00:00'",
 "'2014-08-01 10:00:00'",
 "'2014-08-01 11:00:00'",
 "'2014-08-01 12:00:00'",
 "'2014-08-01 13:00:00'",
 "'2014-08-01 14:00:00'",
 "'2014-08-01 15:00:00'",
 "'2014-08-01 16:00:00'",
 "'2014-08-01 17:00:00'",
 "'2014-08-01 18:00:00'",
 "'2014-08-01 19:00:00'",
 "'2014-08-01 20:00:00'",
 "'2014-08-01 21:00:00'",
 "'2014-08-01 22:00:00'",
 "'2014-08-01 23:00:00'",
 "'2014-08-02 00:00:00'",
 "'2014-08-02 01:00:00'",
 "'2014-08-02 02:00:00'",
 "'2014-08-02 03:00:00'",
 "'2014-08-02 04:00:00'",
 "'2014-08-02 05:00:00'",
 "'2014-08-02 06:00:00'",
 "'2014-08-02 07:00:00'",
 "'2014-08-02 08:00:00'",
 "'2014-08-02 09:00:00'",
 "'2014-08-02 10:00:00'",
 "'2014-08-02 11:00:00'",
 "'2014-08-02 12:00:00'",
 "'2014-08-02 13:00:00'",
 "'2014-08-02 14:00:00'",
 "'2014-08-02 15:00:00'",
 "'2014-08-02 16:00:00'",
 "'2014-08-02 17:00:00'",
 "'2014-08-02 18:00:00'",
 "'2014-08-02 19:00:00'",
 "'2014-08-02 20:00:00'",
 "'2014-08-02 21:00:00'",
 "'2014-08-02 22:00:00'",
 "'2014-08-02 23:00:00'",
 "'2014-08-03 00:00:00'",
 "'2014-08-03 01:00:00'",
 "'2014-08-03 02:00:00'",
 "'2014-08-03 03:00:00'",
 "'2014-08-03 04:00:00'",
 "'2014-08-03 05:00:00'",
 "'2014-08-03 06:00:00'",
 "'2014-08-03 07:00:00'",
 "'2014-08-03 08:00:00'",
 "'2014-08-03 09:00:00'",
 "'2014-08-03 10:00:00'",
 "'2014-08-03 11:00:00'",
 "'2014-08-03 12:00:00'",
 "'2014-08-03 13:00:00'",
 "'2014-08-03 14:00:00'",
 "'2014-08-03 15:00:00'",
 "'2014-08-03 16:00:00'",
 "'2014-08-03 17:00:00'",
 "'2014-08-03 18:00:00'",
 "'2014-08-03 19:00:00'",
 "'2014-08-03 20:00:00'",
 "'2014-08-03 21:00:00'",
 "'2014-08-03 22:00:00'",
 "'2014-08-03 23:00:00'",
 "'2014-08-04 00:00:00'",
 "'2014-08-04 01:00:00'",
 "'2014-08-04 02:00:00'",
 "'2014-08-04 03:00:00'",
 "'2014-08-04 04:00:00'",
 "'2014-08-04 05:00:00'",
 "'2014-08-04 06:00:00'",
 "'2014-08-04 07:00:00'",
 "'2014-08-04 08:00:00'",
 "'2014-08-04 09:00:00'",
 "'2014-08-04 10:00:00'",
 "'2014-08-04 11:00:00'",
 "'2014-08-04 12:00:00'",
 "'2014-08-04 13:00:00'",
 "'2014-08-04 14:00:00'",
 "'2014-08-04 15:00:00'",
 "'2014-08-04 16:00:00'",
 "'2014-08-04 17:00:00'",
 "'2014-08-04 18:00:00'",
 "'2014-08-04 19:00:00'",
 "'2014-08-04 20:00:00'",
 "'2014-08-04 21:00:00'",
 "'2014-08-04 22:00:00'",
 "'2014-08-04 23:00:00'",
 "'2014-08-05 00:00:00'",
 "'2014-08-05 01:00:00'",
 "'2014-08-05 02:00:00'",
 "'2014-08-05 03:00:00'",
 "'2014-08-05 04:00:00'",
 "'2014-08-05 05:00:00'",
 "'2014-08-05 06:00:00'",
 "'2014-08-05 07:00:00'",
 "'2014-08-05 08:00:00'",
 "'2014-08-05 09:00:00'",
 "'2014-08-05 10:00:00'",
 "'2014-08-05 11:00:00'",
 "'2014-08-05 12:00:00'",
 "'2014-08-05 13:00:00'",
 "'2014-08-05 14:00:00'",
 "'2014-08-05 15:00:00'",
 "'2014-08-05 16:00:00'",
 "'2014-08-05 17:00:00'",
 "'2014-08-05 18:00:00'",
 "'2014-08-05 19:00:00'",
 "'2014-08-05 20:00:00'",
 "'2014-08-05 21:00:00'",
 "'2014-08-05 22:00:00'",
 "'2014-08-05 23:00:00'",
 "'2014-08-06 00:00:00'",
 "'2014-08-06 01:00:00'",
 "'2014-08-06 02:00:00'",
 "'2014-08-06 03:00:00'",
 "'2014-08-06 04:00:00'",
 "'2014-08-06 05:00:00'",
 "'2014-08-06 06:00:00'",
 "'2014-08-06 07:00:00'",
 "'2014-08-06 08:00:00'",
 "'2014-08-06 09:00:00'",
 "'2014-08-06 10:00:00'",
 "'2014-08-06 11:00:00'",
 "'2014-08-06 12:00:00'",
 "'2014-08-06 13:00:00'",
 "'2014-08-06 14:00:00'",
 "'2014-08-06 15:00:00'",
 "'2014-08-06 16:00:00'",
 "'2014-08-06 17:00:00'",
 "'2014-08-06 18:00:00'",
 "'2014-08-06 19:00:00'",
 "'2014-08-06 20:00:00'",
 "'2014-08-06 21:00:00'",
 "'2014-08-06 22:00:00'",
 "'2014-08-06 23:00:00'",
 "'2014-08-07 00:00:00'",
 "'2014-08-07 01:00:00'",
 "'2014-08-07 02:00:00'",
 "'2014-08-07 03:00:00'",
 "'2014-08-07 04:00:00'",
 "'2014-08-07 05:00:00'",
 "'2014-08-07 06:00:00'",
 "'2014-08-07 07:00:00'",
 "'2014-08-07 08:00:00'",
 "'2014-08-07 09:00:00'",
 "'2014-08-07 10:00:00'",
 "'2014-08-07 11:00:00'",
 "'2014-08-07 12:00:00'",
 "'2014-08-07 13:00:00'",
 "'2014-08-07 14:00:00'",
 "'2014-08-07 15:00:00'",
 "'2014-08-07 16:00:00'",
 "'2014-08-07 17:00:00'",
 "'2014-08-07 18:00:00'",
 "'2014-08-07 19:00:00'",
 "'2014-08-07 20:00:00'",
 "'2014-08-07 21:00:00'",
 "'2014-08-07 22:00:00'",
 "'2014-08-07 23:00:00'",
 "'2014-08-08 00:00:00'",
 "'2014-08-08 01:00:00'",
 "'2014-08-08 02:00:00'",
 "'2014-08-08 03:00:00'",
 "'2014-08-08 04:00:00'",
 "'2014-08-08 05:00:00'",
 "'2014-08-08 06:00:00'",
 "'2014-08-08 07:00:00'",
 "'2014-08-08 08:00:00'",
 "'2014-08-08 09:00:00'",
 "'2014-08-08 10:00:00'",
 "'2014-08-08 11:00:00'",
 "'2014-08-08 12:00:00'",
 "'2014-08-08 13:00:00'",
 "'2014-08-08 14:00:00'",
 "'2014-08-08 15:00:00'",
 "'2014-08-08 16:00:00'",
 "'2014-08-08 17:00:00'",
 "'2014-08-08 18:00:00'",
 "'2014-08-08 19:00:00'",
 "'2014-08-08 20:00:00'",
 "'2014-08-08 21:00:00'",
 "'2014-08-08 22:00:00'",
 "'2014-08-08 23:00:00'",
 "'2014-08-09 00:00:00'",
 "'2014-08-09 01:00:00'",
 "'2014-08-09 02:00:00'",
 "'2014-08-09 03:00:00'",
 "'2014-08-09 04:00:00'",
 "'2014-08-09 05:00:00'",
 "'2014-08-09 06:00:00'",
 "'2014-08-09 07:00:00'",
 "'2014-08-09 08:00:00'",
 "'2014-08-09 09:00:00'",
 "'2014-08-09 10:00:00'",
 "'2014-08-09 11:00:00'",
 "'2014-08-09 12:00:00'",
 "'2014-08-09 13:00:00'",
 "'2014-08-09 14:00:00'",
 "'2014-08-09 15:00:00'",
 "'2014-08-09 16:00:00'",
 "'2014-08-09 17:00:00'",
 "'2014-08-09 18:00:00'",
 "'2014-08-09 19:00:00'",
 "'2014-08-09 20:00:00'",
 "'2014-08-09 21:00:00'",
 "'2014-08-09 22:00:00'",
 "'2014-08-09 23:00:00'",
 "'2014-08-10 00:00:00'",
 "'2014-08-10 01:00:00'",
 "'2014-08-10 02:00:00'",
 "'2014-08-10 03:00:00'",
 "'2014-08-10 04:00:00'",
 "'2014-08-10 05:00:00'",
 "'2014-08-10 06:00:00'",
 "'2014-08-10 07:00:00'",
 "'2014-08-10 08:00:00'",
 "'2014-08-10 09:00:00'",
 "'2014-08-10 10:00:00'",
 "'2014-08-10 11:00:00'",
 "'2014-08-10 12:00:00'",
 "'2014-08-10 13:00:00'",
 "'2014-08-10 14:00:00'",
 "'2014-08-10 15:00:00'",
 "'2014-08-10 16:00:00'",
 "'2014-08-10 17:00:00'",
 "'2014-08-10 18:00:00'",
 "'2014-08-10 19:00:00'",
 "'2014-08-10 20:00:00'",
 "'2014-08-10 21:00:00'",
 "'2014-08-10 22:00:00'",
 "'2014-08-10 23:00:00'",
 "'2014-08-11 00:00:00'",
 "'2014-08-11 01:00:00'",
 "'2014-08-11 02:00:00'",
 "'2014-08-11 03:00:00'",
 "'2014-08-11 04:00:00'",
 "'2014-08-11 05:00:00'",
 "'2014-08-11 06:00:00'",
 "'2014-08-11 07:00:00'",
 "'2014-08-11 08:00:00'",
 "'2014-08-11 09:00:00'",
 "'2014-08-11 10:00:00'",
 "'2014-08-11 11:00:00'",
 "'2014-08-11 12:00:00'",
 "'2014-08-11 13:00:00'",
 "'2014-08-11 14:00:00'",
 "'2014-08-11 15:00:00'",
 "'2014-08-11 16:00:00'",
 "'2014-08-11 17:00:00'",
 "'2014-08-11 18:00:00'",
 "'2014-08-11 19:00:00'",
 "'2014-08-11 20:00:00'",
 "'2014-08-11 21:00:00'",
 "'2014-08-11 22:00:00'",
 "'2014-08-11 23:00:00'",
 "'2014-08-12 00:00:00'",
 "'2014-08-12 01:00:00'",
 "'2014-08-12 02:00:00'",
 "'2014-08-12 03:00:00'",
 "'2014-08-12 04:00:00'",
 "'2014-08-12 05:00:00'",
 "'2014-08-12 06:00:00'",
 "'2014-08-12 07:00:00'",
 "'2014-08-12 08:00:00'",
 "'2014-08-12 09:00:00'",
 "'2014-08-12 10:00:00'",
 "'2014-08-12 11:00:00'",
 "'2014-08-12 12:00:00'",
 "'2014-08-12 13:00:00'",
 "'2014-08-12 14:00:00'",
 "'2014-08-12 15:00:00'",
 "'2014-08-12 16:00:00'",
 "'2014-08-12 17:00:00'",
 "'2014-08-12 18:00:00'",
 "'2014-08-12 19:00:00'",
 "'2014-08-12 20:00:00'",
 "'2014-08-12 21:00:00'",
 "'2014-08-12 22:00:00'",
 "'2014-08-12 23:00:00'",
 "'2014-08-13 00:00:00'",
 "'2014-08-13 01:00:00'",
 "'2014-08-13 02:00:00'",
 "'2014-08-13 03:00:00'",
 "'2014-08-13 04:00:00'",
 "'2014-08-13 05:00:00'",
 "'2014-08-13 06:00:00'",
 "'2014-08-13 07:00:00'",
 "'2014-08-13 08:00:00'",
 "'2014-08-13 09:00:00'",
 "'2014-08-13 10:00:00'",
 "'2014-08-13 11:00:00'",
 "'2014-08-13 12:00:00'",
 "'2014-08-13 13:00:00'",
 "'2014-08-13 14:00:00'",
 "'2014-08-13 15:00:00'",
 "'2014-08-13 16:00:00'",
 "'2014-08-13 17:00:00'",
 "'2014-08-13 18:00:00'",
 "'2014-08-13 19:00:00'",
 "'2014-08-13 20:00:00'",
 "'2014-08-13 21:00:00'",
 "'2014-08-13 22:00:00'",
 "'2014-08-13 23:00:00'",
 "'2014-08-14 00:00:00'",
 "'2014-08-14 01:00:00'",
 "'2014-08-14 02:00:00'",
 "'2014-08-14 03:00:00'",
 "'2014-08-14 04:00:00'",
 "'2014-08-14 05:00:00'",
 "'2014-08-14 06:00:00'",
 "'2014-08-14 07:00:00'",
 "'2014-08-14 08:00:00'",
 "'2014-08-14 09:00:00'",
 "'2014-08-14 10:00:00'",
 "'2014-08-14 11:00:00'",
 "'2014-08-14 12:00:00'",
 "'2014-08-14 13:00:00'",
 "'2014-08-14 14:00:00'",
 "'2014-08-14 15:00:00'",
 "'2014-08-14 16:00:00'",
 "'2014-08-14 17:00:00'",
 "'2014-08-14 18:00:00'",
 "'2014-08-14 19:00:00'",
 "'2014-08-14 20:00:00'",
 "'2014-08-14 21:00:00'",
 "'2014-08-14 22:00:00'",
 "'2014-08-14 23:00:00'",
 "'2014-08-15 00:00:00'",
 "'2014-08-15 01:00:00'",
 "'2014-08-15 02:00:00'",
 "'2014-08-15 03:00:00'",
 "'2014-08-15 04:00:00'",
 "'2014-08-15 05:00:00'",
 "'2014-08-15 06:00:00'",
 "'2014-08-15 07:00:00'",
 "'2014-08-15 08:00:00'",
 "'2014-08-15 09:00:00'",
 "'2014-08-15 10:00:00'",
 "'2014-08-15 11:00:00'",
 "'2014-08-15 12:00:00'",
 "'2014-08-15 13:00:00'",
 "'2014-08-15 14:00:00'",
 "'2014-08-15 15:00:00'",
 "'2014-08-15 16:00:00'",
 "'2014-08-15 17:00:00'",
 "'2014-08-15 18:00:00'",
 "'2014-08-15 19:00:00'",
 "'2014-08-15 20:00:00'",
 "'2014-08-15 21:00:00'",
 "'2014-08-15 22:00:00'",
 "'2014-08-15 23:00:00'",
 "'2014-08-16 00:00:00'",
 "'2014-08-16 01:00:00'",
 "'2014-08-16 02:00:00'",
 "'2014-08-16 03:00:00'",
 "'2014-08-16 04:00:00'",
 "'2014-08-16 05:00:00'",
 "'2014-08-16 06:00:00'",
 "'2014-08-16 07:00:00'",
 "'2014-08-16 08:00:00'",
 "'2014-08-16 09:00:00'",
 "'2014-08-16 10:00:00'",
 "'2014-08-16 11:00:00'",
 "'2014-08-16 12:00:00'",
 "'2014-08-16 13:00:00'",
 "'2014-08-16 14:00:00'",
 "'2014-08-16 15:00:00'",
 "'2014-08-16 16:00:00'",
 "'2014-08-16 17:00:00'",
 "'2014-08-16 18:00:00'",
 "'2014-08-16 19:00:00'",
 "'2014-08-16 20:00:00'",
 "'2014-08-16 21:00:00'",
 "'2014-08-16 22:00:00'",
 "'2014-08-16 23:00:00'",
 "'2014-08-17 00:00:00'",
 "'2014-08-17 01:00:00'",
 "'2014-08-17 02:00:00'",
 "'2014-08-17 03:00:00'",
 "'2014-08-17 04:00:00'",
 "'2014-08-17 05:00:00'",
 "'2014-08-17 06:00:00'",
 "'2014-08-17 07:00:00'",
 "'2014-08-17 08:00:00'",
 "'2014-08-17 09:00:00'",
 "'2014-08-17 10:00:00'",
 "'2014-08-17 11:00:00'",
 "'2014-08-17 12:00:00'",
 "'2014-08-17 13:00:00'",
 "'2014-08-17 14:00:00'",
 "'2014-08-17 15:00:00'",
 "'2014-08-17 16:00:00'",
 "'2014-08-17 17:00:00'",
 "'2014-08-17 18:00:00'",
 "'2014-08-17 19:00:00'",
 "'2014-08-17 20:00:00'",
 "'2014-08-17 21:00:00'",
 "'2014-08-17 22:00:00'",
 "'2014-08-17 23:00:00'",
 "'2014-08-18 00:00:00'",
 "'2014-08-18 01:00:00'",
 "'2014-08-18 02:00:00'",
 "'2014-08-18 03:00:00'",
 "'2014-08-18 04:00:00'",
 "'2014-08-18 05:00:00'",
 "'2014-08-18 06:00:00'",
 "'2014-08-18 07:00:00'",
 "'2014-08-18 08:00:00'",
 "'2014-08-18 09:00:00'",
 "'2014-08-18 10:00:00'",
 "'2014-08-18 11:00:00'",
 "'2014-08-18 12:00:00'",
 "'2014-08-18 13:00:00'",
 "'2014-08-18 14:00:00'",
 "'2014-08-18 15:00:00'",
 "'2014-08-18 16:00:00'",
 "'2014-08-18 17:00:00'",
 "'2014-08-18 18:00:00'",
 "'2014-08-18 19:00:00'",
 "'2014-08-18 20:00:00'",
 "'2014-08-18 21:00:00'",
 "'2014-08-18 22:00:00'",
 "'2014-08-18 23:00:00'",
 "'2014-08-19 00:00:00'",
 "'2014-08-19 01:00:00'",
 "'2014-08-19 02:00:00'",
 "'2014-08-19 03:00:00'",
 "'2014-08-19 04:00:00'",
 "'2014-08-19 05:00:00'",
 "'2014-08-19 06:00:00'",
 "'2014-08-19 07:00:00'",
 "'2014-08-19 08:00:00'",
 "'2014-08-19 09:00:00'",
 "'2014-08-19 10:00:00'",
 "'2014-08-19 11:00:00'",
 "'2014-08-19 12:00:00'",
 "'2014-08-19 13:00:00'",
 "'2014-08-19 14:00:00'",
 "'2014-08-19 15:00:00'",
 "'2014-08-19 16:00:00'",
 "'2014-08-19 17:00:00'",
 "'2014-08-19 18:00:00'",
 "'2014-08-19 19:00:00'",
 "'2014-08-19 20:00:00'",
 "'2014-08-19 21:00:00'",
 "'2014-08-19 22:00:00'",
 "'2014-08-19 23:00:00'",
 "'2014-08-20 00:00:00'",
 "'2014-08-20 01:00:00'",
 "'2014-08-20 02:00:00'",
 "'2014-08-20 03:00:00'",
 "'2014-08-20 04:00:00'",
 "'2014-08-20 05:00:00'",
 "'2014-08-20 06:00:00'",
 "'2014-08-20 07:00:00'",
 "'2014-08-20 08:00:00'",
 "'2014-08-20 09:00:00'",
 "'2014-08-20 10:00:00'",
 "'2014-08-20 11:00:00'",
 "'2014-08-20 12:00:00'",
 "'2014-08-20 13:00:00'",
 "'2014-08-20 14:00:00'",
 "'2014-08-20 15:00:00'",
 "'2014-08-20 16:00:00'",
 "'2014-08-20 17:00:00'",
 "'2014-08-20 18:00:00'",
 "'2014-08-20 19:00:00'",
 "'2014-08-20 20:00:00'",
 "'2014-08-20 21:00:00'",
 "'2014-08-20 22:00:00'",
 "'2014-08-20 23:00:00'",
 "'2014-08-21 00:00:00'",
 "'2014-08-21 01:00:00'",
 "'2014-08-21 02:00:00'",
 "'2014-08-21 03:00:00'",
 "'2014-08-21 04:00:00'",
 "'2014-08-21 05:00:00'",
 "'2014-08-21 06:00:00'",
 "'2014-08-21 07:00:00'",
 "'2014-08-21 08:00:00'",
 "'2014-08-21 09:00:00'",
 "'2014-08-21 10:00:00'",
 "'2014-08-21 11:00:00'",
 "'2014-08-21 12:00:00'",
 "'2014-08-21 13:00:00'",
 "'2014-08-21 14:00:00'",
 "'2014-08-21 15:00:00'",
 "'2014-08-21 16:00:00'",
 "'2014-08-21 17:00:00'",
 "'2014-08-21 18:00:00'",
 "'2014-08-21 19:00:00'",
 "'2014-08-21 20:00:00'",
 "'2014-08-21 21:00:00'",
 "'2014-08-21 22:00:00'",
 "'2014-08-21 23:00:00'",
 "'2014-08-22 00:00:00'",
 "'2014-08-22 01:00:00'",
 "'2014-08-22 02:00:00'",
 "'2014-08-22 03:00:00'",
 "'2014-08-22 04:00:00'",
 "'2014-08-22 05:00:00'",
 "'2014-08-22 06:00:00'",
 "'2014-08-22 07:00:00'",
 "'2014-08-22 08:00:00'",
 "'2014-08-22 09:00:00'",
 "'2014-08-22 10:00:00'",
 "'2014-08-22 11:00:00'",
 "'2014-08-22 12:00:00'",
 "'2014-08-22 13:00:00'",
 "'2014-08-22 14:00:00'",
 "'2014-08-22 15:00:00'",
 "'2014-08-22 16:00:00'",
 "'2014-08-22 17:00:00'",
 "'2014-08-22 18:00:00'",
 "'2014-08-22 19:00:00'",
 "'2014-08-22 20:00:00'",
 "'2014-08-22 21:00:00'",
 "'2014-08-22 22:00:00'",
 "'2014-08-22 23:00:00'",
 "'2014-08-23 00:00:00'",
 "'2014-08-23 01:00:00'",
 "'2014-08-23 02:00:00'",
 "'2014-08-23 03:00:00'",
 "'2014-08-23 04:00:00'",
 "'2014-08-23 05:00:00'",
 "'2014-08-23 06:00:00'",
 "'2014-08-23 07:00:00'",
 "'2014-08-23 08:00:00'",
 "'2014-08-23 09:00:00'",
 "'2014-08-23 10:00:00'",
 "'2014-08-23 11:00:00'",
 "'2014-08-23 12:00:00'",
 "'2014-08-23 13:00:00'",
 "'2014-08-23 14:00:00'",
 "'2014-08-23 15:00:00'",
 "'2014-08-23 16:00:00'",
 "'2014-08-23 17:00:00'",
 "'2014-08-23 18:00:00'",
 "'2014-08-23 19:00:00'",
 "'2014-08-23 20:00:00'",
 "'2014-08-23 21:00:00'",
 "'2014-08-23 22:00:00'",
 "'2014-08-23 23:00:00'",
 "'2014-08-24 00:00:00'",
 "'2014-08-24 01:00:00'",
 "'2014-08-24 02:00:00'",
 "'2014-08-24 03:00:00'",
 "'2014-08-24 04:00:00'",
 "'2014-08-24 05:00:00'",
 "'2014-08-24 06:00:00'",
 "'2014-08-24 07:00:00'",
 "'2014-08-24 08:00:00'",
 "'2014-08-24 09:00:00'",
 "'2014-08-24 10:00:00'",
 "'2014-08-24 11:00:00'",
 "'2014-08-24 12:00:00'",
 "'2014-08-24 13:00:00'",
 "'2014-08-24 14:00:00'",
 "'2014-08-24 15:00:00'",
 "'2014-08-24 16:00:00'",
 "'2014-08-24 17:00:00'",
 "'2014-08-24 18:00:00'",
 "'2014-08-24 19:00:00'",
 "'2014-08-24 20:00:00'",
 "'2014-08-24 21:00:00'",
 "'2014-08-24 22:00:00'",
 "'2014-08-24 23:00:00'",
 "'2014-08-25 00:00:00'",
 "'2014-08-25 01:00:00'",
 "'2014-08-25 02:00:00'",
 "'2014-08-25 03:00:00'",
 "'2014-08-25 04:00:00'",
 "'2014-08-25 05:00:00'",
 "'2014-08-25 06:00:00'",
 "'2014-08-25 07:00:00'",
 "'2014-08-25 08:00:00'",
 "'2014-08-25 09:00:00'",
 "'2014-08-25 10:00:00'",
 "'2014-08-25 11:00:00'",
 "'2014-08-25 12:00:00'",
 "'2014-08-25 13:00:00'",
 "'2014-08-25 14:00:00'",
 "'2014-08-25 15:00:00'",
 "'2014-08-25 16:00:00'",
 "'2014-08-25 17:00:00'",
 "'2014-08-25 18:00:00'",
 "'2014-08-25 19:00:00'",
 "'2014-08-25 20:00:00'",
 "'2014-08-25 21:00:00'",
 "'2014-08-25 22:00:00'",
 "'2014-08-25 23:00:00'",
 "'2014-08-26 00:00:00'",
 "'2014-08-26 01:00:00'",
 "'2014-08-26 02:00:00'",
 "'2014-08-26 03:00:00'",
 "'2014-08-26 04:00:00'",
 "'2014-08-26 05:00:00'",
 "'2014-08-26 06:00:00'",
 "'2014-08-26 07:00:00'",
 "'2014-08-26 08:00:00'",
 "'2014-08-26 09:00:00'",
 "'2014-08-26 10:00:00'",
 "'2014-08-26 11:00:00'",
 "'2014-08-26 12:00:00'",
 "'2014-08-26 13:00:00'",
 "'2014-08-26 14:00:00'",
 "'2014-08-26 15:00:00'",
 "'2014-08-26 16:00:00'",
 "'2014-08-26 17:00:00'",
 "'2014-08-26 18:00:00'",
 "'2014-08-26 19:00:00'",
 "'2014-08-26 20:00:00'",
 "'2014-08-26 21:00:00'",
 "'2014-08-26 22:00:00'",
 "'2014-08-26 23:00:00'",
 "'2014-08-27 00:00:00'",
 "'2014-08-27 01:00:00'",
 "'2014-08-27 02:00:00'",
 "'2014-08-27 03:00:00'",
 "'2014-08-27 04:00:00'",
 "'2014-08-27 05:00:00'",
 "'2014-08-27 06:00:00'",
 "'2014-08-27 07:00:00'",
 "'2014-08-27 08:00:00'",
 "'2014-08-27 09:00:00'",
 "'2014-08-27 10:00:00'",
 "'2014-08-27 11:00:00'",
 "'2014-08-27 12:00:00'",
 "'2014-08-27 13:00:00'",
 "'2014-08-27 14:00:00'",
 "'2014-08-27 15:00:00'",
 "'2014-08-27 16:00:00'",
 "'2014-08-27 17:00:00'",
 "'2014-08-27 18:00:00'",
 "'2014-08-27 19:00:00'",
 "'2014-08-27 20:00:00'",
 "'2014-08-27 21:00:00'",
 "'2014-08-27 22:00:00'",
 "'2014-08-27 23:00:00'",
 "'2014-08-28 00:00:00'",
 "'2014-08-28 01:00:00'",
 "'2014-08-28 02:00:00'",
 "'2014-08-28 03:00:00'",
 "'2014-08-28 04:00:00'",
 "'2014-08-28 05:00:00'",
 "'2014-08-28 06:00:00'",
 "'2014-08-28 07:00:00'",
 "'2014-08-28 08:00:00'",
 "'2014-08-28 09:00:00'",
 "'2014-08-28 10:00:00'",
 "'2014-08-28 11:00:00'",
 "'2014-08-28 12:00:00'",
 "'2014-08-28 13:00:00'",
 "'2014-08-28 14:00:00'",
 "'2014-08-28 15:00:00'",
 "'2014-08-28 16:00:00'",
 "'2014-08-28 17:00:00'",
 "'2014-08-28 18:00:00'",
 "'2014-08-28 19:00:00'",
 "'2014-08-28 20:00:00'",
 "'2014-08-28 21:00:00'",
 "'2014-08-28 22:00:00'",
 "'2014-08-28 23:00:00'",
 "'2014-08-29 00:00:00'",
 "'2014-08-29 01:00:00'",
 "'2014-08-29 02:00:00'",
 "'2014-08-29 03:00:00'",
 "'2014-08-29 04:00:00'",
 "'2014-08-29 05:00:00'",
 "'2014-08-29 06:00:00'",
 "'2014-08-29 07:00:00'",
 "'2014-08-29 08:00:00'",
 "'2014-08-29 09:00:00'",
 "'2014-08-29 10:00:00'",
 "'2014-08-29 11:00:00'",
 "'2014-08-29 12:00:00'",
 "'2014-08-29 13:00:00'",
 "'2014-08-29 14:00:00'",
 "'2014-08-29 15:00:00'",
 "'2014-08-29 16:00:00'",
 "'2014-08-29 17:00:00'",
 "'2014-08-29 18:00:00'",
 "'2014-08-29 19:00:00'",
 "'2014-08-29 20:00:00'",
 "'2014-08-29 21:00:00'",
 "'2014-08-29 22:00:00'",
 "'2014-08-29 23:00:00'",
 "'2014-08-30 00:00:00'",
 "'2014-08-30 01:00:00'",
 "'2014-08-30 02:00:00'",
 "'2014-08-30 03:00:00'",
 "'2014-08-30 04:00:00'",
 "'2014-08-30 05:00:00'",
 "'2014-08-30 06:00:00'",
 "'2014-08-30 07:00:00'",
 "'2014-08-30 08:00:00'",
 "'2014-08-30 09:00:00'",
 "'2014-08-30 10:00:00'",
 "'2014-08-30 11:00:00'",
 "'2014-08-30 12:00:00'",
 "'2014-08-30 13:00:00'",
 "'2014-08-30 14:00:00'",
 "'2014-08-30 15:00:00'",
 "'2014-08-30 16:00:00'",
 "'2014-08-30 17:00:00'",
 "'2014-08-30 18:00:00'",
 "'2014-08-30 19:00:00'",
 "'2014-08-30 20:00:00'",
 "'2014-08-30 21:00:00'",
 "'2014-08-30 22:00:00'",
 "'2014-08-30 23:00:00'"]
[7]:
time_datetime = pd.to_datetime(time_strs)
time_datetime
[7]:
DatetimeIndex(['2014-08-01 00:00:00', '2014-08-01 01:00:00',
               '2014-08-01 02:00:00', '2014-08-01 03:00:00',
               '2014-08-01 04:00:00', '2014-08-01 05:00:00',
               '2014-08-01 06:00:00', '2014-08-01 07:00:00',
               '2014-08-01 08:00:00', '2014-08-01 09:00:00',
               ...
               '2014-08-30 14:00:00', '2014-08-30 15:00:00',
               '2014-08-30 16:00:00', '2014-08-30 17:00:00',
               '2014-08-30 18:00:00', '2014-08-30 19:00:00',
               '2014-08-30 20:00:00', '2014-08-30 21:00:00',
               '2014-08-30 22:00:00', '2014-08-30 23:00:00'],
              dtype='datetime64[ns]', length=720, freq=None)

Now we have our time values. Let’s rename our dimension Time to time to match conventions, assign our new time coordinate, and drop the Times variable.

[8]:
ds_wrf_timedim = ds_wrf.rename({'Time':'time'})
ds_wrf_timedim
[8]:
<xarray.Dataset>
Dimensions:      (south_north: 159, time: 720, west_east: 159)
Dimensions without coordinates: south_north, time, west_east
Data variables:
    PREC_ACC_NC  (time, south_north, west_east) float32 ...
    T2           (time, south_north, west_east) float32 ...
    Times        (time) |S19 b'2014-08-01_00:00:00' ... b'2014-08-30_23:00:00'
    U10          (time, south_north, west_east) float32 ...
    V10          (time, south_north, west_east) float32 ...
Attributes:
    TITLE:                            OUTPUT FROM WRF V3.9 MODEL
    START_DATE:                      2014-08-01_00:00:00
    SIMULATION_START_DATE:           2014-08-01_00:00:00
    WEST-EAST_GRID_DIMENSION:        160
    SOUTH-NORTH_GRID_DIMENSION:      160
    BOTTOM-TOP_GRID_DIMENSION:       51
    DX:                              1000.0
    DY:                              1000.0
    SKEBS_ON:                        0
    SPEC_BDY_FINAL_MU:               1
    USE_Q_DIABATIC:                  0
    GRIDTYPE:                        C
    DIFF_OPT:                        1
    KM_OPT:                          4
    DAMP_OPT:                        3
    DAMPCOEF:                        0.2
    KHDIF:                           0.0
    KVDIF:                           0.0
    MP_PHYSICS:                      28
    RA_LW_PHYSICS:                   4
    RA_SW_PHYSICS:                   4
    SF_SFCLAY_PHYSICS:               1
    SF_SURFACE_PHYSICS:              4
    BL_PBL_PHYSICS:                  1
    CU_PHYSICS:                      0
    SF_LAKE_PHYSICS:                 0
    SURFACE_INPUT_SOURCE:            1
    SST_UPDATE:                      1
    GRID_FDDA:                       0
    GFDDA_INTERVAL_M:                0
    GFDDA_END_H:                     0
    GRID_SFDDA:                      0
    SGFDDA_INTERVAL_M:               0
    SGFDDA_END_H:                    0
    HYPSOMETRIC_OPT:                 2
    USE_THETA_M:                     0
    GWD_OPT:                         0
    SF_URBAN_PHYSICS:                0
    SF_OCEAN_PHYSICS:                0
    SHCU_PHYSICS:                    0
    MFSHCONV:                        0
    FEEDBACK:                        0
    SMOOTH_OPTION:                   2
    SWRAD_SCAT:                      1.0
    W_DAMPING:                       1
    DT:                              5.0
    RADT:                            10.0
    BLDT:                            0.0
    CUDT:                            0.0
    AER_OPT:                         3
    SWINT_OPT:                       0
    AER_TYPE:                        1
    AER_AOD550_OPT:                  1
    AER_ANGEXP_OPT:                  1
    AER_SSA_OPT:                     1
    AER_ASY_OPT:                     1
    AER_AOD550_VAL:                  0.12
    AER_ANGEXP_VAL:                  1.3
    AER_SSA_VAL:                     0.85
    AER_ASY_VAL:                     0.9
    MOIST_ADV_OPT:                   1
    SCALAR_ADV_OPT:                  1
    TKE_ADV_OPT:                     1
    DIFF_6TH_OPT:                    0
    DIFF_6TH_FACTOR:                 0.12
    OBS_NUDGE_OPT:                   0
    BUCKET_MM:                       100.0
    BUCKET_J:                        1000000000.0
    PREC_ACC_DT:                     60.0
    ISFTCFLX:                        0
    ISHALLOW:                        0
    ISFFLX:                          1
    ICLOUD:                          1
    ICLOUD_CU:                       0
    TRACER_PBLMIX:                   1
    SCALAR_PBLMIX:                   1
    YSU_TOPDOWN_PBLMIX:              0
    GRAV_SETTLING:                   0
    OPT_SFC:                         1
    DVEG:                            4
    OPT_CRS:                         1
    OPT_BTR:                         2
    OPT_RUN:                         1
    OPT_FRZ:                         1
    OPT_INF:                         1
    OPT_RAD:                         3
    OPT_ALB:                         2
    OPT_SNF:                         4
    OPT_TBOT:                        1
    OPT_STC:                         1
    OPT_GLA:                         1
    OPT_RSF:                         1
    DFI_OPT:                         0
    SIMULATION_INITIALIZATION_TYPE:  REAL-DATA CASE
    WEST-EAST_PATCH_START_UNSTAG:    1
    WEST-EAST_PATCH_END_UNSTAG:      159
    WEST-EAST_PATCH_START_STAG:      1
    WEST-EAST_PATCH_END_STAG:        160
    SOUTH-NORTH_PATCH_START_UNSTAG:  1
    SOUTH-NORTH_PATCH_END_UNSTAG:    159
    SOUTH-NORTH_PATCH_START_STAG:    1
    SOUTH-NORTH_PATCH_END_STAG:      160
    BOTTOM-TOP_PATCH_START_UNSTAG:   1
    BOTTOM-TOP_PATCH_END_UNSTAG:     50
    BOTTOM-TOP_PATCH_START_STAG:     1
    BOTTOM-TOP_PATCH_END_STAG:       51
    GRID_ID:                         2
    PARENT_ID:                       1
    I_PARENT_START:                  85
    J_PARENT_START:                  89
    PARENT_GRID_RATIO:               3
    CEN_LAT:                         60.36686
    CEN_LON:                         7.049286
    TRUELAT1:                        30.0
    TRUELAT2:                        50.0
    MOAD_CEN_LAT:                    60.0
    STAND_LON:                       5.59998
    POLE_LAT:                        90.0
    POLE_LON:                        0.0
    GMT:                             0.0
    JULYR:                           2014
    JULDAY:                          214
    MAP_PROJ:                        1
    MAP_PROJ_CHAR:                   Lambert Conformal
    MMINLU:                          USGS
    NUM_LAND_CAT:                    28
    ISWATER:                         16
    ISLAKE:                          28
    ISICE:                           24
    ISURBAN:                         1
    ISOILWATER:                      14
    HYBRID_OPT:                      -1
    ETAC:                            0.0
    history:                         Tue Feb  5 11:36:06 2019: ncrcat all_T2_...
    NCO:                             netCDF Operators version 4.7.4 (http://n...
    nco_openmp_thread_number:        1
    history_of_appended_files:       Tue Feb  5 11:36:06 2019: Appended file ...
[9]:
ds_wrf_timecoord = ds_wrf_timedim.assign(time=time_datetime)
ds_wrf_timecoord
[9]:
<xarray.Dataset>
Dimensions:      (south_north: 159, time: 720, west_east: 159)
Coordinates:
  * time         (time) datetime64[ns] 2014-08-01 ... 2014-08-30T23:00:00
Dimensions without coordinates: south_north, west_east
Data variables:
    PREC_ACC_NC  (time, south_north, west_east) float32 ...
    T2           (time, south_north, west_east) float32 ...
    Times        (time) |S19 b'2014-08-01_00:00:00' ... b'2014-08-30_23:00:00'
    U10          (time, south_north, west_east) float32 ...
    V10          (time, south_north, west_east) float32 ...
Attributes:
    TITLE:                            OUTPUT FROM WRF V3.9 MODEL
    START_DATE:                      2014-08-01_00:00:00
    SIMULATION_START_DATE:           2014-08-01_00:00:00
    WEST-EAST_GRID_DIMENSION:        160
    SOUTH-NORTH_GRID_DIMENSION:      160
    BOTTOM-TOP_GRID_DIMENSION:       51
    DX:                              1000.0
    DY:                              1000.0
    SKEBS_ON:                        0
    SPEC_BDY_FINAL_MU:               1
    USE_Q_DIABATIC:                  0
    GRIDTYPE:                        C
    DIFF_OPT:                        1
    KM_OPT:                          4
    DAMP_OPT:                        3
    DAMPCOEF:                        0.2
    KHDIF:                           0.0
    KVDIF:                           0.0
    MP_PHYSICS:                      28
    RA_LW_PHYSICS:                   4
    RA_SW_PHYSICS:                   4
    SF_SFCLAY_PHYSICS:               1
    SF_SURFACE_PHYSICS:              4
    BL_PBL_PHYSICS:                  1
    CU_PHYSICS:                      0
    SF_LAKE_PHYSICS:                 0
    SURFACE_INPUT_SOURCE:            1
    SST_UPDATE:                      1
    GRID_FDDA:                       0
    GFDDA_INTERVAL_M:                0
    GFDDA_END_H:                     0
    GRID_SFDDA:                      0
    SGFDDA_INTERVAL_M:               0
    SGFDDA_END_H:                    0
    HYPSOMETRIC_OPT:                 2
    USE_THETA_M:                     0
    GWD_OPT:                         0
    SF_URBAN_PHYSICS:                0
    SF_OCEAN_PHYSICS:                0
    SHCU_PHYSICS:                    0
    MFSHCONV:                        0
    FEEDBACK:                        0
    SMOOTH_OPTION:                   2
    SWRAD_SCAT:                      1.0
    W_DAMPING:                       1
    DT:                              5.0
    RADT:                            10.0
    BLDT:                            0.0
    CUDT:                            0.0
    AER_OPT:                         3
    SWINT_OPT:                       0
    AER_TYPE:                        1
    AER_AOD550_OPT:                  1
    AER_ANGEXP_OPT:                  1
    AER_SSA_OPT:                     1
    AER_ASY_OPT:                     1
    AER_AOD550_VAL:                  0.12
    AER_ANGEXP_VAL:                  1.3
    AER_SSA_VAL:                     0.85
    AER_ASY_VAL:                     0.9
    MOIST_ADV_OPT:                   1
    SCALAR_ADV_OPT:                  1
    TKE_ADV_OPT:                     1
    DIFF_6TH_OPT:                    0
    DIFF_6TH_FACTOR:                 0.12
    OBS_NUDGE_OPT:                   0
    BUCKET_MM:                       100.0
    BUCKET_J:                        1000000000.0
    PREC_ACC_DT:                     60.0
    ISFTCFLX:                        0
    ISHALLOW:                        0
    ISFFLX:                          1
    ICLOUD:                          1
    ICLOUD_CU:                       0
    TRACER_PBLMIX:                   1
    SCALAR_PBLMIX:                   1
    YSU_TOPDOWN_PBLMIX:              0
    GRAV_SETTLING:                   0
    OPT_SFC:                         1
    DVEG:                            4
    OPT_CRS:                         1
    OPT_BTR:                         2
    OPT_RUN:                         1
    OPT_FRZ:                         1
    OPT_INF:                         1
    OPT_RAD:                         3
    OPT_ALB:                         2
    OPT_SNF:                         4
    OPT_TBOT:                        1
    OPT_STC:                         1
    OPT_GLA:                         1
    OPT_RSF:                         1
    DFI_OPT:                         0
    SIMULATION_INITIALIZATION_TYPE:  REAL-DATA CASE
    WEST-EAST_PATCH_START_UNSTAG:    1
    WEST-EAST_PATCH_END_UNSTAG:      159
    WEST-EAST_PATCH_START_STAG:      1
    WEST-EAST_PATCH_END_STAG:        160
    SOUTH-NORTH_PATCH_START_UNSTAG:  1
    SOUTH-NORTH_PATCH_END_UNSTAG:    159
    SOUTH-NORTH_PATCH_START_STAG:    1
    SOUTH-NORTH_PATCH_END_STAG:      160
    BOTTOM-TOP_PATCH_START_UNSTAG:   1
    BOTTOM-TOP_PATCH_END_UNSTAG:     50
    BOTTOM-TOP_PATCH_START_STAG:     1
    BOTTOM-TOP_PATCH_END_STAG:       51
    GRID_ID:                         2
    PARENT_ID:                       1
    I_PARENT_START:                  85
    J_PARENT_START:                  89
    PARENT_GRID_RATIO:               3
    CEN_LAT:                         60.36686
    CEN_LON:                         7.049286
    TRUELAT1:                        30.0
    TRUELAT2:                        50.0
    MOAD_CEN_LAT:                    60.0
    STAND_LON:                       5.59998
    POLE_LAT:                        90.0
    POLE_LON:                        0.0
    GMT:                             0.0
    JULYR:                           2014
    JULDAY:                          214
    MAP_PROJ:                        1
    MAP_PROJ_CHAR:                   Lambert Conformal
    MMINLU:                          USGS
    NUM_LAND_CAT:                    28
    ISWATER:                         16
    ISLAKE:                          28
    ISICE:                           24
    ISURBAN:                         1
    ISOILWATER:                      14
    HYBRID_OPT:                      -1
    ETAC:                            0.0
    history:                         Tue Feb  5 11:36:06 2019: ncrcat all_T2_...
    NCO:                             netCDF Operators version 4.7.4 (http://n...
    nco_openmp_thread_number:        1
    history_of_appended_files:       Tue Feb  5 11:36:06 2019: Appended file ...
[10]:
ds_wrf_dropped_Times = ds_wrf_timecoord.drop('Times')
ds_wrf_dropped_Times
[10]:
<xarray.Dataset>
Dimensions:      (south_north: 159, time: 720, west_east: 159)
Coordinates:
  * time         (time) datetime64[ns] 2014-08-01 ... 2014-08-30T23:00:00
Dimensions without coordinates: south_north, west_east
Data variables:
    PREC_ACC_NC  (time, south_north, west_east) float32 ...
    T2           (time, south_north, west_east) float32 ...
    U10          (time, south_north, west_east) float32 ...
    V10          (time, south_north, west_east) float32 ...
Attributes:
    TITLE:                            OUTPUT FROM WRF V3.9 MODEL
    START_DATE:                      2014-08-01_00:00:00
    SIMULATION_START_DATE:           2014-08-01_00:00:00
    WEST-EAST_GRID_DIMENSION:        160
    SOUTH-NORTH_GRID_DIMENSION:      160
    BOTTOM-TOP_GRID_DIMENSION:       51
    DX:                              1000.0
    DY:                              1000.0
    SKEBS_ON:                        0
    SPEC_BDY_FINAL_MU:               1
    USE_Q_DIABATIC:                  0
    GRIDTYPE:                        C
    DIFF_OPT:                        1
    KM_OPT:                          4
    DAMP_OPT:                        3
    DAMPCOEF:                        0.2
    KHDIF:                           0.0
    KVDIF:                           0.0
    MP_PHYSICS:                      28
    RA_LW_PHYSICS:                   4
    RA_SW_PHYSICS:                   4
    SF_SFCLAY_PHYSICS:               1
    SF_SURFACE_PHYSICS:              4
    BL_PBL_PHYSICS:                  1
    CU_PHYSICS:                      0
    SF_LAKE_PHYSICS:                 0
    SURFACE_INPUT_SOURCE:            1
    SST_UPDATE:                      1
    GRID_FDDA:                       0
    GFDDA_INTERVAL_M:                0
    GFDDA_END_H:                     0
    GRID_SFDDA:                      0
    SGFDDA_INTERVAL_M:               0
    SGFDDA_END_H:                    0
    HYPSOMETRIC_OPT:                 2
    USE_THETA_M:                     0
    GWD_OPT:                         0
    SF_URBAN_PHYSICS:                0
    SF_OCEAN_PHYSICS:                0
    SHCU_PHYSICS:                    0
    MFSHCONV:                        0
    FEEDBACK:                        0
    SMOOTH_OPTION:                   2
    SWRAD_SCAT:                      1.0
    W_DAMPING:                       1
    DT:                              5.0
    RADT:                            10.0
    BLDT:                            0.0
    CUDT:                            0.0
    AER_OPT:                         3
    SWINT_OPT:                       0
    AER_TYPE:                        1
    AER_AOD550_OPT:                  1
    AER_ANGEXP_OPT:                  1
    AER_SSA_OPT:                     1
    AER_ASY_OPT:                     1
    AER_AOD550_VAL:                  0.12
    AER_ANGEXP_VAL:                  1.3
    AER_SSA_VAL:                     0.85
    AER_ASY_VAL:                     0.9
    MOIST_ADV_OPT:                   1
    SCALAR_ADV_OPT:                  1
    TKE_ADV_OPT:                     1
    DIFF_6TH_OPT:                    0
    DIFF_6TH_FACTOR:                 0.12
    OBS_NUDGE_OPT:                   0
    BUCKET_MM:                       100.0
    BUCKET_J:                        1000000000.0
    PREC_ACC_DT:                     60.0
    ISFTCFLX:                        0
    ISHALLOW:                        0
    ISFFLX:                          1
    ICLOUD:                          1
    ICLOUD_CU:                       0
    TRACER_PBLMIX:                   1
    SCALAR_PBLMIX:                   1
    YSU_TOPDOWN_PBLMIX:              0
    GRAV_SETTLING:                   0
    OPT_SFC:                         1
    DVEG:                            4
    OPT_CRS:                         1
    OPT_BTR:                         2
    OPT_RUN:                         1
    OPT_FRZ:                         1
    OPT_INF:                         1
    OPT_RAD:                         3
    OPT_ALB:                         2
    OPT_SNF:                         4
    OPT_TBOT:                        1
    OPT_STC:                         1
    OPT_GLA:                         1
    OPT_RSF:                         1
    DFI_OPT:                         0
    SIMULATION_INITIALIZATION_TYPE:  REAL-DATA CASE
    WEST-EAST_PATCH_START_UNSTAG:    1
    WEST-EAST_PATCH_END_UNSTAG:      159
    WEST-EAST_PATCH_START_STAG:      1
    WEST-EAST_PATCH_END_STAG:        160
    SOUTH-NORTH_PATCH_START_UNSTAG:  1
    SOUTH-NORTH_PATCH_END_UNSTAG:    159
    SOUTH-NORTH_PATCH_START_STAG:    1
    SOUTH-NORTH_PATCH_END_STAG:      160
    BOTTOM-TOP_PATCH_START_UNSTAG:   1
    BOTTOM-TOP_PATCH_END_UNSTAG:     50
    BOTTOM-TOP_PATCH_START_STAG:     1
    BOTTOM-TOP_PATCH_END_STAG:       51
    GRID_ID:                         2
    PARENT_ID:                       1
    I_PARENT_START:                  85
    J_PARENT_START:                  89
    PARENT_GRID_RATIO:               3
    CEN_LAT:                         60.36686
    CEN_LON:                         7.049286
    TRUELAT1:                        30.0
    TRUELAT2:                        50.0
    MOAD_CEN_LAT:                    60.0
    STAND_LON:                       5.59998
    POLE_LAT:                        90.0
    POLE_LON:                        0.0
    GMT:                             0.0
    JULYR:                           2014
    JULDAY:                          214
    MAP_PROJ:                        1
    MAP_PROJ_CHAR:                   Lambert Conformal
    MMINLU:                          USGS
    NUM_LAND_CAT:                    28
    ISWATER:                         16
    ISLAKE:                          28
    ISICE:                           24
    ISURBAN:                         1
    ISOILWATER:                      14
    HYBRID_OPT:                      -1
    ETAC:                            0.0
    history:                         Tue Feb  5 11:36:06 2019: ncrcat all_T2_...
    NCO:                             netCDF Operators version 4.7.4 (http://n...
    nco_openmp_thread_number:        1
    history_of_appended_files:       Tue Feb  5 11:36:06 2019: Appended file ...

A tl;dr review of the steps for dealing with WRF time:

da_time = ds_wrf['Times']
time_strs = [str(i.values)[1:].replace("_"," ") for i in da_time]
time_datetime = pd.to_datetime(time_strs)

ds_wrf_timedim = ds_wrf.rename({'Time':'time'})
ds_wrf_timecoord = ds_wrf_timedim.assign(time=time_datetime)
ds_wrf_dropped_Times = ds_wrf_timecoord.drop('Times')

Problem #2: NO COORDINATES

We need to pull in our lat/lon information from a separate geo file.

[11]:
path = DATASETS.fetch("wrfinput_d02")
ds_geo = xr.open_dataset(path)
ds_geo
Downloading file 'wrfinput_d02' from 'ftp://ftp.cgd.ucar.edu/archive/aletheia-data/tutorial-data/wrfinput_d02' to '/home/jovyan/aletheia-data/tutorial-data'.
[11]:
<xarray.Dataset>
Dimensions:               (DIM0009: 5, Time: 1, bottom_top: 50, bottom_top_stag: 51, crop_types_stag: 5, land_cat_stag: 28, num_ext_model_couple_dom_stag: 1, snow_layers_stag: 3, snso_layers_stag: 7, soil_cat_stag: 16, soil_layers_stag: 4, south_north: 159, south_north_stag: 160, west_east: 159, west_east_stag: 160)
Coordinates:
    XLAT                  (Time, south_north, west_east) float32 59.7 ... 61.02
    XLONG                 (Time, south_north, west_east) float32 5.689 ... 8.451
    XLAT_U                (Time, south_north, west_east_stag) float32 59.7 .....
    XLONG_U               (Time, south_north, west_east_stag) float32 5.681 ....
    XLAT_V                (Time, south_north_stag, west_east) float32 59.69 ....
    XLONG_V               (Time, south_north_stag, west_east) float32 5.689 ....
Dimensions without coordinates: DIM0009, Time, bottom_top, bottom_top_stag, crop_types_stag, land_cat_stag, num_ext_model_couple_dom_stag, snow_layers_stag, snso_layers_stag, soil_cat_stag, soil_layers_stag, south_north, south_north_stag, west_east, west_east_stag
Data variables:
    Times                 (Time) |S19 b'2018-06-01_00:00:00'
    LU_INDEX              (Time, south_north, west_east) float32 16.0 ... 8.0
    ZNU                   (Time, bottom_top) float32 0.9969 0.9901 ... 0.0028
    ZNW                   (Time, bottom_top_stag) float32 1.0 0.9938 ... 0.0
    ZS                    (Time, soil_layers_stag) float32 0.05 0.25 0.7 1.5
    DZS                   (Time, soil_layers_stag) float32 0.1 0.3 0.6 1.0
    VAR_SSO               (Time, south_north, west_east) float32 6.669 ... 0.0
    U                     (Time, bottom_top, south_north, west_east_stag) float32 ...
    V                     (Time, bottom_top, south_north_stag, west_east) float32 ...
    W                     (Time, bottom_top_stag, south_north, west_east) float32 ...
    PH                    (Time, bottom_top_stag, south_north, west_east) float32 ...
    PHB                   (Time, bottom_top_stag, south_north, west_east) float32 ...
    T                     (Time, bottom_top, south_north, west_east) float32 ...
    T_INIT                (Time, bottom_top, south_north, west_east) float32 ...
    MU                    (Time, south_north, west_east) float32 1.841e+03 .....
    MUB                   (Time, south_north, west_east) float32 9.5e+04 ... ...
    P                     (Time, bottom_top, south_north, west_east) float32 ...
    PB                    (Time, bottom_top, south_north, west_east) float32 ...
    FNM                   (Time, bottom_top) float32 0.0 0.4562 ... 0.518 0.5495
    FNP                   (Time, bottom_top) float32 0.0 0.5438 ... 0.482 0.4505
    RDNW                  (Time, bottom_top) float32 -161.6 -135.5 ... -178.6
    RDN                   (Time, bottom_top) float32 0.0 -147.4 ... -160.9
    DNW                   (Time, bottom_top) float32 -0.00619 ... -0.0056
    DN                    (Time, bottom_top) float32 0.0 -0.006785 ... -0.006215
    T_BASE                (Time, bottom_top) float32 0.0 0.0 0.0 ... 0.0 0.0 0.0
    CFN                   (Time) float32 1.451
    CFN1                  (Time) float32 -0.4505
    STEP_NUMBER           (Time) int32 0
    THIS_IS_AN_IDEAL_RUN  (Time) int32 0
    P_HYD                 (Time, bottom_top, south_north, west_east) float32 ...
    Q2                    (Time, south_north, west_east) float32 0.007971 ......
    T2                    (Time, south_north, west_east) float32 287.5 ... 283.1
    TH2                   (Time, south_north, west_east) float32 285.8 ... 298.2
    PSFC                  (Time, south_north, west_east) float32 1.02e+05 ......
    U10                   (Time, south_north, west_east) float32 -2.161 ... 1...
    V10                   (Time, south_north, west_east) float32 0.9965 ... -...
    RDX                   (Time) float32 0.001
    RDY                   (Time) float32 0.001
    DTS                   (Time) float32 0.0
    DTSEPS                (Time) float32 0.0
    RESM                  (Time) float32 0.0
    ZETATOP               (Time) float32 0.0
    CF1                   (Time) float32 1.876
    CF2                   (Time) float32 -1.232
    CF3                   (Time) float32 0.3568
    QVAPOR                (Time, bottom_top, south_north, west_east) float32 ...
    QCLOUD                (Time, bottom_top, south_north, west_east) float32 ...
    QRAIN                 (Time, bottom_top, south_north, west_east) float32 ...
    QICE                  (Time, bottom_top, south_north, west_east) float32 ...
    QSNOW                 (Time, bottom_top, south_north, west_east) float32 ...
    QGRAUP                (Time, bottom_top, south_north, west_east) float32 ...
    QNICE                 (Time, bottom_top, south_north, west_east) float32 ...
    QNRAIN                (Time, bottom_top, south_north, west_east) float32 ...
    QNCLOUD               (Time, bottom_top, south_north, west_east) float32 ...
    QNWFA                 (Time, bottom_top, south_north, west_east) float32 ...
    QNIFA                 (Time, bottom_top, south_north, west_east) float32 ...
    FCX                   (Time, DIM0009) float32 0.0 0.0 0.0 0.0 0.0
    GCX                   (Time, DIM0009) float32 0.0 0.0 0.0 0.0 0.0
    DTBC                  (Time) float32 0.0
    TOPOSLPX              (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    TOPOSLPY              (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    SHDMAX                (Time, south_north, west_east) float32 0.0 ... 0.03906
    SHDMIN                (Time, south_north, west_east) float32 0.0 ... 0.03906
    SNOALB                (Time, south_north, west_east) float32 0.08 ... 0.6017
    LANDUSEF              (Time, land_cat_stag, south_north, west_east) float32 ...
    SOILCTOP              (Time, soil_cat_stag, south_north, west_east) float32 ...
    SOILCBOT              (Time, soil_cat_stag, south_north, west_east) float32 ...
    TSLB                  (Time, soil_layers_stag, south_north, west_east) float32 ...
    SMOIS                 (Time, soil_layers_stag, south_north, west_east) float32 ...
    SH2O                  (Time, soil_layers_stag, south_north, west_east) float32 ...
    SEAICE                (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    IVGTYP                (Time, south_north, west_east) int32 16 16 16 ... 8 8
    ISLTYP                (Time, south_north, west_east) int32 14 14 14 ... 3 3
    VEGFRA                (Time, south_north, west_east) float32 0.0 ... 0.03906
    SNOW                  (Time, south_north, west_east) float32 0.0 ... 1.647
    SNOWH                 (Time, south_north, west_east) float32 0.0 ... 0.00...
    CANWAT                (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    FNDSNOWH              (Time) int32 1
    FNDSOILW              (Time) int32 1
    FNDALBSI              (Time) int32 0
    FNDSNOWSI             (Time) int32 0
    FNDICEDEPTH           (Time) int32 0
    LAKE_DEPTH            (Time, south_north, west_east) float32 10.0 ... 10.0
    UOCE                  (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    VOCE                  (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    FRC_URB2D             (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    LAI                   (Time, south_north, west_east) float32 0.0 ... 0.695
    VAR                   (Time, south_north, west_east) float32 0.0 ... 213.5
    O3RAD                 (Time, bottom_top, south_north, west_east) float32 ...
    MAPFAC_M              (Time, south_north, west_east) float32 1.052 ... 1.063
    MAPFAC_U              (Time, south_north, west_east_stag) float32 1.052 ....
    MAPFAC_V              (Time, south_north_stag, west_east) float32 1.052 ....
    MAPFAC_MX             (Time, south_north, west_east) float32 1.052 ... 1.063
    MAPFAC_MY             (Time, south_north, west_east) float32 1.052 ... 1.063
    MAPFAC_UX             (Time, south_north, west_east_stag) float32 1.052 ....
    MAPFAC_UY             (Time, south_north, west_east_stag) float32 1.052 ....
    MAPFAC_VX             (Time, south_north_stag, west_east) float32 1.052 ....
    MF_VX_INV             (Time, south_north_stag, west_east) float32 0.9503 ...
    MAPFAC_VY             (Time, south_north_stag, west_east) float32 1.052 ....
    F                     (Time, south_north, west_east) float32 0.0001259 .....
    E                     (Time, south_north, west_east) float32 7.358e-05 .....
    SINALPHA              (Time, south_north, west_east) float32 -0.0009012 ....
    COSALPHA              (Time, south_north, west_east) float32 1.0 ... 0.9995
    HGT                   (Time, south_north, west_east) float32 0.0 ... 1.67...
    TSK                   (Time, south_north, west_east) float32 286.8 ... 277.7
    U_BASE                (Time, bottom_top) float32 0.0 0.0 0.0 ... 0.0 0.0 0.0
    V_BASE                (Time, bottom_top) float32 0.0 0.0 0.0 ... 0.0 0.0 0.0
    QV_BASE               (Time, bottom_top) float32 0.0 0.0 0.0 ... 0.0 0.0 0.0
    Z_BASE                (Time, bottom_top) float32 0.0 0.0 0.0 ... 0.0 0.0 0.0
    U_FRAME               (Time) float32 0.0
    V_FRAME               (Time) float32 0.0
    P_TOP                 (Time) float32 5e+03
    GOT_VAR_SSO           (Time) int32 1
    LAT_LL_T              (Time) float32 0.0
    LAT_UL_T              (Time) float32 0.0
    LAT_UR_T              (Time) float32 0.0
    LAT_LR_T              (Time) float32 0.0
    LAT_LL_U              (Time) float32 0.0
    LAT_UL_U              (Time) float32 0.0
    LAT_UR_U              (Time) float32 0.0
    LAT_LR_U              (Time) float32 0.0
    LAT_LL_V              (Time) float32 0.0
    LAT_UL_V              (Time) float32 0.0
    LAT_UR_V              (Time) float32 0.0
    LAT_LR_V              (Time) float32 0.0
    LAT_LL_D              (Time) float32 0.0
    LAT_UL_D              (Time) float32 0.0
    LAT_UR_D              (Time) float32 0.0
    LAT_LR_D              (Time) float32 0.0
    LON_LL_T              (Time) float32 0.0
    LON_UL_T              (Time) float32 0.0
    LON_UR_T              (Time) float32 0.0
    LON_LR_T              (Time) float32 0.0
    LON_LL_U              (Time) float32 0.0
    LON_UL_U              (Time) float32 0.0
    LON_UR_U              (Time) float32 0.0
    LON_LR_U              (Time) float32 0.0
    LON_LL_V              (Time) float32 0.0
    LON_UL_V              (Time) float32 0.0
    LON_UR_V              (Time) float32 0.0
    LON_LR_V              (Time) float32 0.0
    LON_LL_D              (Time) float32 0.0
    LON_UL_D              (Time) float32 0.0
    LON_UR_D              (Time) float32 0.0
    LON_LR_D              (Time) float32 0.0
    T00                   (Time) float32 290.0
    P00                   (Time) float32 1e+05
    TLP                   (Time) float32 50.0
    TISO                  (Time) float32 200.0
    TLP_STRAT             (Time) float32 -11.0
    P_STRAT               (Time) float32 0.0
    CLAT                  (Time, south_north, west_east) float32 59.7 ... 61.02
    ALBBCK                (Time, south_north, west_east) float32 0.08 ... 0.1187
    ISNOW                 (Time, south_north, west_east) int32 0 0 0 0 ... 0 0 0
    TV                    (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    TG                    (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    CANICE                (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    CANLIQ                (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    EAH                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    TAH                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    CM                    (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    CH                    (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    FWET                  (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    SNEQVO                (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    ALBOLD                (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    QSNOWXY               (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    WSLAKE                (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    ZWT                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    WA                    (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    WT                    (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    TSNO                  (Time, snow_layers_stag, south_north, west_east) float32 ...
    ZSNSO                 (Time, snso_layers_stag, south_north, west_east) float32 ...
    SNICE                 (Time, snow_layers_stag, south_north, west_east) float32 ...
    SNLIQ                 (Time, snow_layers_stag, south_north, west_east) float32 ...
    LFMASS                (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    RTMASS                (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    STMASS                (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    WOOD                  (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    STBLCP                (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    FASTCP                (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    XSAI                  (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    T2V                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    T2B                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    Q2V                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    Q2B                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    TRAD                  (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    NEE                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    GPP                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    NPP                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    FVEG                  (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    QIN                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    RUNSF                 (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    RUNSB                 (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    ECAN                  (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    EDIR                  (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    ETRAN                 (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    FSA                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    FIRA                  (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    APAR                  (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    PSN                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    SAV                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    SAG                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    RSSUN                 (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    RSSHA                 (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    BGAP                  (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    WGAP                  (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    TGV                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    TGB                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    CHV                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    CHB                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    SHG                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    SHC                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    SHB                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    EVG                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    EVB                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    GHV                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    GHB                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    IRG                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    IRC                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    IRB                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    TR                    (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    EVC                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    CHLEAF                (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    CHUC                  (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    CHV2                  (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    CHB2                  (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    CHSTAR                (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    FDEPTH                (Time, south_north, west_east) float32 100.0 ... 2.985
    EQZWT                 (Time, south_north, west_east) float32 0.0 ... -43.26
    RECHCLIM              (Time, south_north, west_east) float32 -1.0 ... 46.78
    RIVERMASK             (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    RIVERBED              (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    NONRIVER              (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    GRAIN                 (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    GDD                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    CROPTYPE              (Time, crop_types_stag, south_north, west_east) float32 ...
    PLANTING              (Time, south_north, west_east) float32 126.0 ... 126.0
    HARVEST               (Time, south_north, west_east) float32 290.0 ... 290.0
    SEASON_GDD            (Time, south_north, west_east) float32 1.605e+03 .....
    TMN                   (Time, south_north, west_east) float32 286.8 ... 268.0
    XLAND                 (Time, south_north, west_east) float32 2.0 2.0 ... 1.0
    CPLMASK               (Time, num_ext_model_couple_dom_stag, south_north, west_east) float32 ...
    SNOWC                 (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    SR                    (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    SAVE_TOPO_FROM_REAL   (Time) int32 1
    LAKEFLAG              (Time) int32 1
    LAKE_DEPTH_FLAG       (Time) int32 0
    BF                    (Time, bottom_top_stag) float32 0.0 0.0 ... 0.0 0.0
    C1H                   (Time, bottom_top) float32 1.0 1.0 1.0 ... 1.0 1.0 1.0
    C2H                   (Time, bottom_top) float32 0.0 0.0 0.0 ... 0.0 0.0 0.0
    BH                    (Time, bottom_top) float32 0.0 0.0 0.0 ... 0.0 0.0 0.0
    C1F                   (Time, bottom_top_stag) float32 1.0 1.0 ... 1.0 1.0
    C2F                   (Time, bottom_top_stag) float32 0.0 0.0 ... 0.0 0.0
    C3H                   (Time, bottom_top) float32 0.9969 0.9901 ... 0.0028
    C4H                   (Time, bottom_top) float32 0.0 0.0 0.0 ... 0.0 0.0 0.0
    C3F                   (Time, bottom_top_stag) float32 1.0 0.9938 ... 0.0
    C4F                   (Time, bottom_top_stag) float32 0.0 0.0 ... 0.0 0.0
    PCB                   (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    PC                    (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    LANDMASK              (Time, south_north, west_east) float32 0.0 0.0 ... 1.0
    LAKEMASK              (Time, south_north, west_east) float32 0.0 0.0 ... 0.0
    SST                   (Time, south_north, west_east) float32 286.8 ... 283.1
Attributes:
    TITLE:                            OUTPUT FROM REAL_EM V3.9 PREPROCESSOR
    START_DATE:                      2018-06-01_00:00:00
    SIMULATION_START_DATE:           2018-06-01_00:00:00
    WEST-EAST_GRID_DIMENSION:        160
    SOUTH-NORTH_GRID_DIMENSION:      160
    BOTTOM-TOP_GRID_DIMENSION:       51
    DX:                              1000.0
    DY:                              1000.0
    GRIDTYPE:                        C
    DIFF_OPT:                        1
    KM_OPT:                          4
    DAMP_OPT:                        3
    DAMPCOEF:                        0.2
    KHDIF:                           0.0
    KVDIF:                           0.0
    MP_PHYSICS:                      28
    RA_LW_PHYSICS:                   4
    RA_SW_PHYSICS:                   4
    SF_SFCLAY_PHYSICS:               1
    SF_SURFACE_PHYSICS:              4
    BL_PBL_PHYSICS:                  1
    CU_PHYSICS:                      0
    SF_LAKE_PHYSICS:                 0
    SURFACE_INPUT_SOURCE:            1
    SST_UPDATE:                      1
    GRID_FDDA:                       0
    GFDDA_INTERVAL_M:                0
    GFDDA_END_H:                     0
    GRID_SFDDA:                      0
    SGFDDA_INTERVAL_M:               0
    SGFDDA_END_H:                    0
    HYPSOMETRIC_OPT:                 2
    USE_THETA_M:                     0
    USE_MAXW_LEVEL:                  0
    USE_TROP_LEVEL:                  0
    GWD_OPT:                         0
    SF_URBAN_PHYSICS:                0
    SF_OCEAN_PHYSICS:                0
    SIMULATION_INITIALIZATION_TYPE:  REAL-DATA CASE
    WEST-EAST_PATCH_START_UNSTAG:    1
    WEST-EAST_PATCH_END_UNSTAG:      159
    WEST-EAST_PATCH_START_STAG:      1
    WEST-EAST_PATCH_END_STAG:        160
    SOUTH-NORTH_PATCH_START_UNSTAG:  1
    SOUTH-NORTH_PATCH_END_UNSTAG:    159
    SOUTH-NORTH_PATCH_START_STAG:    1
    SOUTH-NORTH_PATCH_END_STAG:      160
    BOTTOM-TOP_PATCH_START_UNSTAG:   1
    BOTTOM-TOP_PATCH_END_UNSTAG:     50
    BOTTOM-TOP_PATCH_START_STAG:     1
    BOTTOM-TOP_PATCH_END_STAG:       51
    GRID_ID:                         2
    PARENT_ID:                       1
    I_PARENT_START:                  85
    J_PARENT_START:                  89
    PARENT_GRID_RATIO:               3
    DT:                              5.0
    CEN_LAT:                         60.36686
    CEN_LON:                         7.049286
    TRUELAT1:                        30.0
    TRUELAT2:                        50.0
    MOAD_CEN_LAT:                    60.0
    STAND_LON:                       5.59998
    POLE_LAT:                        90.0
    POLE_LON:                        0.0
    GMT:                             0.0
    JULYR:                           2018
    JULDAY:                          152
    MAP_PROJ:                        1
    MAP_PROJ_CHAR:                   Lambert Conformal
    MMINLU:                          USGS
    NUM_LAND_CAT:                    28
    ISWATER:                         16
    ISLAKE:                          28
    ISICE:                           24
    ISURBAN:                         1
    ISOILWATER:                      14
    HYBRID_OPT:                      -1
    ETAC:                            0.0

What are our coordinates here? - XLAT and XLONG – these are our Latitude and Longitude values - XLAT_U and XLONG_U – Lat and Long with a staggered west-east grid - XLAT_V and XLONG_V – Lat and Long with a staggered north-south grid

We’re going to use XLAT and XLONG.

[12]:
ds_geo.coords['XLAT']
[12]:
<xarray.DataArray 'XLAT' (Time: 1, south_north: 159, west_east: 159)>
array([[[59.699203, 59.699192, ..., 59.677734, 59.677475],
        [59.707745, 59.707737, ..., 59.68627 , 59.686012],
        ...,
        [61.03416 , 61.034157, ..., 61.012253, 61.01199 ],
        [61.042618, 61.04261 , ..., 61.020718, 61.020447]]], dtype=float32)
Coordinates:
    XLAT     (Time, south_north, west_east) float32 59.7 59.7 ... 61.02 61.02
    XLONG    (Time, south_north, west_east) float32 5.689 5.706 ... 8.433 8.451
Dimensions without coordinates: Time, south_north, west_east
Attributes:
    FieldType:    104
    MemoryOrder:  XY
    description:  LATITUDE, SOUTH IS NEGATIVE
    units:        degree_north
    stagger:      

XLAT and XLONG have 3 dimensions (a unit dimension Time which we will squeeze out, south_north which we will rename y, west_east which we will rename x).

If we assign the coords as is:

ds_wrf_w_latlon = ds_wrf.assign_coords(lat=ds_geo.coords['XLAT'], lon=ds_geo.coords['XLONG'])

we get the error:

ValueError: conflicting sizes for dimension 'Time': length 1 on 'XLAT' and length 38375 on 'PREC_ACC_NC'

So we remote the unit dimension Time with .squeeze

[13]:
ds_wrf_w_latlon = ds_wrf_dropped_Times.assign_coords(lat=ds_geo.coords['XLAT'].squeeze('Time'), lon=ds_geo.coords['XLONG'].squeeze('Time'))
ds_wrf_w_latlon
[13]:
<xarray.Dataset>
Dimensions:      (south_north: 159, time: 720, west_east: 159)
Coordinates:
  * time         (time) datetime64[ns] 2014-08-01 ... 2014-08-30T23:00:00
    XLAT         (south_north, west_east) float32 59.7 59.7 59.7 ... 61.02 61.02
    XLONG        (south_north, west_east) float32 5.689 5.706 ... 8.433 8.451
    lat          (south_north, west_east) float32 59.7 59.7 59.7 ... 61.02 61.02
    lon          (south_north, west_east) float32 5.689 5.706 ... 8.433 8.451
Dimensions without coordinates: south_north, west_east
Data variables:
    PREC_ACC_NC  (time, south_north, west_east) float32 ...
    T2           (time, south_north, west_east) float32 ...
    U10          (time, south_north, west_east) float32 ...
    V10          (time, south_north, west_east) float32 ...
Attributes:
    TITLE:                            OUTPUT FROM WRF V3.9 MODEL
    START_DATE:                      2014-08-01_00:00:00
    SIMULATION_START_DATE:           2014-08-01_00:00:00
    WEST-EAST_GRID_DIMENSION:        160
    SOUTH-NORTH_GRID_DIMENSION:      160
    BOTTOM-TOP_GRID_DIMENSION:       51
    DX:                              1000.0
    DY:                              1000.0
    SKEBS_ON:                        0
    SPEC_BDY_FINAL_MU:               1
    USE_Q_DIABATIC:                  0
    GRIDTYPE:                        C
    DIFF_OPT:                        1
    KM_OPT:                          4
    DAMP_OPT:                        3
    DAMPCOEF:                        0.2
    KHDIF:                           0.0
    KVDIF:                           0.0
    MP_PHYSICS:                      28
    RA_LW_PHYSICS:                   4
    RA_SW_PHYSICS:                   4
    SF_SFCLAY_PHYSICS:               1
    SF_SURFACE_PHYSICS:              4
    BL_PBL_PHYSICS:                  1
    CU_PHYSICS:                      0
    SF_LAKE_PHYSICS:                 0
    SURFACE_INPUT_SOURCE:            1
    SST_UPDATE:                      1
    GRID_FDDA:                       0
    GFDDA_INTERVAL_M:                0
    GFDDA_END_H:                     0
    GRID_SFDDA:                      0
    SGFDDA_INTERVAL_M:               0
    SGFDDA_END_H:                    0
    HYPSOMETRIC_OPT:                 2
    USE_THETA_M:                     0
    GWD_OPT:                         0
    SF_URBAN_PHYSICS:                0
    SF_OCEAN_PHYSICS:                0
    SHCU_PHYSICS:                    0
    MFSHCONV:                        0
    FEEDBACK:                        0
    SMOOTH_OPTION:                   2
    SWRAD_SCAT:                      1.0
    W_DAMPING:                       1
    DT:                              5.0
    RADT:                            10.0
    BLDT:                            0.0
    CUDT:                            0.0
    AER_OPT:                         3
    SWINT_OPT:                       0
    AER_TYPE:                        1
    AER_AOD550_OPT:                  1
    AER_ANGEXP_OPT:                  1
    AER_SSA_OPT:                     1
    AER_ASY_OPT:                     1
    AER_AOD550_VAL:                  0.12
    AER_ANGEXP_VAL:                  1.3
    AER_SSA_VAL:                     0.85
    AER_ASY_VAL:                     0.9
    MOIST_ADV_OPT:                   1
    SCALAR_ADV_OPT:                  1
    TKE_ADV_OPT:                     1
    DIFF_6TH_OPT:                    0
    DIFF_6TH_FACTOR:                 0.12
    OBS_NUDGE_OPT:                   0
    BUCKET_MM:                       100.0
    BUCKET_J:                        1000000000.0
    PREC_ACC_DT:                     60.0
    ISFTCFLX:                        0
    ISHALLOW:                        0
    ISFFLX:                          1
    ICLOUD:                          1
    ICLOUD_CU:                       0
    TRACER_PBLMIX:                   1
    SCALAR_PBLMIX:                   1
    YSU_TOPDOWN_PBLMIX:              0
    GRAV_SETTLING:                   0
    OPT_SFC:                         1
    DVEG:                            4
    OPT_CRS:                         1
    OPT_BTR:                         2
    OPT_RUN:                         1
    OPT_FRZ:                         1
    OPT_INF:                         1
    OPT_RAD:                         3
    OPT_ALB:                         2
    OPT_SNF:                         4
    OPT_TBOT:                        1
    OPT_STC:                         1
    OPT_GLA:                         1
    OPT_RSF:                         1
    DFI_OPT:                         0
    SIMULATION_INITIALIZATION_TYPE:  REAL-DATA CASE
    WEST-EAST_PATCH_START_UNSTAG:    1
    WEST-EAST_PATCH_END_UNSTAG:      159
    WEST-EAST_PATCH_START_STAG:      1
    WEST-EAST_PATCH_END_STAG:        160
    SOUTH-NORTH_PATCH_START_UNSTAG:  1
    SOUTH-NORTH_PATCH_END_UNSTAG:    159
    SOUTH-NORTH_PATCH_START_STAG:    1
    SOUTH-NORTH_PATCH_END_STAG:      160
    BOTTOM-TOP_PATCH_START_UNSTAG:   1
    BOTTOM-TOP_PATCH_END_UNSTAG:     50
    BOTTOM-TOP_PATCH_START_STAG:     1
    BOTTOM-TOP_PATCH_END_STAG:       51
    GRID_ID:                         2
    PARENT_ID:                       1
    I_PARENT_START:                  85
    J_PARENT_START:                  89
    PARENT_GRID_RATIO:               3
    CEN_LAT:                         60.36686
    CEN_LON:                         7.049286
    TRUELAT1:                        30.0
    TRUELAT2:                        50.0
    MOAD_CEN_LAT:                    60.0
    STAND_LON:                       5.59998
    POLE_LAT:                        90.0
    POLE_LON:                        0.0
    GMT:                             0.0
    JULYR:                           2014
    JULDAY:                          214
    MAP_PROJ:                        1
    MAP_PROJ_CHAR:                   Lambert Conformal
    MMINLU:                          USGS
    NUM_LAND_CAT:                    28
    ISWATER:                         16
    ISLAKE:                          28
    ISICE:                           24
    ISURBAN:                         1
    ISOILWATER:                      14
    HYBRID_OPT:                      -1
    ETAC:                            0.0
    history:                         Tue Feb  5 11:36:06 2019: ncrcat all_T2_...
    NCO:                             netCDF Operators version 4.7.4 (http://n...
    nco_openmp_thread_number:        1
    history_of_appended_files:       Tue Feb  5 11:36:06 2019: Appended file ...
[14]:
da_land = ds_geo.LANDMASK.squeeze('Time')
da_lake = ds_geo.LAKEMASK.squeeze('Time')

ds_wrf_w_masks = ds_wrf_w_latlon.assign_coords(landmask=da_land, lakemask=da_lake)
ds_wrf_w_masks
[14]:
<xarray.Dataset>
Dimensions:      (south_north: 159, time: 720, west_east: 159)
Coordinates:
  * time         (time) datetime64[ns] 2014-08-01 ... 2014-08-30T23:00:00
    XLAT         (south_north, west_east) float32 59.7 59.7 59.7 ... 61.02 61.02
    XLONG        (south_north, west_east) float32 5.689 5.706 ... 8.433 8.451
    lat          (south_north, west_east) float32 59.7 59.7 59.7 ... 61.02 61.02
    lon          (south_north, west_east) float32 5.689 5.706 ... 8.433 8.451
    landmask     (south_north, west_east) float32 0.0 0.0 0.0 ... 1.0 1.0 1.0
    lakemask     (south_north, west_east) float32 0.0 0.0 0.0 ... 0.0 0.0 0.0
Dimensions without coordinates: south_north, west_east
Data variables:
    PREC_ACC_NC  (time, south_north, west_east) float32 ...
    T2           (time, south_north, west_east) float32 ...
    U10          (time, south_north, west_east) float32 ...
    V10          (time, south_north, west_east) float32 ...
Attributes:
    TITLE:                            OUTPUT FROM WRF V3.9 MODEL
    START_DATE:                      2014-08-01_00:00:00
    SIMULATION_START_DATE:           2014-08-01_00:00:00
    WEST-EAST_GRID_DIMENSION:        160
    SOUTH-NORTH_GRID_DIMENSION:      160
    BOTTOM-TOP_GRID_DIMENSION:       51
    DX:                              1000.0
    DY:                              1000.0
    SKEBS_ON:                        0
    SPEC_BDY_FINAL_MU:               1
    USE_Q_DIABATIC:                  0
    GRIDTYPE:                        C
    DIFF_OPT:                        1
    KM_OPT:                          4
    DAMP_OPT:                        3
    DAMPCOEF:                        0.2
    KHDIF:                           0.0
    KVDIF:                           0.0
    MP_PHYSICS:                      28
    RA_LW_PHYSICS:                   4
    RA_SW_PHYSICS:                   4
    SF_SFCLAY_PHYSICS:               1
    SF_SURFACE_PHYSICS:              4
    BL_PBL_PHYSICS:                  1
    CU_PHYSICS:                      0
    SF_LAKE_PHYSICS:                 0
    SURFACE_INPUT_SOURCE:            1
    SST_UPDATE:                      1
    GRID_FDDA:                       0
    GFDDA_INTERVAL_M:                0
    GFDDA_END_H:                     0
    GRID_SFDDA:                      0
    SGFDDA_INTERVAL_M:               0
    SGFDDA_END_H:                    0
    HYPSOMETRIC_OPT:                 2
    USE_THETA_M:                     0
    GWD_OPT:                         0
    SF_URBAN_PHYSICS:                0
    SF_OCEAN_PHYSICS:                0
    SHCU_PHYSICS:                    0
    MFSHCONV:                        0
    FEEDBACK:                        0
    SMOOTH_OPTION:                   2
    SWRAD_SCAT:                      1.0
    W_DAMPING:                       1
    DT:                              5.0
    RADT:                            10.0
    BLDT:                            0.0
    CUDT:                            0.0
    AER_OPT:                         3
    SWINT_OPT:                       0
    AER_TYPE:                        1
    AER_AOD550_OPT:                  1
    AER_ANGEXP_OPT:                  1
    AER_SSA_OPT:                     1
    AER_ASY_OPT:                     1
    AER_AOD550_VAL:                  0.12
    AER_ANGEXP_VAL:                  1.3
    AER_SSA_VAL:                     0.85
    AER_ASY_VAL:                     0.9
    MOIST_ADV_OPT:                   1
    SCALAR_ADV_OPT:                  1
    TKE_ADV_OPT:                     1
    DIFF_6TH_OPT:                    0
    DIFF_6TH_FACTOR:                 0.12
    OBS_NUDGE_OPT:                   0
    BUCKET_MM:                       100.0
    BUCKET_J:                        1000000000.0
    PREC_ACC_DT:                     60.0
    ISFTCFLX:                        0
    ISHALLOW:                        0
    ISFFLX:                          1
    ICLOUD:                          1
    ICLOUD_CU:                       0
    TRACER_PBLMIX:                   1
    SCALAR_PBLMIX:                   1
    YSU_TOPDOWN_PBLMIX:              0
    GRAV_SETTLING:                   0
    OPT_SFC:                         1
    DVEG:                            4
    OPT_CRS:                         1
    OPT_BTR:                         2
    OPT_RUN:                         1
    OPT_FRZ:                         1
    OPT_INF:                         1
    OPT_RAD:                         3
    OPT_ALB:                         2
    OPT_SNF:                         4
    OPT_TBOT:                        1
    OPT_STC:                         1
    OPT_GLA:                         1
    OPT_RSF:                         1
    DFI_OPT:                         0
    SIMULATION_INITIALIZATION_TYPE:  REAL-DATA CASE
    WEST-EAST_PATCH_START_UNSTAG:    1
    WEST-EAST_PATCH_END_UNSTAG:      159
    WEST-EAST_PATCH_START_STAG:      1
    WEST-EAST_PATCH_END_STAG:        160
    SOUTH-NORTH_PATCH_START_UNSTAG:  1
    SOUTH-NORTH_PATCH_END_UNSTAG:    159
    SOUTH-NORTH_PATCH_START_STAG:    1
    SOUTH-NORTH_PATCH_END_STAG:      160
    BOTTOM-TOP_PATCH_START_UNSTAG:   1
    BOTTOM-TOP_PATCH_END_UNSTAG:     50
    BOTTOM-TOP_PATCH_START_STAG:     1
    BOTTOM-TOP_PATCH_END_STAG:       51
    GRID_ID:                         2
    PARENT_ID:                       1
    I_PARENT_START:                  85
    J_PARENT_START:                  89
    PARENT_GRID_RATIO:               3
    CEN_LAT:                         60.36686
    CEN_LON:                         7.049286
    TRUELAT1:                        30.0
    TRUELAT2:                        50.0
    MOAD_CEN_LAT:                    60.0
    STAND_LON:                       5.59998
    POLE_LAT:                        90.0
    POLE_LON:                        0.0
    GMT:                             0.0
    JULYR:                           2014
    JULDAY:                          214
    MAP_PROJ:                        1
    MAP_PROJ_CHAR:                   Lambert Conformal
    MMINLU:                          USGS
    NUM_LAND_CAT:                    28
    ISWATER:                         16
    ISLAKE:                          28
    ISICE:                           24
    ISURBAN:                         1
    ISOILWATER:                      14
    HYBRID_OPT:                      -1
    ETAC:                            0.0
    history:                         Tue Feb  5 11:36:06 2019: ncrcat all_T2_...
    NCO:                             netCDF Operators version 4.7.4 (http://n...
    nco_openmp_thread_number:        1
    history_of_appended_files:       Tue Feb  5 11:36:06 2019: Appended file ...

To follow conventions let’s rename south_north to y and west_east to x.

[15]:
ds_wrf_rename_latlon = ds_wrf_w_masks.rename({'south_north':'y', 'west_east':'x'})
ds_wrf_rename_latlon
[15]:
<xarray.Dataset>
Dimensions:      (time: 720, x: 159, y: 159)
Coordinates:
  * time         (time) datetime64[ns] 2014-08-01 ... 2014-08-30T23:00:00
    XLAT         (y, x) float32 59.7 59.7 59.7 59.7 ... 61.02 61.02 61.02 61.02
    XLONG        (y, x) float32 5.689 5.706 5.723 5.74 ... 8.416 8.433 8.451
    lat          (y, x) float32 59.7 59.7 59.7 59.7 ... 61.02 61.02 61.02 61.02
    lon          (y, x) float32 5.689 5.706 5.723 5.74 ... 8.416 8.433 8.451
    landmask     (y, x) float32 0.0 0.0 0.0 0.0 0.0 0.0 ... 1.0 1.0 1.0 1.0 1.0
    lakemask     (y, x) float32 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0
Dimensions without coordinates: x, y
Data variables:
    PREC_ACC_NC  (time, y, x) float32 ...
    T2           (time, y, x) float32 ...
    U10          (time, y, x) float32 ...
    V10          (time, y, x) float32 ...
Attributes:
    TITLE:                            OUTPUT FROM WRF V3.9 MODEL
    START_DATE:                      2014-08-01_00:00:00
    SIMULATION_START_DATE:           2014-08-01_00:00:00
    WEST-EAST_GRID_DIMENSION:        160
    SOUTH-NORTH_GRID_DIMENSION:      160
    BOTTOM-TOP_GRID_DIMENSION:       51
    DX:                              1000.0
    DY:                              1000.0
    SKEBS_ON:                        0
    SPEC_BDY_FINAL_MU:               1
    USE_Q_DIABATIC:                  0
    GRIDTYPE:                        C
    DIFF_OPT:                        1
    KM_OPT:                          4
    DAMP_OPT:                        3
    DAMPCOEF:                        0.2
    KHDIF:                           0.0
    KVDIF:                           0.0
    MP_PHYSICS:                      28
    RA_LW_PHYSICS:                   4
    RA_SW_PHYSICS:                   4
    SF_SFCLAY_PHYSICS:               1
    SF_SURFACE_PHYSICS:              4
    BL_PBL_PHYSICS:                  1
    CU_PHYSICS:                      0
    SF_LAKE_PHYSICS:                 0
    SURFACE_INPUT_SOURCE:            1
    SST_UPDATE:                      1
    GRID_FDDA:                       0
    GFDDA_INTERVAL_M:                0
    GFDDA_END_H:                     0
    GRID_SFDDA:                      0
    SGFDDA_INTERVAL_M:               0
    SGFDDA_END_H:                    0
    HYPSOMETRIC_OPT:                 2
    USE_THETA_M:                     0
    GWD_OPT:                         0
    SF_URBAN_PHYSICS:                0
    SF_OCEAN_PHYSICS:                0
    SHCU_PHYSICS:                    0
    MFSHCONV:                        0
    FEEDBACK:                        0
    SMOOTH_OPTION:                   2
    SWRAD_SCAT:                      1.0
    W_DAMPING:                       1
    DT:                              5.0
    RADT:                            10.0
    BLDT:                            0.0
    CUDT:                            0.0
    AER_OPT:                         3
    SWINT_OPT:                       0
    AER_TYPE:                        1
    AER_AOD550_OPT:                  1
    AER_ANGEXP_OPT:                  1
    AER_SSA_OPT:                     1
    AER_ASY_OPT:                     1
    AER_AOD550_VAL:                  0.12
    AER_ANGEXP_VAL:                  1.3
    AER_SSA_VAL:                     0.85
    AER_ASY_VAL:                     0.9
    MOIST_ADV_OPT:                   1
    SCALAR_ADV_OPT:                  1
    TKE_ADV_OPT:                     1
    DIFF_6TH_OPT:                    0
    DIFF_6TH_FACTOR:                 0.12
    OBS_NUDGE_OPT:                   0
    BUCKET_MM:                       100.0
    BUCKET_J:                        1000000000.0
    PREC_ACC_DT:                     60.0
    ISFTCFLX:                        0
    ISHALLOW:                        0
    ISFFLX:                          1
    ICLOUD:                          1
    ICLOUD_CU:                       0
    TRACER_PBLMIX:                   1
    SCALAR_PBLMIX:                   1
    YSU_TOPDOWN_PBLMIX:              0
    GRAV_SETTLING:                   0
    OPT_SFC:                         1
    DVEG:                            4
    OPT_CRS:                         1
    OPT_BTR:                         2
    OPT_RUN:                         1
    OPT_FRZ:                         1
    OPT_INF:                         1
    OPT_RAD:                         3
    OPT_ALB:                         2
    OPT_SNF:                         4
    OPT_TBOT:                        1
    OPT_STC:                         1
    OPT_GLA:                         1
    OPT_RSF:                         1
    DFI_OPT:                         0
    SIMULATION_INITIALIZATION_TYPE:  REAL-DATA CASE
    WEST-EAST_PATCH_START_UNSTAG:    1
    WEST-EAST_PATCH_END_UNSTAG:      159
    WEST-EAST_PATCH_START_STAG:      1
    WEST-EAST_PATCH_END_STAG:        160
    SOUTH-NORTH_PATCH_START_UNSTAG:  1
    SOUTH-NORTH_PATCH_END_UNSTAG:    159
    SOUTH-NORTH_PATCH_START_STAG:    1
    SOUTH-NORTH_PATCH_END_STAG:      160
    BOTTOM-TOP_PATCH_START_UNSTAG:   1
    BOTTOM-TOP_PATCH_END_UNSTAG:     50
    BOTTOM-TOP_PATCH_START_STAG:     1
    BOTTOM-TOP_PATCH_END_STAG:       51
    GRID_ID:                         2
    PARENT_ID:                       1
    I_PARENT_START:                  85
    J_PARENT_START:                  89
    PARENT_GRID_RATIO:               3
    CEN_LAT:                         60.36686
    CEN_LON:                         7.049286
    TRUELAT1:                        30.0
    TRUELAT2:                        50.0
    MOAD_CEN_LAT:                    60.0
    STAND_LON:                       5.59998
    POLE_LAT:                        90.0
    POLE_LON:                        0.0
    GMT:                             0.0
    JULYR:                           2014
    JULDAY:                          214
    MAP_PROJ:                        1
    MAP_PROJ_CHAR:                   Lambert Conformal
    MMINLU:                          USGS
    NUM_LAND_CAT:                    28
    ISWATER:                         16
    ISLAKE:                          28
    ISICE:                           24
    ISURBAN:                         1
    ISOILWATER:                      14
    HYBRID_OPT:                      -1
    ETAC:                            0.0
    history:                         Tue Feb  5 11:36:06 2019: ncrcat all_T2_...
    NCO:                             netCDF Operators version 4.7.4 (http://n...
    nco_openmp_thread_number:        1
    history_of_appended_files:       Tue Feb  5 11:36:06 2019: Appended file ...

We now have duplicate coordinates (XLAT and lat, XLONG and lon), let’s drop the XLAT and XLONG coordinates.

[16]:
ds_wrf_dropxlatlon = ds_wrf_rename_latlon.drop(['XLAT', 'XLONG'])
ds_wrf_dropxlatlon
[16]:
<xarray.Dataset>
Dimensions:      (time: 720, x: 159, y: 159)
Coordinates:
  * time         (time) datetime64[ns] 2014-08-01 ... 2014-08-30T23:00:00
    lat          (y, x) float32 59.7 59.7 59.7 59.7 ... 61.02 61.02 61.02 61.02
    lon          (y, x) float32 5.689 5.706 5.723 5.74 ... 8.416 8.433 8.451
    landmask     (y, x) float32 0.0 0.0 0.0 0.0 0.0 0.0 ... 1.0 1.0 1.0 1.0 1.0
    lakemask     (y, x) float32 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0
Dimensions without coordinates: x, y
Data variables:
    PREC_ACC_NC  (time, y, x) float32 ...
    T2           (time, y, x) float32 ...
    U10          (time, y, x) float32 ...
    V10          (time, y, x) float32 ...
Attributes:
    TITLE:                            OUTPUT FROM WRF V3.9 MODEL
    START_DATE:                      2014-08-01_00:00:00
    SIMULATION_START_DATE:           2014-08-01_00:00:00
    WEST-EAST_GRID_DIMENSION:        160
    SOUTH-NORTH_GRID_DIMENSION:      160
    BOTTOM-TOP_GRID_DIMENSION:       51
    DX:                              1000.0
    DY:                              1000.0
    SKEBS_ON:                        0
    SPEC_BDY_FINAL_MU:               1
    USE_Q_DIABATIC:                  0
    GRIDTYPE:                        C
    DIFF_OPT:                        1
    KM_OPT:                          4
    DAMP_OPT:                        3
    DAMPCOEF:                        0.2
    KHDIF:                           0.0
    KVDIF:                           0.0
    MP_PHYSICS:                      28
    RA_LW_PHYSICS:                   4
    RA_SW_PHYSICS:                   4
    SF_SFCLAY_PHYSICS:               1
    SF_SURFACE_PHYSICS:              4
    BL_PBL_PHYSICS:                  1
    CU_PHYSICS:                      0
    SF_LAKE_PHYSICS:                 0
    SURFACE_INPUT_SOURCE:            1
    SST_UPDATE:                      1
    GRID_FDDA:                       0
    GFDDA_INTERVAL_M:                0
    GFDDA_END_H:                     0
    GRID_SFDDA:                      0
    SGFDDA_INTERVAL_M:               0
    SGFDDA_END_H:                    0
    HYPSOMETRIC_OPT:                 2
    USE_THETA_M:                     0
    GWD_OPT:                         0
    SF_URBAN_PHYSICS:                0
    SF_OCEAN_PHYSICS:                0
    SHCU_PHYSICS:                    0
    MFSHCONV:                        0
    FEEDBACK:                        0
    SMOOTH_OPTION:                   2
    SWRAD_SCAT:                      1.0
    W_DAMPING:                       1
    DT:                              5.0
    RADT:                            10.0
    BLDT:                            0.0
    CUDT:                            0.0
    AER_OPT:                         3
    SWINT_OPT:                       0
    AER_TYPE:                        1
    AER_AOD550_OPT:                  1
    AER_ANGEXP_OPT:                  1
    AER_SSA_OPT:                     1
    AER_ASY_OPT:                     1
    AER_AOD550_VAL:                  0.12
    AER_ANGEXP_VAL:                  1.3
    AER_SSA_VAL:                     0.85
    AER_ASY_VAL:                     0.9
    MOIST_ADV_OPT:                   1
    SCALAR_ADV_OPT:                  1
    TKE_ADV_OPT:                     1
    DIFF_6TH_OPT:                    0
    DIFF_6TH_FACTOR:                 0.12
    OBS_NUDGE_OPT:                   0
    BUCKET_MM:                       100.0
    BUCKET_J:                        1000000000.0
    PREC_ACC_DT:                     60.0
    ISFTCFLX:                        0
    ISHALLOW:                        0
    ISFFLX:                          1
    ICLOUD:                          1
    ICLOUD_CU:                       0
    TRACER_PBLMIX:                   1
    SCALAR_PBLMIX:                   1
    YSU_TOPDOWN_PBLMIX:              0
    GRAV_SETTLING:                   0
    OPT_SFC:                         1
    DVEG:                            4
    OPT_CRS:                         1
    OPT_BTR:                         2
    OPT_RUN:                         1
    OPT_FRZ:                         1
    OPT_INF:                         1
    OPT_RAD:                         3
    OPT_ALB:                         2
    OPT_SNF:                         4
    OPT_TBOT:                        1
    OPT_STC:                         1
    OPT_GLA:                         1
    OPT_RSF:                         1
    DFI_OPT:                         0
    SIMULATION_INITIALIZATION_TYPE:  REAL-DATA CASE
    WEST-EAST_PATCH_START_UNSTAG:    1
    WEST-EAST_PATCH_END_UNSTAG:      159
    WEST-EAST_PATCH_START_STAG:      1
    WEST-EAST_PATCH_END_STAG:        160
    SOUTH-NORTH_PATCH_START_UNSTAG:  1
    SOUTH-NORTH_PATCH_END_UNSTAG:    159
    SOUTH-NORTH_PATCH_START_STAG:    1
    SOUTH-NORTH_PATCH_END_STAG:      160
    BOTTOM-TOP_PATCH_START_UNSTAG:   1
    BOTTOM-TOP_PATCH_END_UNSTAG:     50
    BOTTOM-TOP_PATCH_START_STAG:     1
    BOTTOM-TOP_PATCH_END_STAG:       51
    GRID_ID:                         2
    PARENT_ID:                       1
    I_PARENT_START:                  85
    J_PARENT_START:                  89
    PARENT_GRID_RATIO:               3
    CEN_LAT:                         60.36686
    CEN_LON:                         7.049286
    TRUELAT1:                        30.0
    TRUELAT2:                        50.0
    MOAD_CEN_LAT:                    60.0
    STAND_LON:                       5.59998
    POLE_LAT:                        90.0
    POLE_LON:                        0.0
    GMT:                             0.0
    JULYR:                           2014
    JULDAY:                          214
    MAP_PROJ:                        1
    MAP_PROJ_CHAR:                   Lambert Conformal
    MMINLU:                          USGS
    NUM_LAND_CAT:                    28
    ISWATER:                         16
    ISLAKE:                          28
    ISICE:                           24
    ISURBAN:                         1
    ISOILWATER:                      14
    HYBRID_OPT:                      -1
    ETAC:                            0.0
    history:                         Tue Feb  5 11:36:06 2019: ncrcat all_T2_...
    NCO:                             netCDF Operators version 4.7.4 (http://n...
    nco_openmp_thread_number:        1
    history_of_appended_files:       Tue Feb  5 11:36:06 2019: Appended file ...

And voila we have our WRF dataset in a format usable with the rest of the xarray and Pangeo tools. Let’s review the steps:

ds_wrf_w_latlon = ds_wrf_dropped_Times.assign_coords(
        lat=ds_geo.coords['XLAT'].squeeze('Time'),
        lon=ds_geo.coords['XLONG'].squeeze('Time'),
        landmask=ds_geo.LANDMASK.squeeze('Time'),
        lakemask=ds_geo.LAKEMASK.squeeze('Time'))
ds_wrf_rename_latlon = ds_wrf_w_latlon.rename({'south_north':'y', 'west_east':'x'})
ds_wrf_dropxlatlon = ds_wrf_rename_latlon.drop(['XLAT', 'XLONG'])

And you’re ready to continue your analysis using Xarray!

For example, let’s plot masked mean precipitation values from the first week of August ’14.

[17]:
ds_wrf_cf = ds_wrf_dropxlatlon

prc = ds_wrf_cf['PREC_ACC_NC'].sel(time=slice('2014-08-01', '2014-08-08'))
prc_mean = prc.mean('time')

da_mask = ds_wrf_cf['landmask'].where(ds_wrf_cf['lakemask'].values == 0, other=1)
[18]:
fig = plt.figure()#figsize=(10, 8))

prc_mean.where(da_mask.values == 1).plot(x='lon', y='lat')
[18]:
<matplotlib.collections.QuadMesh at 0x7f708ccd08e0>
../../../../../../_images/repos_NCAR_notebook-gallery_notebooks_Run-Anywhere_WRF_wrf_ex_32_1.png

Further reading: https://www.unidata.ucar.edu/blogs/developer/en/entry/wrf_goes_cf_two