From 67a5e3a012f4cf2d80ae8e1014dc785a9204b949 Mon Sep 17 00:00:00 2001 From: wrongkindofdoctor <20195932+wrongkindofdoctor@users.noreply.github.com> Date: Thu, 16 Dec 2021 15:36:22 -0500 Subject: [PATCH 1/5] added script to generate cmip pressure coordinates added 3d variables to cmip_mon.yml added logic to handle cmip vertical levels on a rectilinear grip to synthetic_data.py --- mdtf_test_data/config/cmip_mon.yml | 55 +++++++++++++++ mdtf_test_data/synthetic/synthetic_data.py | 11 ++- mdtf_test_data/synthetic/vertical/__init__.py | 1 + .../synthetic/vertical/cmip_vertical_coord.py | 70 +++++++++++++++++++ 4 files changed, 134 insertions(+), 3 deletions(-) create mode 100644 mdtf_test_data/synthetic/vertical/cmip_vertical_coord.py diff --git a/mdtf_test_data/config/cmip_mon.yml b/mdtf_test_data/config/cmip_mon.yml index 87749f0..a14d40f 100755 --- a/mdtf_test_data/config/cmip_mon.yml +++ b/mdtf_test_data/config/cmip_mon.yml @@ -6,6 +6,7 @@ variables : - "tauvo" - "so" - "thetao" + - "zg"" areacello : atts : @@ -227,4 +228,58 @@ thetao: - [ 13.806399, 13.840008 ] - [ 13.422476, 13.461085 ] +zg : + atts: + cell_methods: 'time: mean' + description: 'geopotential height' + frequency: 'mon' + id: 'zg' + long_name: 'geopotential_height' + out_name: 'zg' + positive: 'up' + realm: 'atmos' + standard_name: 'geopotential_height' + time: 'time' + time_label: 'time-mean' + time_title: 'Temporal mean' + title: 'geopotential height' + type: 'real' + units: 'm' + variable_id: 'zg' + grid: "standard" + + stats : + - [39911.184, 1503.5703] + - [33167.73, 1159.6759] + - [28014.025, 907.52545] + - [25977.67, 812.5992] + - [22914.363, 684.1405] + - [21145.533, 622.05505] + - [19387.41, 574.9577] + - [17304.172, 551.8367] + - [16890.176, 552.6706] + - [16062.766, 559.1083] + - [14818.047, 576.20264] + - [13138.605, 595.81165] + - [12713.972, 597.3992] + - [12294.373, 588.3031] + - [11880.293, 569.56024] + - [11464.33, 550.8575] + - [11045.44, 532.8474] + - [10623.187, 515.4224] + - [10196.957, 498.81952] + - [9766.008, 483.6007] + - [9329.627, 470.50427] + - [8887.224, 460.28516] + - [8438.355, 453.60825] + - [7982.7095, 450.97073] + - [7520.093, 452.66232] + - [6573.596, 469.11874] + - [4084.7944, 571.5943] + - [3567.0034, 598.9684] + - [1976.4714, 687.46045] + - [1322.4452, 724.7243] + - [703.75806, 760.6792] + - [410.32043, 777.56665] + diff --git a/mdtf_test_data/synthetic/synthetic_data.py b/mdtf_test_data/synthetic/synthetic_data.py index ce2e32e..289ef0c 100755 --- a/mdtf_test_data/synthetic/synthetic_data.py +++ b/mdtf_test_data/synthetic/synthetic_data.py @@ -22,6 +22,7 @@ from mdtf_test_data.synthetic.vertical import gfdl_vertical_coord from mdtf_test_data.synthetic.vertical import ncar_hybrid_coord from mdtf_test_data.synthetic.vertical import mom6_z_coord +from mdtf_test_data.synthetic.vertical import cmip_vertical_coord def dataset_stats(filename, var=None, limit=None): @@ -162,9 +163,13 @@ def generate_synthetic_dataset( else: dset = dset.merge(gfdl_vertical_coord()) lev = dset.pfull - elif fmt == "cmip" and grid == "tripolar": - dset = dset.merge(mom6_z_coord()) - lev = dset.lev + elif fmt == "cmip": + if grid == "tripolar": + dset = dset.merge(mom6_z_coord()) + lev = dset.lev + else: + dset = dset.merge(cmip_vertical_coord()) + lev = dset.plev assert len(stats) == len( lev ), f" Length of stats {data.shape[1]} must match number of levels {len(lev)}." diff --git a/mdtf_test_data/synthetic/vertical/__init__.py b/mdtf_test_data/synthetic/vertical/__init__.py index 47a9b2a..8073884 100644 --- a/mdtf_test_data/synthetic/vertical/__init__.py +++ b/mdtf_test_data/synthetic/vertical/__init__.py @@ -1,3 +1,4 @@ +from .cmip_vertical_coord import cmip_vertical_coord from .gfdl_plev19_vertical_coord import gfdl_plev19_vertical_coord from .gfdl_vertical_coord import gfdl_vertical_coord from .mom6_z_coord import mom6_z_coord diff --git a/mdtf_test_data/synthetic/vertical/cmip_vertical_coord.py b/mdtf_test_data/synthetic/vertical/cmip_vertical_coord.py new file mode 100644 index 0000000..9a0bfd8 --- /dev/null +++ b/mdtf_test_data/synthetic/vertical/cmip_vertical_coord.py @@ -0,0 +1,70 @@ +""" Module for generating synthetic CMIP datasets """ + +___all__ = [ + "cmip_vertical_coord", +] + +import xarray as xr +import numpy as np + + +def cmip_vertical_coord(): + """Generates generic CMIP6 vertical pressure coordinate + + Returns + ------- + xarray.DataArray + CMIP6 pressure levels + """ + + plev = np.array( + [ + 10, + 20, + 30, + 50, + 70, + 100, + 125, + 150, + 175, + 200, + 225, + 250, + 275, + 300, + 350, + 400, + 450, + 500, + 550, + 600, + 650, + 700, + 750, + 800, + 825, + 850, + 875, + 900, + 925, + 950, + 975, + 1000 + ] + ) + + plev_attrs = { + "long_name": "air_pressure", + "units": "hPa", + "cartesian_axis": "Z", + "positive": "down" + } + + + dset_out = xr.Dataset() + dset_out["plev"] = xr.DataArray( + lev, dims={"plev": plev}, coords={"plev": plev}, attrs=plev_attrs + ) + + return dset_out From ebb0b16ab851f6d28348b717d69d7d08ab8e8706 Mon Sep 17 00:00:00 2001 From: wrongkindofdoctor <20195932+wrongkindofdoctor@users.noreply.github.com> Date: Thu, 16 Dec 2021 17:12:33 -0500 Subject: [PATCH 2/5] add more variables to cmip_mon.yml fix errors in synthetic_data and cmip_vertical_coord.py --- mdtf_test_data/config/cmip_mon.yml | 149 +++++++++++++++++- mdtf_test_data/synthetic/synthetic_data.py | 2 +- .../synthetic/vertical/cmip_vertical_coord.py | 2 +- 3 files changed, 148 insertions(+), 5 deletions(-) diff --git a/mdtf_test_data/config/cmip_mon.yml b/mdtf_test_data/config/cmip_mon.yml index a14d40f..3e57884 100755 --- a/mdtf_test_data/config/cmip_mon.yml +++ b/mdtf_test_data/config/cmip_mon.yml @@ -6,8 +6,22 @@ variables : - "tauvo" - "so" - "thetao" - - "zg"" - + - "zg" + - "ua" + - "va" + - "ta" + # - "hus" + # - "wap" + #- "pr" + # - "ts" + # - "hfss" + # - "hfls" + # - "rsus" + # - "rsds" + # - "rsdt" + # - "rsut" + # - "rlds" + # - "rlut" areacello : atts : cell_methods : "area: sum" @@ -236,7 +250,7 @@ zg : id: 'zg' long_name: 'geopotential_height' out_name: 'zg' - positive: 'up' + positive: 'down' realm: 'atmos' standard_name: 'geopotential_height' time: 'time' @@ -281,5 +295,134 @@ zg : - [1322.4452, 724.7243] - [703.75806, 760.6792] - [410.32043, 777.56665] +va : + atts : + long_name : "northward_wind" + units": "m s-1" + cell_methods": "time : mean" + cell_measures" : "area : area" + time_avg_info" : "average_T1,average_T2,average_DT" + standard_name" : "northward_wind" + interp_method" : "conserve_order2" + grid: "standard" + stats : + - [0.1940714418888092, 2.8362390995025635] + - [0.23061925172805786, 3.013427972793579] + - [0.16851991415023804, 2.731928586959839] + - [-0.01123608648777008, 2.8133063316345215] + - [-0.04125901311635971, 3.03869366645813] + - [-0.02492545358836651, 3.4207561016082764] + - [-0.02121681720018387, 4.016183376312256] + - [-0.01546641904860735, 4.689133167266846] + - [-0.013392372988164425, 4.983587265014648] + - [-0.018137166276574135, 4.9434494972229] + - [-0.018187088891863823, 4.3697896003723145] + - [0.025878533720970154, 3.3325064182281494] + - [0.01972961612045765, 3.1699655055999756] + - [0.00756301311776042, 3.540755271911621] + - [0.002088402397930622, 4.39123010635376] + - [0.0015588417882099748, 5.08877420425415] + - [-0.0017910711467266083, 6.02992057800293] + - [-0.01341389212757349, 6.709871768951416] + - [-0.04953442141413689, 8.147346496582031] + - [ -0.01546641904860735, 4.689133167266846 ] + - [ -0.013392372988164425, 4.983587265014648 ] + - [ -0.018137166276574135, 4.9434494972229 ] + - [ -0.018187088891863823, 4.3697896003723145 ] + - [ 0.025878533720970154, 3.3325064182281494 ] + - [ 0.01972961612045765, 3.1699655055999756 ] + - [ 0.00756301311776042, 3.540755271911621 ] + - [ 0.002088402397930622, 4.39123010635376 ] + - [ -0.01546641904860735, 4.689133167266846 ] + - [ -0.013392372988164425, 4.983587265014648 ] + - [ -0.018137166276574135, 4.9434494972229 ] + - [ -0.018187088891863823, 4.3697896003723145 ] + - [ 0.025878533720970154, 3.3325064182281494 ] +ua : + atts : + long_name" : "eastward_wind" + units" : "m s-1" + cell_methods" : "time : mean" + cell_measures" : "area : area" + time_avg_info" : "average_T1,average_T2,average_DT" + standard_name" : "eastward_wind" + interp_method" : "conserve_order2" + grid: "standard" + stats : + - [0.021314790472388268, 4.512881278991699] + - [0.5326619744300842, 5.954967498779297] + - [1.43429434299469, 6.151541233062744] + - [3.5169997215270996, 6.718076705932617] + - [5.064070701599121, 7.533307075500488] + - [6.97215461730957, 8.621078491210938] + - [9.392412185668945, 10.132266998291016] + - [12.26109790802002, 12.243420600891113] + - [13.543569564819336, 13.345138549804688] + - [14.137928009033203, 13.860307693481445] + - [13.190452575683594, 13.078526496887207] + - [9.251249313354492, 10.972661972045898] + - [5.768674850463867, 11.529572486877441] + - [4.316129684448242, 13.369094848632812] + - [4.139902591705322, 16.318357467651367] + - [4.689526557922363, 18.68798065185547] + - [6.583802700042725, 22.241039276123047] + - [9.023049354553223, 25.71630859375] + - [12.582330703735352, 32.460975646972656] + - [ 5.064070701599121, 7.533307075500488 ] + - [ 6.97215461730957, 8.621078491210938 ] + - [ 9.392412185668945, 10.132266998291016 ] + - [ 12.26109790802002, 12.243420600891113 ] + - [ 13.543569564819336, 13.345138549804688 ] + - [ 14.137928009033203, 13.860307693481445 ] + - [ 13.190452575683594, 13.078526496887207 ] + - [ 9.251249313354492, 10.972661972045898 ] + - [ 5.768674850463867, 11.529572486877441 ] + - [ 4.316129684448242, 13.369094848632812 ] + - [ 4.139902591705322, 16.318357467651367 ] + - [ 3.5169997215270996, 6.718076705932617 ] + - [ 5.064070701599121, 7.533307075500488 ] +ta : + atts : + long_name" : "air_temperature" + units" : "K" + cell_methods" : "time : mean" + cell_measures" : "area : area" + time_avg_info" : "average_T1,average_T2,average_DT" + standard_name" : "air_temperature" + interp_method" : "conserve_order2" + grid: "standard" + stats : + - [230.75917, 8.456115] + - [227.636253, 5.954967498779297] + - [213.154672, 6.151541233062744] + - [216.603524, 6.718076705932617] + - [214.698324, 7.533307075500488] + - [213.4656466, 8.621078491210938] + - [218.45895, 5.132266998291016] + - [215.769779, 7.243420600891113] + - [216.42525, 8.345138549804688] + - [219.137928009033203, 4.860307693481445] + - [214.190452575683594, 6.078526496887207] + - [219.251249313354492, 7.972661972045898] + - [224.768674850463867, 8.529572486877441] + - [226.316129684448242, 6.369094848632812] + - [227.139902591705322, 5.318357467651367] + - [229.689526557922363, 8.68798065185547] + - [235.583802700042725, 10.241039276123047] + - [236.023049354553223, 5.71630859375] + - [239.582330703735352, 6.460975646972656] + - [242.064070701599121, 7.533307075500488 ] + - [248.97215461730957, 8.621078491210938 ] + - [253.392412185668945, 9.132266998291016 ] + - [257.26109790802002, 6.243420600891113 ] + - [264.543569564819336, 5.345138549804688 ] + - [267.137928009033203, 5.860307693481445 ] + - [268.190452575683594, 7.078526496887207 ] + - [268.251249313354492, 10.972661972045898 ] + - [270.768674850463867, 6.529572486877441 ] + - [271.316129684448242, 3.369094848632812 ] + - [272.139902591705322, 6.318357467651367 ] + - [273.5169997215270996, 6.718076705932617 ] + - [273.064070701599121, 7.533307075500488 ] \ No newline at end of file diff --git a/mdtf_test_data/synthetic/synthetic_data.py b/mdtf_test_data/synthetic/synthetic_data.py index 289ef0c..970e574 100755 --- a/mdtf_test_data/synthetic/synthetic_data.py +++ b/mdtf_test_data/synthetic/synthetic_data.py @@ -208,7 +208,7 @@ def generate_synthetic_dataset( dset[varname] = xr.DataArray(data, coords=(lat, lon), attrs=attrs) else: if len(data.shape) == 4: - print(varname) + #print(varname) assert data.shape[1] == len( lev ), f" Length of stats {data.shape[1]} must match number of levels {len(lev)}." diff --git a/mdtf_test_data/synthetic/vertical/cmip_vertical_coord.py b/mdtf_test_data/synthetic/vertical/cmip_vertical_coord.py index 9a0bfd8..754ea91 100644 --- a/mdtf_test_data/synthetic/vertical/cmip_vertical_coord.py +++ b/mdtf_test_data/synthetic/vertical/cmip_vertical_coord.py @@ -64,7 +64,7 @@ def cmip_vertical_coord(): dset_out = xr.Dataset() dset_out["plev"] = xr.DataArray( - lev, dims={"plev": plev}, coords={"plev": plev}, attrs=plev_attrs + plev, dims={"plev": plev}, coords={"plev": plev}, attrs=plev_attrs ) return dset_out From ff69ad410b620b0006e30022ba044f6db47616a7 Mon Sep 17 00:00:00 2001 From: wrongkindofdoctor <20195932+wrongkindofdoctor@users.noreply.github.com> Date: Fri, 17 Dec 2021 12:53:01 -0500 Subject: [PATCH 3/5] added more variables to cmip_mon.yml to support ENSO PODs modified print statement in synthetic_setup.py --- mdtf_test_data/config/cmip_mon.yml | 323 +++++++++++++++++--- mdtf_test_data/synthetic/synthetic_setup.py | 2 +- 2 files changed, 278 insertions(+), 47 deletions(-) diff --git a/mdtf_test_data/config/cmip_mon.yml b/mdtf_test_data/config/cmip_mon.yml index 3e57884..f0b04af 100755 --- a/mdtf_test_data/config/cmip_mon.yml +++ b/mdtf_test_data/config/cmip_mon.yml @@ -10,18 +10,19 @@ variables : - "ua" - "va" - "ta" - # - "hus" - # - "wap" - #- "pr" - # - "ts" - # - "hfss" - # - "hfls" - # - "rsus" - # - "rsds" - # - "rsdt" - # - "rsut" - # - "rlds" - # - "rlut" + - "hus" + - "wap" + - "pr" + - "ts" + - "hfss" + - "hfls" + - "rsus" + - "rsds" + - "rsdt" + - "rsut" + - "rlds" + - "rlut" + areacello : atts : cell_methods : "area: sum" @@ -382,7 +383,6 @@ ua : - [ 3.5169997215270996, 6.718076705932617 ] - [ 5.064070701599121, 7.533307075500488 ] - ta : atts : long_name" : "air_temperature" @@ -393,36 +393,267 @@ ta : standard_name" : "air_temperature" interp_method" : "conserve_order2" grid: "standard" - stats : - - [230.75917, 8.456115] - - [227.636253, 5.954967498779297] - - [213.154672, 6.151541233062744] - - [216.603524, 6.718076705932617] - - [214.698324, 7.533307075500488] - - [213.4656466, 8.621078491210938] - - [218.45895, 5.132266998291016] - - [215.769779, 7.243420600891113] - - [216.42525, 8.345138549804688] - - [219.137928009033203, 4.860307693481445] - - [214.190452575683594, 6.078526496887207] - - [219.251249313354492, 7.972661972045898] - - [224.768674850463867, 8.529572486877441] - - [226.316129684448242, 6.369094848632812] - - [227.139902591705322, 5.318357467651367] - - [229.689526557922363, 8.68798065185547] - - [235.583802700042725, 10.241039276123047] - - [236.023049354553223, 5.71630859375] - - [239.582330703735352, 6.460975646972656] - - [242.064070701599121, 7.533307075500488 ] - - [248.97215461730957, 8.621078491210938 ] - - [253.392412185668945, 9.132266998291016 ] - - [257.26109790802002, 6.243420600891113 ] - - [264.543569564819336, 5.345138549804688 ] - - [267.137928009033203, 5.860307693481445 ] - - [268.190452575683594, 7.078526496887207 ] - - [268.251249313354492, 10.972661972045898 ] - - [270.768674850463867, 6.529572486877441 ] - - [271.316129684448242, 3.369094848632812 ] - - [272.139902591705322, 6.318357467651367 ] - - [273.5169997215270996, 6.718076705932617 ] - - [273.064070701599121, 7.533307075500488 ] \ No newline at end of file + stats: + - [ 230.75917, 8.456115 ] + - [ 227.636253, 5.954967498779297 ] + - [ 213.154672, 6.151541233062744 ] + - [ 216.603524, 6.718076705932617 ] + - [ 214.698324, 7.533307075500488 ] + - [ 213.4656466, 8.621078491210938 ] + - [ 218.45895, 5.132266998291016 ] + - [ 215.769779, 7.243420600891113 ] + - [ 216.42525, 8.345138549804688 ] + - [ 219.137928009033203, 4.860307693481445 ] + - [ 214.190452575683594, 6.078526496887207 ] + - [ 219.251249313354492, 7.972661972045898 ] + - [ 224.768674850463867, 8.529572486877441 ] + - [ 226.316129684448242, 6.369094848632812 ] + - [ 227.139902591705322, 5.318357467651367 ] + - [ 229.689526557922363, 8.68798065185547 ] + - [ 235.583802700042725, 10.241039276123047 ] + - [ 236.023049354553223, 5.71630859375 ] + - [ 239.582330703735352, 6.460975646972656 ] + - [ 242.064070701599121, 7.533307075500488 ] + - [ 248.97215461730957, 8.621078491210938 ] + - [ 253.392412185668945, 9.132266998291016 ] + - [ 257.26109790802002, 6.243420600891113 ] + - [ 264.543569564819336, 5.345138549804688 ] + - [ 267.137928009033203, 5.860307693481445 ] + - [ 268.190452575683594, 7.078526496887207 ] + - [ 268.251249313354492, 10.972661972045898 ] + - [ 270.768674850463867, 6.529572486877441 ] + - [ 271.316129684448242, 3.369094848632812 ] + - [ 272.139902591705322, 6.318357467651367 ] + - [ 273.5169997215270996, 6.718076705932617 ] + - [ 273.064070701599121, 7.533307075500488 ] + +hus: + atts: + long_name": "specific_humidity" + units": "1" + cell_methods": "time : mean" + cell_measures": "area : area" + time_avg_info": "average_T1,average_T2,average_DT" + standard_name": "specific_humidity" + interp_method": "conserve_order2" + grid: "standard" + stats: + - [ 3.778116e-06, 1.83095235e-7 ] + - [ 3.771572e-06, 1.698762e-7 ] + - [ 3.573253e-06, 1.295464e-7 ] + - [ 3.456334e-06, 1.842352e-7 ] + - [ 3.44712e-06, 1.069678e-7 ] + - [ 3.483308e-06, 1.295464e-7 ] + - [ 0.003362403, 3.15677456e-7 ] + - [ 0.003317381, 5.105846e-7 ] + - [ 0.003740472, 1.3259046e-7 ] + - [ 0.0033594, 2.632877634e-7 ] + - [ 0.003801943, 1.04987646e-7 ] + - [ 0.00358355, 1.10684653e-7 ] + - [ 0.004977324, 1.2348567e-7 ] + - [ 0.004477266, 1.79684754e-7 ] + - [ 0.004178188, 1.5489754e-7 ] + - [ 0.005138075, 3.295464e-7 ] + - [ 0.005263991, 2.295464e-7 ] + - [ 0.0040496, 4.295464e-7 ] + - [ 0.00523458, 1.45746543e-7 ] + - [ 0.00568023, 3.36094364e-7 ] + - [ 0.005450083, 2.3402952e-7 ] + - [ 0.004543417, 6.1042514e-7 ] + - [ 0.006067676, 1.359468235e-7 ] + - [ 0.005495501, 1.659467825e-7 ] + - [ 0.004482094, 1.346576542e-7 ] + - [ 0.004700892, 3.789084565e-7 ] + - [ 0.005903749, 2.30965436e-7 ] + - [ 0.004486129, 1.54735695e-7 ] + - [ 0.006600861, 4.15983623e-7 ] + - [ 0.00553043, 2.4369352e-7 ] + - [ 0.006856237, 1.34675678757e-7 ] + - [ 0.006048811, 3.0468306e-7 ] + +wap: + atts: + long_name": "lagrangian_tendency_of_air_pressure" + units": "Pa s-1" + cell_methods": "time : mean" + cell_measures": "area : area" + time_avg_info": "average_T1,average_T2,average_DT" + standard_name": "lagrangian_tendency_of_air_pressure" + interp_method": "conserve_order2" + grid: "standard" + stats: + - [ -0.0002187394, 1.83095235e-5 ] + - [ -7.351468e-05, 1.698762e-5 ] + - [ 0.03285702, 1.295464e-3 ] + - [ -0.03313616, 1.842352e-3 ] + - [ 0.03486002, 1.069678e-3 ] + - [ 0.0005694181, 1.295464e-4 ] + - [ -0.0364063, 3.15677456e-3 ] + - [ 0.008867982, 5.105846e-4 ] + - [ -0.02502061, 1.3259046e-3 ] + - [ 0.03352945, 2.632877634e-3 ] + - [ -0.03433953, 1.04987646e-3 ] + - [ -0.03987761, 1.10684653e-3 ] + - [ -0.001322439, 1.2348567e-4 ] + - [ -0.054754026, 1.79684754e-3 ] + - [ 0.03385032, 1.30583276e-3 ] + - [ 0.02555078, 1.12432548e-3 ] + - [ 0.03697666, 1.02359214e-3 ] + - [ 0.02294494, 1.0258394e-3 ] + - [ -0.02019569, 1.502490235e-3 ] + - [ 0.02308778, 1.3945843e-3 ] + - [ -0.003148001, 1.4079459e-4] + - [ -0.008318922, 1.579054e-3 ] + - [ -0.01142756, 1.034964e-3] + - [ -0.004965423, 1.0235934e-5 ] + - [ -0.002604497, 1.2059127e-4 ] + - [ 9.857797e-05, 2.43325654e-5 ] + - [ -0.001189804, 1.580345e-4 ] + - [ -0.0006446782, 1.234222e-5 ] + - [ -0.0002958179, 1.250396e-5 ] + - [ 3.899816e-06, 0.2532563e-6 ] + - [ -8.875068e-05, 1.36036e-6 ] + - [ 0.0003208432, 1.25543e-4 ] + +pr: + atts: + long_name": "precipitation_flux" + units": "kg m-2 s-1" + cell_methods": "time : mean" + cell_measures": "area : area" + time_avg_info": "average_T1,average_T2,average_DT" + standard_name": "precipitation_flux" + interp_method": "conserve_order2" + grid: "standard" + stats: + - [ 4.148527e-06, 1.0358436e-6] + +ts: + atts: + long_name": "surface_temperature" + units": "K" + cell_methods": "time : mean" + cell_measures": "area : area" + time_avg_info": "average_T1,average_T2,average_DT" + standard_name": "surface_temperature" + interp_method": "conserve_order2" + grid: "standard" + stats: + - [246.7526, 2.23567] + +hfss: + atts: + long_name": "surface_upward_sensible_heat_flux" + units": "W m-2" + cell_methods": "time : mean" + cell_measures": "area : area" + time_avg_info": "average_T1,average_T2,average_DT" + standard_name": "surface_upward_sensible_heat_flux" + interp_method": "conserve_order2" + grid: "standard" + stats: + - [-5.417094, 12.02543647] + +hfls: + atts: + long_name": "surface_upward_latent_heat_flux" + units": "W m-2" + cell_methods": "time : mean" + cell_measures": "area : area" + time_avg_info": "average_T1,average_T2,average_DT" + standard_name": "surface_upward_latent_heat_flux" + interp_method": "conserve_order2" + grid: "standard" + stats: + - [ 0.3687294, 1.504234 ] + +rsus: + atts: + long_name": "surface_upwelling_shortwave_flux_in_air" + units": "W m-2" + cell_methods": "time : mean" + cell_measures": "area : area" + time_avg_info": "average_T1,average_T2,average_DT" + standard_name": "surface_upwelling_shortwave_flux_in_air" + interp_method": "conserve_order2" + grid: "standard" + stats: + - [ 12.47399, 5.2604957 ] + +rsds: + atts: + long_name": "surface_downwelling_shortwave_flux_in_air" + units": "W m-2" + cell_methods": "time : mean" + cell_measures": "area : area" + time_avg_info": "average_T1,average_T2,average_DT" + standard_name": "surface_downwelling_shortwave_flux_in_air" + interp_method": "conserve_order2" + grid: "standard" + stats: + - [ 211.7937, 50.6793543 ] + +rsdt: + atts: + long_name": "toa_incoming_shortwave_flux" + units": "W m-2" + cell_methods": "time : mean" + cell_measures": "area : area" + time_avg_info": "average_T1,average_T2,average_DT" + standard_name": "toa_incoming_shortwave_flux" + interp_method": "conserve_order2" + grid: "standard" + stats: + - [ 275.8723, 60.636432 ] + +rsut: + atts: + long_name": "toa_outgoing_shortwave_flux" + units": "W m-2" + cell_methods": "time : mean" + cell_measures": "area : area" + time_avg_info": "average_T1,average_T2,average_DT" + standard_name": "toa_outgoing_shortwave_flux" + interp_method": "conserve_order2" + grid: "standard" + stats: + - [ 182.8282, 35.033565 ] + +rlus: + atts: + long_name": "surface_upwelling_longwave_flux_in_air" + units": "W m-2" + cell_methods": "time : mean" + cell_measures": "area : area" + time_avg_info": "average_T1,average_T2,average_DT" + standard_name": "surface_upwelling_longwave_flux_in_air" + interp_method": "conserve_order2" + grid: "standard" + stats: + - [ 370.3353, 55.234536436 ] + +rlds: + atts: + long_name": "surface_downwelling_longwave_flux_in_air" + units": "W m-2" + cell_methods": "time : mean" + cell_measures": "area : area" + time_avg_info": "average_T1,average_T2,average_DT" + standard_name": "surface_downwelling_longwave_flux_in_air" + interp_method": "conserve_order2" + grid: "standard" + stats: + - [ 99.57081, 30.67465346 ] + +rlut: + atts: + long_name": "toa_outgoing_longwave_flux" + units": "W m-2" + cell_methods": "time : mean" + cell_measures": "area : area" + time_avg_info": "average_T1,average_T2,average_DT" + standard_name": "toa_outgoing_longwave_flux" + interp_method": "conserve_order2" + grid: "standard" + stats: + - [ 203.8542, 3.38437683] \ No newline at end of file diff --git a/mdtf_test_data/synthetic/synthetic_setup.py b/mdtf_test_data/synthetic/synthetic_setup.py index 8512b50..67f63f2 100755 --- a/mdtf_test_data/synthetic/synthetic_setup.py +++ b/mdtf_test_data/synthetic/synthetic_setup.py @@ -66,7 +66,7 @@ def synthetic_main( # parse the yaml dictionary var_names = yaml_dict["variables.name"] # -- Create Data - print("Generating data with time resolution of ", TIME_RES) + print("Generating data") for v in var_names: static = ( yaml_dict[v + ".static"] From c1ba7138f1741d0cc3a0640d2af85dabcb052fa4 Mon Sep 17 00:00:00 2001 From: wrongkindofdoctor <20195932+wrongkindofdoctor@users.noreply.github.com> Date: Fri, 17 Dec 2021 13:22:04 -0500 Subject: [PATCH 4/5] add rlus to cmip_mon.yml --- mdtf_test_data/config/cmip_mon.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/mdtf_test_data/config/cmip_mon.yml b/mdtf_test_data/config/cmip_mon.yml index f0b04af..e4c7206 100755 --- a/mdtf_test_data/config/cmip_mon.yml +++ b/mdtf_test_data/config/cmip_mon.yml @@ -22,6 +22,7 @@ variables : - "rsut" - "rlds" - "rlut" + - "rlus" areacello : atts : From 4d3424e9dcf6edeae408b9a7bcc6d50013507223 Mon Sep 17 00:00:00 2001 From: wrongkindofdoctor <20195932+wrongkindofdoctor@users.noreply.github.com> Date: Tue, 4 Jan 2022 12:13:20 -0500 Subject: [PATCH 5/5] add test_cmip_vertical_coord to test_synthetic_data.py --- mdtf_test_data/tests/test_synthetic_data.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/mdtf_test_data/tests/test_synthetic_data.py b/mdtf_test_data/tests/test_synthetic_data.py index bdfa32f..a2851f7 100644 --- a/mdtf_test_data/tests/test_synthetic_data.py +++ b/mdtf_test_data/tests/test_synthetic_data.py @@ -20,6 +20,7 @@ from mdtf_test_data.synthetic.vertical import ncar_hybrid_coord from mdtf_test_data.synthetic.vertical import mom6_z_coord from mdtf_test_data.synthetic.vertical import mom6_rho2_coord +from mdtf_test_data.synthetic.vertical import cmip_vertical_coord __all__ = [ "test_xr_times_from_tuples_ncar", @@ -27,13 +28,14 @@ "test_ncar_hybrid_coord", "test_gfdl_plev19_vertical_coord", "test_gfdl_vertical_coord", + "test_cmip_vertical_coord", "test_mom6_z_coord", "test_generate_random_array", "test_generate_daily_time_axis", "test_generate_hourly_time_axis", "test_generate_monthly_time_axis", "test_generate_synthetic_dataset", - "test_dataset_stats", + "test_dataset_stats" ] @@ -44,7 +46,8 @@ def pytest_namespace(): "ncar_hybrid": None, "gfdl_plev19": None, "gfdl_vert": None, - "dummy_dset": None, + "cmip_vert": None, + "dummy_dset": None } @@ -107,6 +110,13 @@ def test_gfdl_vertical_coord(): pytest.gfdl_vert = result +def test_cmip_vertical_coord(): + result = cmip_vertical_coord() + assert isinstance(result, xr.Dataset) + assert np.allclose(float(result.plev.sum()), 15030.0) + pytest.cmip_vert = result + + def test_mom6_z_coord(): result = mom6_z_coord() assert isinstance(result, xr.Dataset)