Skip to content

Commit

Permalink
Merge pull request #1133 from PCMDI/zhan391
Browse files Browse the repository at this point in the history
Bug fix in module mean_climate_driver.py for regional mean
  • Loading branch information
lee1043 authored Sep 24, 2024
2 parents ebbc2fe + c2ba107 commit 04e1f76
Show file tree
Hide file tree
Showing 5 changed files with 1,544 additions and 1,277 deletions.
131 changes: 74 additions & 57 deletions doc/jupyter/Demo/Demo_1a_compute_climatologies.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@
"end = '2018-12'\n",
"\n",
"# INPUT DATASET - CAN BE MODEL OR OBSERVATIONS\n",
"infile = 'demo_data/obs4MIPs_PCMDI_monthly/NASA-LaRC/CERES-EBAF-4-1/mon/rlut/gn/v20210727/rlut_mon_CERES-EBAF-4-1_PCMDI_gn_200301-201812.nc'\n",
"infile = 'demo_data_tmp/obs4MIPs_PCMDI_monthly/NASA-LaRC/CERES-EBAF-4-1/mon/rlut/gn/v20210727/rlut_mon_CERES-EBAF-4-1_PCMDI_gn_200301-201812.nc'\n",
"\n",
"# DIRECTORY WHERE TO PUT RESULTS\n",
"outfile = 'demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc'\n",
"outfile = 'demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc'\n",
"\n"
]
}
Expand Down Expand Up @@ -115,25 +115,26 @@
"text": [
"start and end are 2003-01 2018-12\n",
"variable list: ['rlut']\n",
"infilename is rlut_mon_CERES-EBAF-4-1_PCMDI_gn_200301-201812.nc\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"outdir is None\n",
"ver: v20240923\n",
"var: rlut\n",
"infile: demo_data_tmp/obs4MIPs_PCMDI_monthly/NASA-LaRC/CERES-EBAF-4-1/mon/rlut/gn/v20210727/rlut_mon_CERES-EBAF-4-1_PCMDI_gn_200301-201812.nc\n",
"outfile: demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"outfilename: None\n",
"outpath: None\n",
"ver: v20240923\n",
"infilename: rlut_mon_CERES-EBAF-4-1_PCMDI_gn_200301-201812.nc\n",
"type(d): <class 'xarray.core.dataset.Dataset'>\n",
"atts: {'Conventions': 'CF-1.7 ODS-2.1', 'activity_id': 'obs4MIPs', 'contact': 'PCMDI ([email protected])', 'creation_date': '2021-07-27T18:20:26Z', 'curation_provenance': 'work-in-progress', 'data_specs_version': '2.1.0', 'external_variables': 'areacella', 'frequency': 'mon', 'further_info_url': 'https://furtherinfo.es-doc.org/CMIP6.NASA-LaRC.CERES-EBAF-4-1.experiment_idsub_experiment_idPCMDI', 'grid': '1x1 degree latitude x longitude', 'grid_label': 'gn', 'history': '2021-07-27T18:20:26Z; CMOR rewrote data to be consistent with obs4MIPs, and CF-1.7 ODS-2.1 standards', 'institution': 'NASA-LaRC (Langley Research Center) Hampton, Va', 'institution_id': 'NASA-LaRC', 'mip_era': 'CMIP6', 'nominal_resolution': '100 km', 'product': 'observations', 'realm': 'atmos', 'release_year': '2019', 'source': 'CERES EBAF (Energy Balanced and Filled) TOA Fluxes. Monthly Averages', 'source_description': 'CERES EBAF (Energy Balanced and Filled) TOA Fluxes. Monthly Averages', 'source_id': 'CERES-EBAF-4-1', 'source_label': 'CERES-EBAF-4-1', 'source_name': 'CERES-EBAF4-1', 'source_type': 'satellite_blended', 'source_version_number': '4.1', 'table_id': 'obs4MIPs_Amon', 'table_info': 'Creation Date:(18 November 2020) MD5:d8a4a72de798e86a999881bdaeb1809e', 'title': 'CERES prepared for obs4MIPs (ODS-v2.1.0)', 'tracking_id': 'hdl:21.14102/d1afa116-4801-4801-b302-43c49b5bb7dc', 'variable_id': 'rlut', 'variant_info': 'Best Estimate', 'variant_label': 'PCMDI', 'license': 'Data in this file processed for obs4MIPs by PCMDI and is for research purposes only.', 'cmor_version': '3.6.1'}\n",
"outdir: demo_output_tmp/climo\n",
"start_yr_str is 2003\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"out is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.AC.v20220420.nc\n",
"(12, 180, 360) (12, 180, 360) demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.AC.v20220420.nc\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"out is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.DJF.v20220420.nc\n",
"(180, 360) (12, 180, 360) demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.DJF.v20220420.nc\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"out is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.MAM.v20220420.nc\n",
"(180, 360) (12, 180, 360) demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.MAM.v20220420.nc\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"out is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.JJA.v20220420.nc\n",
"(180, 360) (12, 180, 360) demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.JJA.v20220420.nc\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"out is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.SON.v20220420.nc\n",
"(180, 360) (12, 180, 360) demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.SON.v20220420.nc\n"
"start_mo_str is 01\n",
"end_yr_str is 2018\n",
"end_mo_str is 12\n",
"output file is demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.AC.v20240923.nc\n",
"output file is demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.DJF.v20240923.nc\n",
"output file is demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.MAM.v20240923.nc\n",
"output file is demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.JJA.v20240923.nc\n",
"output file is demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.SON.v20240923.nc\n"
]
}
],
Expand Down Expand Up @@ -172,25 +173,40 @@
"text": [
"start and end are 2003-01 2018-12\n",
"variable list: ['rlut']\n",
"infilename is rlut_mon_CERES-EBAF-4-1_PCMDI_gn_200301-201812.nc\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"outdir is None\n",
"ver: v20240923\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/lee1043/mambaforge/envs/pmp_devel_20240425/lib/python3.10/site-packages/pcmdi_metrics/io/string_constructor.py:43: UserWarning: Keyword 'variable' not provided for filling the template.\n",
" warnings.warn(f\"Keyword '{k}' not provided for filling the template.\")\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"var: rlut\n",
"infile: demo_data_tmp/obs4MIPs_PCMDI_monthly/NASA-LaRC/CERES-EBAF-4-1/mon/rlut/gn/v20210727/rlut_mon_CERES-EBAF-4-1_PCMDI_gn_200301-201812.nc\n",
"outfile: demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"outfilename: None\n",
"outpath: None\n",
"ver: v20240923\n",
"infilename: rlut_mon_CERES-EBAF-4-1_PCMDI_gn_200301-201812.nc\n",
"type(d): <class 'xarray.core.dataset.Dataset'>\n",
"atts: {'Conventions': 'CF-1.7 ODS-2.1', 'activity_id': 'obs4MIPs', 'contact': 'PCMDI ([email protected])', 'creation_date': '2021-07-27T18:20:26Z', 'curation_provenance': 'work-in-progress', 'data_specs_version': '2.1.0', 'external_variables': 'areacella', 'frequency': 'mon', 'further_info_url': 'https://furtherinfo.es-doc.org/CMIP6.NASA-LaRC.CERES-EBAF-4-1.experiment_idsub_experiment_idPCMDI', 'grid': '1x1 degree latitude x longitude', 'grid_label': 'gn', 'history': '2021-07-27T18:20:26Z; CMOR rewrote data to be consistent with obs4MIPs, and CF-1.7 ODS-2.1 standards', 'institution': 'NASA-LaRC (Langley Research Center) Hampton, Va', 'institution_id': 'NASA-LaRC', 'mip_era': 'CMIP6', 'nominal_resolution': '100 km', 'product': 'observations', 'realm': 'atmos', 'release_year': '2019', 'source': 'CERES EBAF (Energy Balanced and Filled) TOA Fluxes. Monthly Averages', 'source_description': 'CERES EBAF (Energy Balanced and Filled) TOA Fluxes. Monthly Averages', 'source_id': 'CERES-EBAF-4-1', 'source_label': 'CERES-EBAF-4-1', 'source_name': 'CERES-EBAF4-1', 'source_type': 'satellite_blended', 'source_version_number': '4.1', 'table_id': 'obs4MIPs_Amon', 'table_info': 'Creation Date:(18 November 2020) MD5:d8a4a72de798e86a999881bdaeb1809e', 'title': 'CERES prepared for obs4MIPs (ODS-v2.1.0)', 'tracking_id': 'hdl:21.14102/d1afa116-4801-4801-b302-43c49b5bb7dc', 'variable_id': 'rlut', 'variant_info': 'Best Estimate', 'variant_label': 'PCMDI', 'license': 'Data in this file processed for obs4MIPs by PCMDI and is for research purposes only.', 'cmor_version': '3.6.1'}\n",
"outdir: demo_output_tmp/climo\n",
"start_yr_str is 2003\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"out is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.AC.v20220420.nc\n",
"(12, 180, 360) (12, 180, 360) demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.AC.v20220420.nc\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"out is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.DJF.v20220420.nc\n",
"(180, 360) (12, 180, 360) demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.DJF.v20220420.nc\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"out is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.MAM.v20220420.nc\n",
"(180, 360) (12, 180, 360) demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.MAM.v20220420.nc\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"out is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.JJA.v20220420.nc\n",
"(180, 360) (12, 180, 360) demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.JJA.v20220420.nc\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"out is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.SON.v20220420.nc\n",
"(180, 360) (12, 180, 360) demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.SON.v20220420.nc\n"
"start_mo_str is 01\n",
"end_yr_str is 2018\n",
"end_mo_str is 12\n",
"output file is demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.AC.v20240923.nc\n",
"output file is demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.DJF.v20240923.nc\n",
"output file is demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.MAM.v20240923.nc\n",
"output file is demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.JJA.v20240923.nc\n",
"output file is demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.SON.v20240923.nc\n"
]
}
],
Expand Down Expand Up @@ -231,25 +247,26 @@
"text": [
"start and end are 2003-01 2018-12\n",
"variable list: ['rlut']\n",
"infilename is rlut_mon_CERES-EBAF-4-1_PCMDI_gn_200301-201812.nc\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"outdir is demo_output/climo/\n",
"ver: v20240923\n",
"var: rlut\n",
"infile: demo_data_tmp/obs4MIPs_PCMDI_monthly/NASA-LaRC/CERES-EBAF-4-1/mon/rlut/gn/v20210727/rlut_mon_CERES-EBAF-4-1_PCMDI_gn_200301-201812.nc\n",
"outfile: demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"outfilename: rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"outpath: demo_output_tmp/climo/\n",
"ver: v20240923\n",
"infilename: rlut_mon_CERES-EBAF-4-1_PCMDI_gn_200301-201812.nc\n",
"type(d): <class 'xarray.core.dataset.Dataset'>\n",
"atts: {'Conventions': 'CF-1.7 ODS-2.1', 'activity_id': 'obs4MIPs', 'contact': 'PCMDI ([email protected])', 'creation_date': '2021-07-27T18:20:26Z', 'curation_provenance': 'work-in-progress', 'data_specs_version': '2.1.0', 'external_variables': 'areacella', 'frequency': 'mon', 'further_info_url': 'https://furtherinfo.es-doc.org/CMIP6.NASA-LaRC.CERES-EBAF-4-1.experiment_idsub_experiment_idPCMDI', 'grid': '1x1 degree latitude x longitude', 'grid_label': 'gn', 'history': '2021-07-27T18:20:26Z; CMOR rewrote data to be consistent with obs4MIPs, and CF-1.7 ODS-2.1 standards', 'institution': 'NASA-LaRC (Langley Research Center) Hampton, Va', 'institution_id': 'NASA-LaRC', 'mip_era': 'CMIP6', 'nominal_resolution': '100 km', 'product': 'observations', 'realm': 'atmos', 'release_year': '2019', 'source': 'CERES EBAF (Energy Balanced and Filled) TOA Fluxes. Monthly Averages', 'source_description': 'CERES EBAF (Energy Balanced and Filled) TOA Fluxes. Monthly Averages', 'source_id': 'CERES-EBAF-4-1', 'source_label': 'CERES-EBAF-4-1', 'source_name': 'CERES-EBAF4-1', 'source_type': 'satellite_blended', 'source_version_number': '4.1', 'table_id': 'obs4MIPs_Amon', 'table_info': 'Creation Date:(18 November 2020) MD5:d8a4a72de798e86a999881bdaeb1809e', 'title': 'CERES prepared for obs4MIPs (ODS-v2.1.0)', 'tracking_id': 'hdl:21.14102/d1afa116-4801-4801-b302-43c49b5bb7dc', 'variable_id': 'rlut', 'variant_info': 'Best Estimate', 'variant_label': 'PCMDI', 'license': 'Data in this file processed for obs4MIPs by PCMDI and is for research purposes only.', 'cmor_version': '3.6.1'}\n",
"outdir: demo_output_tmp/climo/\n",
"start_yr_str is 2003\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"out is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.AC.v20220420.nc\n",
"(12, 180, 360) (12, 180, 360) demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.AC.v20220420.nc\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"out is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.DJF.v20220420.nc\n",
"(180, 360) (12, 180, 360) demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.DJF.v20220420.nc\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"out is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.MAM.v20220420.nc\n",
"(180, 360) (12, 180, 360) demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.MAM.v20220420.nc\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"out is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.JJA.v20220420.nc\n",
"(180, 360) (12, 180, 360) demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.JJA.v20220420.nc\n",
"outfd is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.nc\n",
"out is demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.SON.v20220420.nc\n",
"(180, 360) (12, 180, 360) demo_output/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.SON.v20220420.nc\n"
"start_mo_str is 01\n",
"end_yr_str is 2018\n",
"end_mo_str is 12\n",
"output file is demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.AC.v20240923.nc\n",
"output file is demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.DJF.v20240923.nc\n",
"output file is demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.MAM.v20240923.nc\n",
"output file is demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.JJA.v20240923.nc\n",
"output file is demo_output_tmp/climo/rlut_mon_CERES-EBAF-4-1_BE_gn.200301-201812.SON.v20240923.nc\n"
]
}
],
Expand Down Expand Up @@ -278,7 +295,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.10.10"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 04e1f76

Please sign in to comment.