CEDSv2021_04_21#
This Python script is used to process CEDSv2021_04_21 data using IPTpy. Users could use Jupyter Notebook to taste the code.
# import packages
import xarray as xr
import numpy as np
from iptpy.anthro_emission.fv import FV
# initialize
# download by globus
fv_instance = FV(
preregrid_path='/gws/nopw/j04/duicv/yuansun/IPTpy/tests/preregrid/', # path to the summed data
regridder_filename='/gws/nopw/j04/duicv/yuansun/IPTpy/tests/regridded/test_ceds_0.5x0.5_0.9x1.25_regridder.nc',
regridded_path='/gws/nopw/j04/duicv/yuansun/IPTpy/tests/regridded/',
start_year=2000,
end_year=2000,
source='CEDS',
version='v2021-04-21',
original_resolution='0.5x0.5',
download_method='globus'
)
# or download by wget
fv_instance = FV(
preregrid_path='/gws/nopw/j04/duicv/yuansun/dataset/CEDS/CEDS_v2021_04_21/', # path to the wget downloaded data
regridder_filename='/gws/nopw/j04/duicv/yuansun/IPTpy/tests/regridded/test_ceds_0.5x0.5_0.9x1.25_regridder.nc',
regridded_path='/gws/nopw/j04/duicv/yuansun/IPTpy/tests/regridded/',
start_year=2000,
end_year=2000,
source='CEDS',
version='v2021-04-21',
original_resolution='0.5x0.5',
download_method='wget'
)
Step1: Sum up the emissions from sectors#
FV.sum_up
only works when download_method
is globus
. The summed data is saved in preregrid_path
.
fv_instance.sum_up('/gws/nopw/j04/duicv/yuansun/dataset/PNNL_DataHub/CEDS_gridded_data_2021-04-21/data/')
Step2: Regrid from 0.5°x0.5° to 0.9°x1.25°#
fv_instance.generate_regridder()
fv_instance.apply_regridder()
Once a regridder exists, it can be reused and does not need to be generated when running
apply_regridder()
multiple times.
Step3: Rename regridded data#
fv_instance.rename('/gws/nopw/j04/duicv/yuansun/IPTpy/tests/renamed/')
Note that the
regridder_filename
and files in thepreregrid_path
orregridded_path
orrenamed_path
will be automatically deleted before new files are generated, so manual deletion is not required.