-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Modify code such that the "new" data to compare can be timeseries or history file. The time series is useful when comparing older data where history files may have been deleted.
Here is what I did for POP to make a history file from timeseries files:
Use xarray to make multiple timeseries into history file for ECT:
(see ~/python/pinatubo.ipynb on glade)
import xarray as xr
import numpy as np
ds_yellow = xr.open_mfdataset("/glade/work/abaker/pinatubo/ocn_ens_out/lens001/orig_yellow/b.*.nc")
ds_yellow_mo12 = ds_yellow.isel(time=[11])
ds_yellow_ssh = ds_yellow_mo12["SSH"]
ds_yellow_salt = ds_yellow_mo12["SALT"]
ds_yellow_temp = ds_yellow_mo12["TEMP"]
ds_yellow_uvel = ds_yellow_mo12["UVEL"]
ds_yellow_vvel = ds_yellow_mo12["VVEL"]
ds_yellow_rm = ds_yellow_mo12["REGION_MASK"]
yellow_ds = xr.merge([ds_yellow_ssh, ds_yellow_temp, ds_yellow_salt, ds_yellow_uvel, ds_yellow_vvel, ds_yellow_rm])
yellow_ds
yellow_ds.to_netcdf("yellow_mask.nc")