按 nlat/nlon 格式的纬度对 CMIP netCDF 文件进行子集化
Subsetting CMIP netCDF file by latitude in nlat/nlon format
我对 python 和处理 netCDF 文件都很陌生,一段时间以来我一直在尝试按纬度对 CMIP 输出进行子集化。我一直关注的所有示例似乎都非常简单,只需根据 lat/lon.
进行提取即可
我遇到的问题是,对于我的实验,尺寸采用 'nlat' 和 'nlon' 格式(我收集到这是纬度数)。到目前为止,我发现这可能与网格有关,我需要将其从数组中转换以获得 'real' 纬度和经度(然后我可以对其进行子集化)。
这个实验包含海洋叶绿素数据,我的最终目标是能够对实验进行子集化以获得南半球纬度带的平均值。我不是在寻找关于如何做到这一点的准确答案,但如果有人对我如何转换此文件以处理真实坐标有任何指示,我会更多。
如有任何建议,我们将不胜感激。
谢谢!
文件信息的完整转储在这里:
Conventions: CF-1.7 CMIP-6.2
activity_id: ScenarioMIP
branch_method: standard
branch_time_in_child: 735110.0
branch_time_in_parent: 735110.0
case_id: 1731
cesm_casename: b.e21.BSSP245cmip6.f09_g17.CMIP6-SSP2-4.5.102
contact: cesm_cmip6@ucar.edu
creation_date: 2020-05-26T19:43:22Z
data_specs_version: 01.00.31
experiment: SSP-based RCP scenario with medium radiative forcing by the end of the century. Following approximately RCP4.5 global forcing pathway with SSP2 socioeconomic conditions. Radiative forcing reaches a level of 4.5 W/m2 in 2100. Concentration-driven.
experiment_id: ssp245
external_variables: areacello volcello
forcing_index: 1
frequency: mon
further_info_url: https://furtherinfo.es-doc.org/CMIP6.NCAR.CESM2.ssp245.none.r11i1p1f1
grid: native gx1v7 displaced pole grid (384x320 latxlon)
grid_label: gn
initialization_index: 1
institution: National Center for Atmospheric Research, Climate and Global Dynamics Laboratory, 1850 Table Mesa Drive, Boulder, CO 80305, USA
institution_id: NCAR
mip_era: CMIP6
model_doi_url: https://doi.org/10.5065/D67H1H0V
nominal_resolution: 100 km
parent_activity_id: CMIP
parent_experiment_id: historical
parent_mip_era: CMIP6
parent_source_id: CESM2
parent_time_units: days since 0001-01-01 00:00:00
parent_variant_label: r11i1p1f1
physics_index: 1
product: model-output
realization_index: 11
realm: ocnBgchem
source: CESM2 (2017): atmosphere: CAM6 (0.9x1.25 finite volume grid; 288 x 192 longitude/latitude; 32 levels; top level 2.25 mb); ocean: POP2 (320x384 longitude/latitude; 60 levels; top grid cell 0-10 m); sea_ice: CICE5.1 (same grid as ocean); land: CLM5 0.9x1.25 finite volume grid; 288 x 192 longitude/latitude; 32 levels; top level 2.25 mb); aerosol: MAM4 (0.9x1.25 finite volume grid; 288 x 192 longitude/latitude; 32 levels; top level 2.25 mb); atmoschem: MAM4 (0.9x1.25 finite volume grid; 288 x 192 longitude/latitude; 32 levels; top level 2.25 mb); landIce: CISM2.1; ocnBgchem: MARBL (320x384 longitude/latitude; 60 levels; top grid cell 0-10 m)
source_id: CESM2
source_type: AOGCM BGC AER
sub_experiment: none
sub_experiment_id: none
table_id: Omon
tracking_id: hdl:21.14100/2f01427e-7a24-40fe-93a6-88c87923afea
variable_id: chl
variant_info: CMIP6 SSP2-4.5 experiments (2015-2100) with CAM6, interactive land (CLM5), coupled ocean (POP2) with biogeochemistry (MARBL), interactive sea ice (CICE5.1), and non-evolving land ice (CISM2.1).
variant_label: r11i1p1f1
dimensions(sizes): nlat(384), vertices(4), lev(15), time(600), d2(2), nlon(320)
variables(dimensions): float32 chl(time,lev,nlat,nlon), float64 lat(nlat,nlon), float64 lev(lev), float64 lon(nlat,nlon), int32 nlat(nlat), int32 nlon(nlon), float64 time(time), float64 time_bnds(time,d2), float32 lat_bnds(nlat,nlon,vertices), float32 lon_bnds(nlat,nlon,vertices), float32 lev_bnds(lev,d2)
groups:
最简单的处理方法是 Python 可能是我的 nctoolkit 包 (https://nctoolkit.readthedocs.io/en/latest/)。您可以使用 xarray 执行此操作,但您需要为每个 CMIP 模型网格修改任何代码。
nctoolkit 使用 CDO 作为后端,应该能够或多或少地处理任何 CMIP 网格,除了使用高度不规则网格的组。不过你说的应该没问题。
如果您想计算南半球的纬度平均值(纬向平均值),您可以执行以下操作:
import nctoolkit as nc
ds = nc.open_data("infile.nc")
ds.crop(lat = [-90,0])
ds.zonal_mean()
# to visualize
ds.plot()
我对 python 和处理 netCDF 文件都很陌生,一段时间以来我一直在尝试按纬度对 CMIP 输出进行子集化。我一直关注的所有示例似乎都非常简单,只需根据 lat/lon.
进行提取即可我遇到的问题是,对于我的实验,尺寸采用 'nlat' 和 'nlon' 格式(我收集到这是纬度数)。到目前为止,我发现这可能与网格有关,我需要将其从数组中转换以获得 'real' 纬度和经度(然后我可以对其进行子集化)。
这个实验包含海洋叶绿素数据,我的最终目标是能够对实验进行子集化以获得南半球纬度带的平均值。我不是在寻找关于如何做到这一点的准确答案,但如果有人对我如何转换此文件以处理真实坐标有任何指示,我会更多。
如有任何建议,我们将不胜感激。 谢谢!
文件信息的完整转储在这里:
Conventions: CF-1.7 CMIP-6.2
activity_id: ScenarioMIP
branch_method: standard
branch_time_in_child: 735110.0
branch_time_in_parent: 735110.0
case_id: 1731
cesm_casename: b.e21.BSSP245cmip6.f09_g17.CMIP6-SSP2-4.5.102
contact: cesm_cmip6@ucar.edu
creation_date: 2020-05-26T19:43:22Z
data_specs_version: 01.00.31
experiment: SSP-based RCP scenario with medium radiative forcing by the end of the century. Following approximately RCP4.5 global forcing pathway with SSP2 socioeconomic conditions. Radiative forcing reaches a level of 4.5 W/m2 in 2100. Concentration-driven.
experiment_id: ssp245
external_variables: areacello volcello
forcing_index: 1
frequency: mon
further_info_url: https://furtherinfo.es-doc.org/CMIP6.NCAR.CESM2.ssp245.none.r11i1p1f1
grid: native gx1v7 displaced pole grid (384x320 latxlon)
grid_label: gn
initialization_index: 1
institution: National Center for Atmospheric Research, Climate and Global Dynamics Laboratory, 1850 Table Mesa Drive, Boulder, CO 80305, USA
institution_id: NCAR
mip_era: CMIP6
model_doi_url: https://doi.org/10.5065/D67H1H0V
nominal_resolution: 100 km
parent_activity_id: CMIP
parent_experiment_id: historical
parent_mip_era: CMIP6
parent_source_id: CESM2
parent_time_units: days since 0001-01-01 00:00:00
parent_variant_label: r11i1p1f1
physics_index: 1
product: model-output
realization_index: 11
realm: ocnBgchem
source: CESM2 (2017): atmosphere: CAM6 (0.9x1.25 finite volume grid; 288 x 192 longitude/latitude; 32 levels; top level 2.25 mb); ocean: POP2 (320x384 longitude/latitude; 60 levels; top grid cell 0-10 m); sea_ice: CICE5.1 (same grid as ocean); land: CLM5 0.9x1.25 finite volume grid; 288 x 192 longitude/latitude; 32 levels; top level 2.25 mb); aerosol: MAM4 (0.9x1.25 finite volume grid; 288 x 192 longitude/latitude; 32 levels; top level 2.25 mb); atmoschem: MAM4 (0.9x1.25 finite volume grid; 288 x 192 longitude/latitude; 32 levels; top level 2.25 mb); landIce: CISM2.1; ocnBgchem: MARBL (320x384 longitude/latitude; 60 levels; top grid cell 0-10 m)
source_id: CESM2
source_type: AOGCM BGC AER
sub_experiment: none
sub_experiment_id: none
table_id: Omon
tracking_id: hdl:21.14100/2f01427e-7a24-40fe-93a6-88c87923afea
variable_id: chl
variant_info: CMIP6 SSP2-4.5 experiments (2015-2100) with CAM6, interactive land (CLM5), coupled ocean (POP2) with biogeochemistry (MARBL), interactive sea ice (CICE5.1), and non-evolving land ice (CISM2.1).
variant_label: r11i1p1f1
dimensions(sizes): nlat(384), vertices(4), lev(15), time(600), d2(2), nlon(320)
variables(dimensions): float32 chl(time,lev,nlat,nlon), float64 lat(nlat,nlon), float64 lev(lev), float64 lon(nlat,nlon), int32 nlat(nlat), int32 nlon(nlon), float64 time(time), float64 time_bnds(time,d2), float32 lat_bnds(nlat,nlon,vertices), float32 lon_bnds(nlat,nlon,vertices), float32 lev_bnds(lev,d2)
groups:
最简单的处理方法是 Python 可能是我的 nctoolkit 包 (https://nctoolkit.readthedocs.io/en/latest/)。您可以使用 xarray 执行此操作,但您需要为每个 CMIP 模型网格修改任何代码。
nctoolkit 使用 CDO 作为后端,应该能够或多或少地处理任何 CMIP 网格,除了使用高度不规则网格的组。不过你说的应该没问题。
如果您想计算南半球的纬度平均值(纬向平均值),您可以执行以下操作:
import nctoolkit as nc
ds = nc.open_data("infile.nc")
ds.crop(lat = [-90,0])
ds.zonal_mean()
# to visualize
ds.plot()