diff --git a/ChangeLog b/ChangeLog index e72b0ac4..6291c063 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,33 @@ This file describes what tags were created and why ================================================================================ +Originator: aliceb +Date: 12 October 2016 +Model: CESM_postprocessing +Version: CESM_postprocessing_v0.1.3 +One-line: add additional WACCM datasets. Closes github issue #37. + + modified: copy_html + modified: ../atm_diag/functions_waccm.ncl + modified: ../atm_diag/html/model-obs/wset2/wset2_2.htm + modified: ../atm_diag/html/model-obs/wset3/wset3_2.htm + modified: ../atm_diag/html/model-obs/wset4/wset4_2.htm + modified: ../atm_diag/html/model-obs/wset5/wset5_2.htm + modified: ../atm_diag/html/model1-model2/wset3/wset3_2.htm + modified: ../atm_diag/html/model1-model2/wset4/wset4_2.htm + modified: ../atm_diag/html/model1-model2/wset5/wset5_2.htm + modified: ../atm_diag/plot_waccm_cycle.ncl + modified: ../atm_diag/plot_waccm_map.ncl + modified: ../atm_diag/plot_waccm_vcycle.ncl + modified: ../atm_diag/plot_waccm_vzonal.ncl + modified: ../atm_diag/tables_waccm.ncl + modified: ../diagnostics/diagnostics/atm/atm_avg_generator.py + + add: ../averager/pp_tests/control_ocn_series.py + add: ../averager/pp_tests/runAvg_ocn_mpi.sh + +================================================================================ + Originator: aliceb Date: 11 October 2016 Model: CESM_postprocessing diff --git a/Tools/copy_html b/Tools/copy_html index a4204a85..7178bb8c 100755 --- a/Tools/copy_html +++ b/Tools/copy_html @@ -206,7 +206,7 @@ def check_ssh_key(env): shell=True) except subprocess.CalledProcessError as e: print('WARNING: unable to connect to remote web host {0}@{1} without a password'.format(env['GLOBAL_WEBLOGIN'],env['GLOBAL_WEBHOST'])) - print(' You will be prompted for a password in order to copy the files') + print(' You will be prompted for a password multiple times in order to copy the files.') #======================================================================= diff --git a/atm_diag/functions_waccm.ncl b/atm_diag/functions_waccm.ncl index 3bcaa1f4..22072088 100644 --- a/atm_diag/functions_waccm.ncl +++ b/atm_diag/functions_waccm.ncl @@ -35,6 +35,8 @@ begin delete(tmp) tmp = vinth2p(ivar, hyam, hybm, lev, ps, interp, p0, 1, extrap) + tmp@long_name = ivar@long_name + tmp@units = ivar@units ; This still allows extrapolation beyond the top of the model, so set those ; to the fill value. @@ -65,6 +67,74 @@ begin end +; Scale mixing ratio and length variables. +procedure waccm_scaleunits(varname, iunits, varmin, varmax, scale, ounits) + +begin + + ; Adjust units + scale = 1. + ounits = iunits + + if ((iunits .eq. "mol/mol") .or. (iunits .eq. "kg/kg")) then + if (varmax .lt. 1e-12) then + scale = 1e15 + ounits = "ppq" + else + if (varmax .lt. 1e-9) then + scale = 1e12 + ounits = "ppt" + else + if (varmax .lt. 1e-6) then + scale = 1e9 + ounits = "ppb" + else + if (varmax .lt. 1e-3) then + scale = 1e6 + ounits = "ppm" + end if + end if + end if + end if + + ; For water vapor, always want ppm for WACCM + if (varname .eq. "H2O") then + scale = 1e6 + ounits = "ppm" + end if + + ; For carbon monoxide, always want ppm for WACCM + if (varname .eq. "CO") then + scale = 1e6 + ounits = "ppm" + end if + + if (scale .ne. 1.) then + if (iunits .eq. "mol/mol") then + ounits = ounits + "v" + end if + end if + end if + + if (iunits .eq. "m") then + if (varmax .gt. 1e3) then + scale = 1e-3 + ounits = "km" + else + if (varmax .lt. 1e-2) then + scale = 1e6 + ounits = "um" + else + if (varmax .lt. 1.) then + scale = 1e2 + ounits = "cm" + end if + end if + end if + end if +end + + ; Does a vertical interpolation of the supplied data to pressure ; levels. ; @@ -95,6 +165,8 @@ begin delete(tmp) tmp = vinth2p(ivar, hyam, hybm, lev, ps, interp, p0, 1, extrap) + tmp@long_name = ivar@long_name + tmp@units = ivar@units ; This still allows extrapolation beyond the top of the model, so set those ; to the fill value. @@ -145,8 +217,84 @@ begin end +undef("nice_mnmxintvl_log") +function nice_mnmxintvl_log(minval, maxval, numlevs, drange) + +local minabs, maxabs, nicelevs, epos, eneg + +begin + + ; Default drange to cover full range if nothing was provided. + if (drange .eq. 0) then + drange = abs(log10(max(abs(maxval))) - log10(max(abs(minval)))) + + if (drange < 3) then + drange = 3 + end if + + if (drange > 15) then + drange = 15 + end if + end if + + + ; Does the range span 0? + if (minval * maxval .lt. 0.) then + + ; Pick a spacing based upon the largest value. + maxabs = max((/ abs(minval), abs(maxval) /)) + minabs = maxabs / (10^(drange)) + + maxmin = nice_mnmxintvl(log10(minabs), log10(maxabs), numlevs / 2, False) + + nicelevs = tointeger((maxmin(1) - maxmin(0)) / maxmin(2) + 1) + + eneg = fspan(maxmin(1), maxmin(0), nicelevs) + eneg = -1 * (10.^eneg) + + epos = -1 * eneg(::-1) + + elevels = array_append_record(eneg, epos, 0) + + delete(eneg) + delete(epos) + else + + ; One sided, so just take the log and build a scale. + if ((minval .eq. 0.) .or. (maxval .eq. 0.)) then + + ; Since we can't go to zero, use the drange. + ; Could look for largest non-zero value. + if (maxval .eq. 0.) then + maxval = minval / (10^(drange)) + else + minval = maxval / (10^(drange)) + end if + end if + + if (minval .lt. 0.) then + maxmin = nice_mnmxintvl(log10(abs(maxval)), log10(abs(minval)), numlevs, False) + else + maxmin = nice_mnmxintvl(log10(abs(minval)), log10(abs(maxval)), numlevs, False) + end if + + nicelevs = tointeger((maxmin(1) - maxmin(0)) / maxmin(2) + 1) + + elevels = fspan(maxmin(0), maxmin(1), nicelevs) + elevels = 10.^elevels + + if (minval .lt. 0.) then + elevels = elevels(::-1) * -1 + end if + end if + + return(elevels) +end + + + ;***********************************************************************; -; Procedure : gsn_set_pres_hgt_axes ; +; Procedure : set_pres_hgt_axes ; ; pres: numeric ; ; res: logical ; ; add_hgt: logical ; @@ -161,15 +309,14 @@ end ; values, and the right for height values. The pressure values are ; ; assumed to be in millibars. ; ;***********************************************************************; - undef("set_pres_hgt_axes") procedure set_pres_hgt_axes(pres:numeric,res:logical,add_hgt:logical) local hgt, hnice, pnice, ptmp begin if(pres(0).lt.pres(dimsizes(pres)-1)) - ptmp = tofloat(pres(::-1)) ; reverse values so descending order + ptmp = tofloat_wunits(pres(::-1)) ; reverse values so descending order else - ptmp = tofloat(pres) ; Make sure values are floating point. + ptmp = tofloat_wunits(pres) ; Make sure values are floating point. end if if(.not.(isatt(res,"sfYCStartV").and.isatt(res,"sfYCEndV"))) diff --git a/atm_diag/html/model-obs/wset2/wset2_2.htm b/atm_diag/html/model-obs/wset2/wset2_2.htm index 0fc6237b..713ce1bb 100644 --- a/atm_diag/html/model-obs/wset2/wset2_2.htm +++ b/atm_diag/html/model-obs/wset2/wset2_2.htm @@ -50,14 +50,6 @@ plot plot plot - - T, Mesopause - Temperature - plot - plot - plot - plot - plot

@@ -108,14 +100,6 @@ plot plot plot - - T, Mesopause - Temperature - plot - plot - plot - plot - plot

@@ -134,14 +118,6 @@ 10S-10N 55N-65N 60N-90N - - U, 10 Hpa - Zonal Wind - plot - plot - plot - plot - plot H2O, 85 hPa Water Vapor diff --git a/atm_diag/html/model-obs/wset3/wset3_2.htm b/atm_diag/html/model-obs/wset3/wset3_2.htm index d7220ebf..29f76a2c 100644 --- a/atm_diag/html/model-obs/wset3/wset3_2.htm +++ b/atm_diag/html/model-obs/wset3/wset3_2.htm @@ -15,58 +15,206 @@ ERA-Interim Reanalysis 1989-2005 60S-90S 55S-65S + 20S-40S 10S-10N + 20N-40N 55N-65N 60N-90N - H2O (Stratosphere) + Stratosphere + + + + + + + + + + H2O Water Vapor plot plot + plot plot + plot plot plot - H2O (Middle) - Water Vapor - plot - plot - plot - plot - plot + O3 + Ozone + plot + plot + plot + plot + plot + plot + plot - RELHUM (Stratosphere) + RELHUM Relative Humidity plot plot + plot plot + plot plot plot - T (Stratosphere) + T Temperature plot plot + plot plot + plot plot plot - T (Middle) + U + Zonal Wind + plot + plot + plot + plot + plot + plot + plot + + V + Meridional Wind + plot + plot + plot + plot + plot + plot + plot + +
+
+
+
+
+
+
+
+
+
+
+ +
+ MERRA Reanalysis 1975-2015 + 60S-90S + 55S-65S + 20S-40S + 10S-10N + 20N-40N + 55N-65N + 60N-90N + + Stratosphere + + + + + + + + + + H2O + Water Vapor + plot + plot + plot + plot + plot + plot + plot + + T Temperature - plot - plot - plot - plot - plot + plot + plot + plot + plot + plot + plot + plot - U (Middle) + U Zonal Wind - plot - plot - plot - plot - plot + plot + plot + plot + plot + plot + plot + plot + + V + Meridional Wind + plot + plot + plot + plot + plot + plot + plot + + Middle Atmosphere + + + + + + + + + + H2O + Water Vapor + plot + plot + plot + plot + plot + plot + plot + T + Temperature + plot + plot + plot + plot + plot + plot + plot + + U + Zonal Wind + plot + plot + plot + plot + plot + plot + plot + + V + Meridional Wind + plot + plot + plot + plot + plot + plot + plot + +
+



@@ -78,109 +226,254 @@

- MLS 2004-2012 + MLS 2004-2016 60S-90S 55S-65S + 20S-40S 10S-10N + 20N-40N 55N-65N 60N-90N - H2O (Stratosphere) + Stratosphere + + + + + + + + + + CH3Cl + Methyl Chloride + plot + plot + plot + plot + plot + plot + plot + + ClO + Chlorine Monoxide + plot + plot + plot + plot + plot + plot + plot + + CO + Carbon Monoxide + plot + plot + plot + plot + plot + plot + plot + + H2O Water Vapor plot plot + plot plot + plot plot plot - H2O (Middle) - Water Vapor - plot - plot - plot - plot - plot + HCl + Hydrochloric Acid + plot + plot + plot + plot + plot + plot + plot + + HNO3 + Nitric Acid + plot + plot + plot + plot + plot + plot + plot + + HO2 + Hydroperoxyl + plot + plot + plot + plot + plot + plot + plot + + HOCl + Chlorine Hydroxide + plot + plot + plot + plot + plot + plot + plot - RELHUM (Stratosphere) + N2O + Nitrous Oxide + plot + plot + plot + plot + plot + plot + plot + + O3 + Ozone + plot + plot + plot + plot + plot + plot + plot + + OH + Hydroxyl + plot + plot + plot + plot + plot + plot + plot + + RELHUM Relative Humidity plot plot + plot plot + plot plot plot - T (Stratosphere) + T Temperature plot plot + plot plot + plot plot plot - T (Middle) - Temperature - plot - plot - plot - plot - plot -
-
-
-
-
-
-
-
-
+ Z3 + Geopotential Height + plot + plot + plot + plot + plot + plot + plot -
- MERRA Reanalysis 1975-2015 - 60S-90S - 55S-65S - 10S-10N - 55N-65N - 60N-90N + Middle Atmosphere + + + + + + + + - H2O (Stratosphere) - Water Vapor - plot - plot - plot - plot - plot + CO + Carbon Monoxide + plot + plot + plot + plot + plot + plot + plot - H2O (Middle) + H2O Water Vapor - plot - plot - plot - plot - plot + plot + plot + plot + plot + plot + plot + plot - T (Stratosphere) - Temperature - plot - plot - plot - plot - plot + HO2 + Hydroperoxyl + plot + plot + plot + plot + plot + plot + plot + + O3 + Ozone + plot + plot + plot + plot + plot + plot + plot - T (Middle) + OH + Hydroxyl + plot + plot + plot + plot + plot + plot + plot + + RELHUM + Relative Humidity + plot + plot + plot + plot + plot + plot + plot + + T Temperature - plot - plot - plot - plot - plot + plot + plot + plot + plot + plot + plot + plot - U (Middle) - Zonal Wind - plot - plot - plot - plot - plot + Z3 + Geopotential Height + plot + plot + plot + plot + plot + plot + plot diff --git a/atm_diag/html/model-obs/wset4/wset4_2.htm b/atm_diag/html/model-obs/wset4/wset4_2.htm index 96341092..e68595d0 100644 --- a/atm_diag/html/model-obs/wset4/wset4_2.htm +++ b/atm_diag/html/model-obs/wset4/wset4_2.htm @@ -21,7 +21,17 @@ DJF ANN - H2O (Stratosphere) + Stratosphere + + + + + + + + + + H2O Water Vapor plot plot @@ -31,17 +41,7 @@ plot plot - H2O (Middle) - Water Vapor - plot - plot - plot - plot - plot - plot - plot - - RELHUM (Stratosphere) + RELHUM Relative Humidity plot plot @@ -51,7 +51,7 @@ plot plot - T (Stratosphere) + T Temperature plot plot @@ -61,25 +61,145 @@ plot plot - T (Middle) + U + Zonal Wind + plot + plot + plot + plot + plot + plot + plot + + V + Meridional Wind + plot + plot + plot + plot + plot + plot + plot + +
+
+
+
+
+
+
+
+
+ +
+ MERRA Reanalysis (1975-2015) + JUN + DEC + MAM + JJA + SON + DJF + ANN + + Stratosphere + + + + + + + + + + H2O + Water Vapor + plot + plot + plot + plot + plot + plot + plot + + T Temperature - plot - plot - plot - plot - plot - plot - plot - - U (Middle) + plot + plot + plot + plot + plot + plot + plot + + U Zonal Wind - plot - plot - plot - plot - plot - plot - plot + plot + plot + plot + plot + plot + plot + plot + + V + Meridional Wind + plot + plot + plot + plot + plot + plot + plot + + Middle Atmosphere + + + + + + + + + + H2O + Water Vapor + plot + plot + plot + plot + plot + plot + plot + + T + Temperature + plot + plot + plot + plot + plot + plot + plot + + U + Zonal Wind + plot + plot + plot + plot + plot + plot + plot + + V + Meridional Wind + plot + plot + plot + plot + plot + plot + plot

@@ -92,7 +212,7 @@

- MLS 2004-2012 + MLS 2004-2016 JUN DEC MAM @@ -101,7 +221,57 @@ DJF ANN - H2O (Stratosphere) + Stratosphere + + + + + + + + + + BrO + Bromine Monoxide + plot + plot + plot + plot + plot + plot + plot + + CH3Cl + Methyl Chloride + plot + plot + plot + plot + plot + plot + plot + + ClO + Chlorine Monoxide + plot + plot + plot + plot + plot + plot + plot + + CO + Carbon Monoxide + plot + plot + plot + plot + plot + plot + plot + + H2O Water Vapor plot plot @@ -111,17 +281,77 @@ plot plot - H2O (Middle) - Water Vapor - plot - plot - plot - plot - plot - plot - plot + HCl + Hydrochloric Acid + plot + plot + plot + plot + plot + plot + plot + + HNO3 + Nitric Acid + plot + plot + plot + plot + plot + plot + plot - RELHUM (Stratosphere) + HO2 + Hydroperoxyl + plot + plot + plot + plot + plot + plot + plot + + HOCl + Chlorine Hydroxide + plot + plot + plot + plot + plot + plot + plot + + N2O + Nitrous Oxide + plot + plot + plot + plot + plot + plot + plot + + O3 + Ozone + plot + plot + plot + plot + plot + plot + plot + + OH + Hydroxyl + plot + plot + plot + plot + plot + plot + plot + + RELHUM Relative Humidity plot plot @@ -131,7 +361,7 @@ plot plot - T (Stratosphere) + T Temperature plot plot @@ -141,85 +371,105 @@ plot plot - T (Middle) - Temperature - plot - plot - plot - plot - plot - plot - plot + Z3 + Geopotential Height + plot + plot + plot + plot + plot + plot + plot -
-
-
-
-
-
-
-
-
+ Middle Atmosphere + + + + + + + + -
- MERRA Reanalysis (1975-2015) - JUN - DEC - MAM - JJA - SON - DJF - ANN + CO + Carbon Monoxide + plot + plot + plot + plot + plot + plot + plot - H2O (Stratosphere) + H2O Water Vapor - plot - plot - plot - plot - plot - plot - plot + plot + plot + plot + plot + plot + plot + plot - H2O (Middle) - Water Vapor - plot - plot - plot - plot - plot - plot - plot + HO2 + Hydroperoxyl + plot + plot + plot + plot + plot + plot + plot - T (Stratosphere) - Temperature - plot - plot - plot - plot - plot - plot - plot + O3 + Ozone + plot + plot + plot + plot + plot + plot + plot + + OH + Hydroxyl + plot + plot + plot + plot + plot + plot + plot - T (Middle) + RELHUM + Relative Humidity + plot + plot + plot + plot + plot + plot + plot + + T Temperature - plot - plot - plot - plot - plot - plot - plot + plot + plot + plot + plot + plot + plot + plot - U (Middle) - Zonal Wind - plot - plot - plot - plot - plot - plot - plot + Z3 + Geopotential Height + plot + plot + plot + plot + plot + plot + plot diff --git a/atm_diag/html/model-obs/wset5/wset5_2.htm b/atm_diag/html/model-obs/wset5/wset5_2.htm index 941ec947..4c248948 100644 --- a/atm_diag/html/model-obs/wset5/wset5_2.htm +++ b/atm_diag/html/model-obs/wset5/wset5_2.htm @@ -34,6 +34,22 @@ plot plot plot + + RELHUM, 100 hPa + Relative Humidity + plot + plot + plot + plot + plot + + T, 100 hPa + Temperature + plot + plot + plot + plot + plot H2O, 118 hPa Water Vapor @@ -74,6 +90,14 @@ plot plot plot + + T, 100 hPa + Temperature + plot + plot + plot + plot + plot H2O, 118 hPa Water Vapor @@ -92,7 +116,7 @@

- MLS 2004-2012 + MLS 2004-2016 JUL AUG JJA @@ -114,6 +138,30 @@ plot plot plot + + RELHUM, 100 hPa + Relative Humidity + plot + plot + plot + plot + plot + + T, 100 hPa + Temperature + plot + plot + plot + plot + plot + + Z3, 100 hPa + Geopotential Height + plot + plot + plot + plot + plot H2O, 118 hPa Water Vapor diff --git a/atm_diag/html/model1-model2/wset3/wset3_2.htm b/atm_diag/html/model1-model2/wset3/wset3_2.htm index fd982d65..889e2898 100644 --- a/atm_diag/html/model1-model2/wset3/wset3_2.htm +++ b/atm_diag/html/model1-model2/wset3/wset3_2.htm @@ -15,23 +15,119 @@ Middle Atmosphere 60S-90S 55S-65S + 20S-40S 10S-10N + 20N-40N 55N-65N 60N-90N + + CH4 + Methane + plot + plot + plot + plot + plot + plot + plot + + CO + Carbon Monoxide + plot + plot + plot + plot + plot + plot + plot + + CO2 + Carbon Dioxide + plot + plot + plot + plot + plot + plot + plot H2O Water Vapor plot plot + plot plot + plot plot plot + + O3 + Ozone + plot + plot + plot + plot + plot + plot + plot + + OH + Hydroxyl + plot + plot + plot + plot + plot + plot + plot + + QRL_TOT + Merged LW Heating + plot + plot + plot + plot + plot + plot + plot + + QRS_TOT + Merged SW Heating + plot + plot + plot + plot + plot + plot + plot + + RELHUM + Relative Humidity + plot + plot + plot + plot + plot + plot + plot + + SO2 + Sulfur Dioxide + plot + plot + plot + plot + plot + plot + plot T Temperature plot plot + plot plot + plot plot plot @@ -39,9 +135,31 @@ Zonal Wind plot plot + plot plot + plot plot plot + + V + Meridional Wind + plot + plot + plot + plot + plot + plot + plot + + Z3 + Geopotential Height + plot + plot + plot + plot + plot + plot + plot

@@ -57,31 +175,109 @@ Stratosphere 60S-90S 55S-65S + 20S-40S 10S-10N + 20N-40N 55N-65N 60N-90N + + CH4 + Methane + plot + plot + plot + plot + plot + plot + plot + + CO + Carbon Monoxide + plot + plot + plot + plot + plot + plot + plot + + CO2 + Carbon Dioxide + plot + plot + plot + plot + plot + plot + plot H2O Water Vapor plot plot + plot plot + plot plot plot + + N2O + Nitrous Oxide + plot + plot + plot + plot + plot + plot + plot + + O3 + Ozone + plot + plot + plot + plot + plot + plot + plot + + OH + Hydroxyl + plot + plot + plot + plot + plot + plot + plot RELHUM Relative Humidity plot plot + plot plot + plot plot plot + + SO2 + Sulfur Dioxide + plot + plot + plot + plot + plot + plot + plot T Temperature plot plot + plot plot + plot plot plot diff --git a/atm_diag/html/model1-model2/wset4/wset4_2.htm b/atm_diag/html/model1-model2/wset4/wset4_2.htm index 835c40c9..80d23682 100644 --- a/atm_diag/html/model1-model2/wset4/wset4_2.htm +++ b/atm_diag/html/model1-model2/wset4/wset4_2.htm @@ -20,6 +20,36 @@ SON DJF ANN + + CH4 + Methane + plot + plot + plot + plot + plot + plot + plot + + CO + Carbon Monoxide + plot + plot + plot + plot + plot + plot + plot + + CO2 + Carbon Dioxide + plot + plot + plot + plot + plot + plot + plot H2O Water Vapor @@ -30,6 +60,66 @@ plot plot plot + + O3 + Ozone + plot + plot + plot + plot + plot + plot + plot + + OH + Hydroxide + plot + plot + plot + plot + plot + plot + plot + + QRL_TOT + Merged LW Heating + plot + plot + plot + plot + plot + plot + plot + + QRS_TOT + Merged SW Heating + plot + plot + plot + plot + plot + plot + plot + + RELHUM + Relative Humidity + plot + plot + plot + plot + plot + plot + plot + + SO2 + Sulfur Dioxide + plot + plot + plot + plot + plot + plot + plot T Temperature @@ -50,6 +140,16 @@ plot plot plot + + V + Meridional Wind + plot + plot + plot + plot + plot + plot + plot

@@ -70,6 +170,36 @@ SON DJF ANN + + CH4 + Methane + plot + plot + plot + plot + plot + plot + plot + + CO + Carbon Monoxide + plot + plot + plot + plot + plot + plot + plot + + CO2 + Carbon Dioxide + plot + plot + plot + plot + plot + plot + plot H2O Water Vapor @@ -80,6 +210,36 @@ plot plot plot + + N2O + Nitrous Oxide + plot + plot + plot + plot + plot + plot + plot + + O3 + Ozone + plot + plot + plot + plot + plot + plot + plot + + OH + Hydroxide + plot + plot + plot + plot + plot + plot + plot RELHUM Relative Humidity @@ -90,6 +250,16 @@ plot plot plot + + SO2 + Sulfur Dioxide + plot + plot + plot + plot + plot + plot + plot T Temperature diff --git a/atm_diag/html/model1-model2/wset5/wset5_2.htm b/atm_diag/html/model1-model2/wset5/wset5_2.htm index 01b39904..47f17548 100644 --- a/atm_diag/html/model1-model2/wset5/wset5_2.htm +++ b/atm_diag/html/model1-model2/wset5/wset5_2.htm @@ -42,6 +42,30 @@ plot plot plot + + RELHUM + Relative Humidity + plot + plot + plot + plot + plot + + T + Temperature + plot + plot + plot + plot + plot + + Z3 + Geopotential Height + plot + plot + plot + plot + plot
118 hPa diff --git a/atm_diag/plot_waccm_cycle.ncl b/atm_diag/plot_waccm_cycle.ncl index 6d4ecdb0..ed4528de 100644 --- a/atm_diag/plot_waccm_cycle.ncl +++ b/atm_diag/plot_waccm_cycle.ncl @@ -145,7 +145,27 @@ begin ; Do vertical interpolation first, since for hydrid coordinates, ; this should be done on lev x lat x lon data prior to averaging. ; Also calculate a zonal average. - var1 = dim_avg_Wrap(inptr1[:]->$vars1(i)$) + if (isfilevar(inptr1[0], vars1(i))) then + var1 = dim_avg_Wrap(inptr1[:]->$vars1(i)$) + else + + ; If it is missing water vapor, look for specific humidity and convert. + if (vars1(i) .eq. "H2O") then + if (isfilevar(inptr1[0], "SHUM")) then + var1 = dim_avg_Wrap(inptr1[:]->SHUM) + var1 = (/ var1 * 28.89 / 18. / 1e3 /) ; convert from g/kg to ppv + else + if (isfilevar(inptr1[0], "Q")) then + var1 = dim_avg_Wrap(inptr1[:]->Q) + var1 = (/ var1 * 28.89 / 18. /) ; convert from kg/kg to ppv + else + continue + end if + end if + else + continue + end if + end if ; If the OBS/Model2 don't have a corresponding field, then ; skip it. @@ -174,7 +194,13 @@ begin ; iterate over the latitudes nlats = dimsizes(minLat) + lowP = min((/ min(var1&lev), minP(i) /)) do j = 0, nlats-1 + + ; Skip cases that are outside the range of the model data. + if (minP(i) .lt. min(var1&lev)) then + continue + end if ; Select the region of interest and do a latitude average. pan@txString = sprintf("%5.1f", minLat(j)) + " to " + sprintf("%5.1f", maxLat(j)) @@ -336,9 +362,9 @@ begin ; ; NOTE: For WACCM, we need to make reanalysis data sets that go ; to higher altitudes (lower pressures). - obs = (/ "MLS", "ERAI", "MERRAW_19x2" /) + obs = (/ "mlsw", "ERAI", "MERRAW_19x2" /) obsName = (/ "MLS", "ERAI", "MERRA" /) - years = (/ "(2004-2012)", "(1989-2005)", "(1975-2015)" /) + years = (/ "(2004-2016)", "(1989-2005)", "(1975-2015)" /) nobs = dimsizes(obs) do r = 0, nobs-1 @@ -348,6 +374,10 @@ begin print(" plot_waccm_vcycle : ERROR - Missing " + obs(r) + " data.") else inptr2 = addfiles(files,"r") + + if (isatt(inptr2,"yrs_averaged")) then + years(r) = "(" + inptr2@yrs_averaged + ")" + end if end if delete(files) diff --git a/atm_diag/plot_waccm_map.ncl b/atm_diag/plot_waccm_map.ncl index a4387835..1a34f22b 100644 --- a/atm_diag/plot_waccm_map.ncl +++ b/atm_diag/plot_waccm_map.ncl @@ -106,7 +106,9 @@ begin cnlvls = 15 diffcnlvls = 12 end if - cres@mpCenterLonF = 180 + cres@mpCenterLonF = 180 + + dres = cres pan = True pan@gsnMaximize = True @@ -117,13 +119,33 @@ begin nvars = dimsizes(vars1) do i = 0, nvars-1 - + ; Do vertical interpolation first, since for hydrid coordinates, ; this should be done on lev x lat x lon data prior to averaging. ; Also calculate a zonal average. - var1 = inptr1->$vars1(i)$ + if (isfilevar(inptr1, vars1(i))) then + var1 = inptr1->$vars1(i)$ + else - ; If minP and MaxP don't match, then average the valure in the range + ; If it is missing water vapor, look for specific humidity and convert. + if (vars1(i) .eq. "H2O") then + if (isfilevar(inptr1, "SHUM")) then + var1 = inptr1->SHUM + var1 = (/ var1 * 28.89 / 18. / 1e3 /) ; convert from g/kg to ppv + else + if (isfilevar(inptr1, "Q")) then + var1 = inptr1->Q + var1 = (/ var1 * 28.89 / 18. /) ; convert from g/kg to ppv + else + continue + end if + end if + else + continue + end if + end if + + ; If minP and MaxP don't match, then average the value in the range ; specified. if (minP(i) .ne. maxP(i)) then var1a = dim_avg_n_Wrap(var1(:, {minP(i):maxP(i)}, :, :), 1) @@ -157,7 +179,7 @@ begin end if end if - ; If minP and MaxP don't match, then average the valure in the range + ; If minP and MaxP don't match, then average the value in the range ; specified. if (minP(i) .ne. maxP(i)) then var2a = dim_avg_n_Wrap(var2(:, {minP(i):maxP(i)}, :, :), 1) @@ -196,6 +218,44 @@ begin end if ; Assign the contour levels for different variables + varmax = max((/ max(var1a), max(var2a) /)) + varmin = min((/ min(var1a), min(var2a) /)) + + + scale = 1. + units = var1a@units + + waccm_scaleunits(vars1(i), var1a@units, varmin, varmax, scale, units) + + if (scale .ne. 1.) then + var1a@units = units + + var1a = (/ var1a * scale /) + var2a = (/ var2a * scale /) + var3a = (/ var3a * scale /) + diff = (/ diff * scale /) + + varmax = max((/ max(var1a), max(var2a) /)) + varmin = min((/ min(var1a), min(var2a) /)) + end if + + maxmin = nice_mnmxintvl(varmin, varmax, 15, False) + symMinMaxPlt(diff, 15, False, dres) + + + if (vars1(i) .eq. "H2O") then + var1a@long_name = "Water Vapor" + con = fspan(1, 8, 15) + dcon = (/ -1.8,-1.5,-1.2,-.9,-.6,-.3,-.1,0,.1,.3,.6,.9,1.2,1.5,1.8 /) + end if + + if (vars1(i) .eq. "RELHUM") then + var1a@long_name = "Relative Humidity" + var1a@units = "%" + con = fspan(0., 140., 15) + dcon = (/ -18.,-15.,-12.,-9.,-6.,-3.,-1.,0.,1.,3.,6.,9.,12.,15.,18. /) + end if + if (vars1(i) .eq. "T") then var1a@long_name = "Temperature" var1a@units = "K" @@ -209,24 +269,10 @@ begin end if end if - if (vars1(i) .eq. "U") then - var1a@long_name = "Zonal Wind" - var1a@units = "m/s" - con = fspan(-70., 70., 15) - dcon = (/ -18.,-15.,-12.,-9.,-6.,-3.,-1.,0.,1.,3.,6.,9.,12.,15.,18. /) + if (vars1(i) .eq. "Z3") then + var1a@long_name = "Geopotential Height" end if - if (vars1(i) .eq. "H2O") then - var1a = (/ var1a * 1e6 /) - var2a = (/ var2a * 1e6 /) - var3a = (/ var3a * 1e6 /) - diff = (/ diff * 1e6 /) - - var1a@long_name = "Water Vapor" - var1a@units = "ppmv" - con = fspan(1, 8, 15) - dcon = (/ -1.8,-1.5,-1.2,-.9,-.6,-.3,-.1,0,.1,.3,.6,.9,1.2,1.5,1.8 /) - end if var2a@long_name = var1a@long_name var2a@units = var1a@units @@ -243,7 +289,16 @@ begin if (color_type .eq. "COLOR") then cres@lbLabelStride = 2 cres@lbOrientation = "Horizontal" - cres@cnLevels = con(:) + if (isvar("con")) then + cres@cnLevelSelectionMode = "ExplicitLevels" + cres@cnLevels = con(:) + delete(con) + else + cres@cnLevelSelectionMode = "ManualLevels" + cres@cnMinLevelValF = maxmin(0) + cres@cnMaxLevelValF = maxmin(1) + cres@cnLevelSpacingF = maxmin(2) + end if cres@cnFillPalette = cmap cres@cnLinesOn = False cres@cnLineLabelsOn = False @@ -279,27 +334,33 @@ begin mind = min(diff) maxd = max(diff) - cres@tiMainString = case1 + " - " + case2 + dres@tiMainString = case1 + " - " + case2 if (color_type .eq. "COLOR") then - cres@lbLabelStride = 1 - cres@lbOrientation = "Vertical" - cres@lbBoxMinorExtentF = 0.18 - cres@cnLevels = dcon(:) - cres@cnFillPalette = cmapd - cres@lbTitleString = "MIN = " + sprintf("%6.2f",mind) + " MAX = " + sprintf("%6.2f",maxd) -; cres@cnLinesOn = True -; cres@cnLineLabelsOn = True -; cres@cnLineLabelPlacementMode = "Constant" + dres@lbLabelStride = 1 + dres@lbOrientation = "Vertical" + dres@lbBoxMinorExtentF = 0.18 + if (isvar("dcon")) then + dres@cnLevelSelectionMode = "ExplicitLevels" + dres@cnLevels = dcon(:) + delete(dcon) + else + dres@cnLevelSelectionMode = "ManualLevels" + end if + dres@cnFillPalette = cmapd + dres@lbTitleString = "MIN = " + sprintf("%6.2f",mind) + " MAX = " + sprintf("%6.2f",maxd) +; res@cnLinesOn = True +; res@cnLineLabelsOn = True +; res@cnLineLabelPlacementMode = "Constant" else mnmxint = nice_mnmxintvl (mind, maxd, diffcnlvls, False) - cres@cnMinLevelValF = mnmxint(0) - cres@cnMaxLevelValF = mnmxint(1) - cres@cnLevelSpacingF = mnmxint(2) + dres@cnMinLevelValF = mnmxint(0) + dres@cnMaxLevelValF = mnmxint(1) + dres@cnLevelSpacingF = mnmxint(2) delete(mnmxint) end if cres@pmLabelBarOrthogonalPosF = 0.02 - cnplot(2) = gsn_csm_contour_map(wks, diff(0,:,:), cres) + cnplot(2) = gsn_csm_contour_map(wks, diff(0,:,:), dres) ; Create the panel. @@ -333,10 +394,10 @@ begin ; Define the model variables and the range of pressure levels over ; which to plot them. - vars = (/ "H2O", "H2O", "H2O" /) - minP = (/ 118., 100., 85. /) - maxP = (/ 118., 100., 85. /) - pAbbr = (/ "118", "100", "85" /) + vars = (/ "H2O", "H2O", "H2O", "Z3", "T", "RELHUM" /) + minP = (/ 118., 100., 85., 100., 100., 100. /) + maxP = (/ 118., 100., 85., 100., 100., 100. /) + pAbbr = (/ "118", "100", "85", "100", "100", "100" /) do p = 0, nPeriods-1 @@ -357,9 +418,9 @@ begin ; ; NOTE: For WACCM, we need to make reanalysis data sets that go ; to higher altitudes (lower pressures). - obs = (/ "MLS", "ERAI", "MERRAW_19x2" /) + obs = (/ "mlsw", "ERAI", "MERRAW_19x2" /) obsName = (/ "MLS", "ERAI", "MERRA" /) - years = (/ "(2004-2012)", "(1989-2005)", "(1975-2015)" /) + years = (/ "(2004-2016)", "(1989-2005)", "(1975-2015)" /) nobs = dimsizes(obs) do r = 0, nobs-1 @@ -369,6 +430,10 @@ begin print(" plot_waccm_map : ERROR - Missing " + obs(r) + " data.") else inptr2 = addfile(files(0),"r") + + if (isatt(inptr2,"yrs_averaged")) then + years(r) = "(" + inptr2@yrs_averaged + ")" + end if end if delete(files) diff --git a/atm_diag/plot_waccm_vcycle.ncl b/atm_diag/plot_waccm_vcycle.ncl index 165cc5de..c957a9c2 100644 --- a/atm_diag/plot_waccm_vcycle.ncl +++ b/atm_diag/plot_waccm_vcycle.ncl @@ -77,7 +77,6 @@ begin end if case1 = shorten_case_name(case1) - if (isatt(inptr1[0],"yrs_averaged")) then yrs_ave1 = "(" + inptr1[0]@yrs_averaged + ")" else @@ -120,6 +119,7 @@ begin cres@tmXBLabels = (/ "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D" /) cycletime = cres@tmXBValues + dres = cres pan = True pan@gsnMaximize = True @@ -151,12 +151,34 @@ begin nvars = dimsizes(vars1) do i = 0, nvars-1 - + ; Do vertical interpolation first, since for hydrid coordinates, ; this should be done on lev x lat x lon data prior to averaging. ; Also calculate a zonal average. - var1 = dim_avg_Wrap(inptr1[:]->$vars1(i)$) - + if (isfilevar(inptr1[0], vars1(i))) then + var1 = dim_avg_Wrap(inptr1[:]->$vars1(i)$) + else + + ; If it is missing water vapor, look for specific humidity and convert. + if (vars1(i) .eq. "H2O") then + if (isfilevar(inptr1[0], "SHUM")) then + var1 = dim_avg_Wrap(inptr1[:]->SHUM) + var1 = (/ var1 * 28.89 / 18. / 1e3 /) ; convert from g/kg to ppv + var1@units = "mol/mol" + else + if (isfilevar(inptr1[0], "Q")) then + var1 = dim_avg_Wrap(inptr1[:]->Q) + var1 = (/ var1 * 28.89 / 18. /) ; convert from g/kg to ppv + var1@units = "mol/mol" + else + continue + end if + end if + else + continue + end if + end if + ; If the OBS/Model2 don't have a corresponding field, then ; skip it. if (isfilevar(inptr2[0], vars2(i))) then @@ -168,10 +190,12 @@ begin if (isfilevar(inptr2[0], "SHUM")) then var2 = dim_avg_Wrap(waccm_vintrps(inptr2, inptr2[:]->SHUM, var1&lev)) var2 = (/ var2 * 28.89 / 18. / 1e3 /) ; convert from g/kg to ppv + var2@units = "mol/mol" else if (isfilevar(inptr2[0], "Q")) then var2 = dim_avg_Wrap(waccm_vintrps(inptr2, inptr2[:]->Q, var1&lev)) var2 = (/ var2 * 28.89 / 18. /) ; convert from g/kg to ppv + var2@units = "mol/mol" else continue end if @@ -190,7 +214,7 @@ begin pan@txString = sprintf("%5.1f", minLat(j)) + " to " + sprintf("%5.1f", maxLat(j)) var1a = dim_avg_wgt_Wrap(var1(:,{minP(i):maxP(i)},{minLat(j):maxLat(j)}), gw1({minLat(j):maxLat(j)}), 1) var2a = dim_avg_wgt_Wrap(var2(:,{minP(i):maxP(i)},{minLat(j):maxLat(j)}), gw2({minLat(j):maxLat(j)}), 1) - + ; Calculate the difference var1a&time = cycletime var2a&time = cycletime @@ -216,7 +240,57 @@ begin end if end if + ; Assign variables generically as 15 linear levels in the + ; range the data will be plotted. Also adjust scales for variables with + ; small numbers to ppm, ppb, ppt as appropriate. + varmax = max((/ max(var1a), max(var2a) /)) + varmin = min((/ min(var1a), min(var2a) /)) + + scale = 1. + units = var1a@units + waccm_scaleunits(vars1(i), var1a@units, varmin, varmax, scale, units) + + if (scale .ne. 1.) then + var1a@units = units + + var1a = (/ var1a * scale /) + var2a = (/ var2a * scale /) + diff = (/ diff * scale /) + + varmax = max((/ max(var1a), max(var2a) /)) + varmin = min((/ min(var1a), min(var2a) /)) + end if + + maxmin = nice_mnmxintvl(varmin, varmax, 15, False) + symMinMaxPlt(diff, 15, False, dres) + ; Assign the contour levels for different variables + if (vars1(i) .eq. "CO") then + con = (/ 0.01,0.02,0.04,0.08,0.1,0.2,0.4,0.8,1.,2.,4.,8.,10.,20.,40. /) + dcon = (/ -10.,-4.,-1.,-0.4,-0.1,-.04,-.01,0.,0.01,0.04,0.1,0.4,1.,4.,10. /) + end if + + if (vars1(i) .eq. "H2O") then + var1a@long_name = "Water Vapor" + con = fspan(1, 8, 15) + dcon = (/ -1.8,-1.5,-1.2,-.9,-.6,-.3,-.1,0,.1,.3,.6,.9,1.2,1.5,1.8 /) + end if + + if (vars1(i) .eq. "QRL_TOT") then + var1a@long_name = "Merged LW Heating" + end if + + if (vars1(i) .eq. "QRS_TOT") then + var1a@long_name = "Merged SW Heating" + end if + + if (vars1(i) .eq. "RELHUM") then + var1a@long_name = "Relative Humidity" + var1a@units = "%" + con = fspan(0., 140., 15) + dcon = (/ -18.,-15.,-12.,-9.,-6.,-3.,-1.,0.,1.,3.,6.,9.,12.,15.,18. /) + end if + if (vars1(i) .eq. "T") then var1a@long_name = "Temperature" var1a@units = "K" @@ -237,22 +311,22 @@ begin dcon = (/ -18.,-15.,-12.,-9.,-6.,-3.,-1.,0.,1.,3.,6.,9.,12.,15.,18. /) end if - if (vars1(i) .eq. "RELHUM") then - var1a@long_name = "Relative Humidity" - var1a@units = "%" - con = fspan(0., 140., 15) - dcon = (/ -18.,-15.,-12.,-9.,-6.,-3.,-1.,0.,1.,3.,6.,9.,12.,15.,18. /) - end if - - if (vars1(i) .eq. "H2O") then - var1a = (/ var1a * 1e6 /) - var2a = (/ var2a * 1e6 /) - diff = (/ diff * 1e6 /) + if (vars1(i) .eq. "V") then + var1a@long_name = "Meridional Wind" + var1a@units = "m/s" - var1a@long_name = "Water Vapor" - var1a@units = "ppmv" - con = fspan(1, 8, 15) - dcon = (/ -1.8,-1.5,-1.2,-.9,-.6,-.3,-.1,0,.1,.3,.6,.9,1.2,1.5,1.8 /) + if (pAbbr(i) .eq. "_z") then + con = fspan(-3.5, 3.5, 15) + con = (/ -3.5,-2.5,-1.5,-1.,-.75,-.5,-.25,0.,.25,.5,.75,1.,1.5,2.5,3.5 /) + dcon = (/ -1.8,-1.5,-1.2,-.9,-.6,-.3,-.1,0.,.1,.3,.6,.9,1.2,1.5,1.8 /) + else + con = fspan(-14., 14., 15) + dcon = (/ -7.2,-6.,-4.8,-3.6,-2.4,-1.2,-.4,0.,.4,1.2,2.4,3.6,4.8,6.,7.2 /) + end if + end if + + if (vars1(i) .eq. "Z3") then + var1a@long_name = "Geopotential Height" end if var2a@long_name = var1a@long_name @@ -268,7 +342,16 @@ begin if (color_type .eq. "COLOR") then cres@lbLabelStride = 2 cres@lbOrientation = "Horizontal" - cres@cnLevels = con(:) + if (isvar("con")) then + cres@cnLevelSelectionMode = "ExplicitLevels" + cres@cnLevels = con(:) + delete(con) + else + cres@cnLevelSelectionMode = "ManualLevels" + cres@cnMinLevelValF = maxmin(0) + cres@cnMaxLevelValF = maxmin(1) + cres@cnLevelSpacingF = maxmin(2) + end if cres@cnFillPalette = cmap cres@cnLinesOn = False cres@cnLineLabelsOn = False @@ -303,26 +386,32 @@ begin mind = min(diff) maxd = max(diff) - cres@tiMainString = case1 + " - " + case2 + dres@tiMainString = case1 + " - " + case2 if (color_type .eq. "COLOR") then - cres@lbLabelStride = 1 - cres@lbOrientation = "Vertical" - cres@lbBoxMinorExtentF = 0.18 - cres@cnLevels = dcon(:) - cres@cnFillPalette = cmapd - cres@lbTitleString = "MIN = " + sprintf("%6.2f",mind) + " MAX = " + sprintf("%6.2f",maxd) - cres@cnLinesOn = True - cres@cnLineLabelsOn = True - cres@cnLineLabelPlacementMode = "Constant" + dres@lbLabelStride = 1 + dres@lbOrientation = "Vertical" + dres@lbBoxMinorExtentF = 0.18 + if (isvar("dcon")) then + dres@cnLevelSelectionMode = "ExplicitLevels" + dres@cnLevels = dcon(:) + delete(dcon) + else + dres@cnLevelSelectionMode = "ManualLevels" + end if + dres@cnFillPalette = cmapd + dres@lbTitleString = "MIN = " + sprintf("%6.2f",mind) + " MAX = " + sprintf("%6.2f",maxd) + dres@cnLinesOn = True + dres@cnLineLabelsOn = True + dres@cnLineLabelPlacementMode = "Constant" else mnmxint = nice_mnmxintvl (mind, maxd, diffcnlvls, False) - cres@cnMinLevelValF = mnmxint(0) - cres@cnMaxLevelValF = mnmxint(1) - cres@cnLevelSpacingF = mnmxint(2) + dres@cnMinLevelValF = mnmxint(0) + dres@cnMaxLevelValF = mnmxint(1) + dres@cnLevelSpacingF = mnmxint(2) delete(mnmxint) end if - cnplot(2) = gsn_csm_pres_hgt(wks, diff(lev|:, time|:), cres) + cnplot(2) = gsn_csm_pres_hgt(wks, diff(lev|:, time|:), dres) ; Create the panel. @@ -336,7 +425,7 @@ begin frame (wks) delete(wks) - + delete(diff) delete(var1a) delete(var2a) @@ -352,16 +441,9 @@ end begin ; Define the latitude bands - minLat = (/ -90., -65., -10, 55., 60. /) - maxLat = (/ -60., -55., 10., 65., 90. /) - latAbbr = (/ "_SP", "_SM", "_EQ", "_NM", "_NP" /) - - ; Define the model variables and the range of pressure levels over - ; which to plot them. - vars = (/ "U", "T", "H2O", "T", "H2O", "RELHUM" /) - minP = (/ 1e-3, 1e-3, 1e-3, 10., 10., 10. /) - maxP = (/ 500., 500., 120., 200., 120., 500. /) - pAbbr = (/ "", "", "", "_z", "_z", "_z" /) + minLat = (/ -90., -65., -40., -10, 20., 55., 60. /) + maxLat = (/ -60., -55., -20., 10., 40., 65., 90. /) + latAbbr = (/ "_SP", "_SM", "_ST", "_EQ", "_NT", "_NM", "_NP" /) ; Get the model data. files = systemfunc("ls " + infile1 + "_??_climo.nc") @@ -372,35 +454,247 @@ begin end if delete(files) - ; Get data from the OBS or other model. if (compare .eq. "OBS") then - ; Reanalysis data sets. - ; - ; NOTE: For WACCM, we need to make reanalysis data sets that go - ; to higher altitudes (lower pressures). - obs = (/ "MLS", "ERAI", "MERRAW_19x2" /) - obsName = (/ "MLS", "ERAI", "MERRA" /) - years = (/ "(2004-2012)", "(1989-2005)", "(1975-2015)" /) - nobs = dimsizes(obs) + ; ERAI + obs = "ERAI" + obsName = "ERAI" + years = "(1989-2005)" + + files = systemfunc("ls " + infile2 + "/" + obs + "_??_climo.nc") + if (any(ismissing(files))) then + print(" plot_waccm_vcycle : ERROR - Missing " + obs + " data.") + else + inptr2 = addfiles(files,"r") + + if (isatt(inptr2,"yrs_averaged")) then + years = "(" + inptr2@yrs_averaged + ")" + end if + end if + delete(files) + + ; Stratosphere + vars = (/ "H2O", "O3", "RELHUM", "T", "U", "V" /) + nvars = dimsizes(vars) + minP = new(nvars, float) + minP(:) = 1. + maxP = new(nvars, float) + maxP(:) = 200. + pAbbr = new(nvars, string) + pAbbr(:) = "_z" + + plot_waccm_vcycle(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, minLat, maxLat, latAbbr) + delete(inptr2) - do r = 0, nobs-1 + delete(pAbbr) + delete(maxP) + delete(minP) + delete(vars) + - files = systemfunc("ls " + infile2 + "/" + obs(r) + "_??_climo.nc") - if (any(ismissing(files))) then - print(" plot_waccm_vcycle : ERROR - Missing " + obs(r) + " data.") - else - inptr2 = addfiles(files,"r") - end if - delete(files) + ; MERRA + obs = "MERRAW_19x2" + obsName = "MERRA" + years = "(1975-2015)" + + files = systemfunc("ls " + infile2 + "/" + obs + "_??_climo.nc") + if (any(ismissing(files))) then + print(" plot_waccm_vcycle : ERROR - Missing " + obs + " data.") + else + inptr2 = addfiles(files,"r") + + if (isatt(inptr2,"yrs_averaged")) then + years = "(" + inptr2@yrs_averaged + ")" + end if + end if + delete(files) - ; Do model to obs plots. - plot_waccm_vcycle(inptr1, vars, inptr2, vars, obsName(r), years(r), minP, maxP, pAbbr, minLat, maxLat, latAbbr) - delete(inptr2) + ; Middle Atmosphere + vars = (/ "H2O", "T", "U", "V" /) + nvars = dimsizes(vars) + minP = new(nvars, float) + minP(:) = 1e-3 + maxP = new(nvars, float) + maxP(:) = 500. + pAbbr = new(nvars, string) + pAbbr(:) = "" - end do + plot_waccm_vcycle(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, minLat, maxLat, latAbbr) + + delete(pAbbr) + delete(maxP) + delete(minP) + + ; Stratosphere + minP = new(nvars, float) + minP(:) = 1. + maxP = new(nvars, float) + maxP(:) = 200. + pAbbr = new(nvars, string) + pAbbr(:) = "_z" + + plot_waccm_vcycle(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, minLat, maxLat, latAbbr) + delete(inptr2) + delete(pAbbr) + delete(maxP) + delete(minP) + delete(vars) + + + ; MLSW - Temperature, Water vapor, ... + obs = "mlsw" + obsName = "MLS" + years = "(2004-2016)" + + files = systemfunc("ls " + infile2 + "/" + obs + "_??_climo.nc") + if (any(ismissing(files))) then + print(" plot_waccm_vcycle : ERROR - Missing " + obs + " data.") + else + inptr2 = addfiles(files,"r") + + if (isatt(inptr2,"yrs_averaged")) then + years = "(" + inptr2@yrs_averaged + ")" + end if + end if + delete(files) + + ; Middle Atmosphere + vars = (/ "H2O", "O3", "RELHUM", "T", "Z3" /) + nvars = dimsizes(vars) + minP = new(nvars, float) + minP(:) = 1e-3 + maxP = new(nvars, float) + maxP(:) = 500. + pAbbr = new(nvars, string) + pAbbr(:) = "" + + plot_waccm_vcycle(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, minLat, maxLat, latAbbr) + + delete(pAbbr) + delete(maxP) + delete(minP) + + ; Stratosphere + minP = new(nvars, float) + minP(:) = 1. + maxP = new(nvars, float) + maxP(:) = 200. + pAbbr = new(nvars, string) + pAbbr(:) = "_z" + + plot_waccm_vcycle(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, minLat, maxLat, latAbbr) + delete(inptr2) + + delete(pAbbr) + delete(maxP) + delete(minP) + delete(vars) + + + ; MLSG - Most Trace Gases + obs = "mlsg" + obsName = "MLS" + years = "(2004-2016)" + + files = systemfunc("ls " + infile2 + "/" + obs + "_??_climo.nc") + if (any(ismissing(files))) then + print(" plot_waccm_vcycle : ERROR - Missing " + obs + " data.") + else + inptr2 = addfiles(files,"r") + + if (isatt(inptr2,"yrs_averaged")) then + years = "(" + inptr2@yrs_averaged + ")" + end if + end if + delete(files) + + ; Middle Atmosphere + vars = (/ "CO", "HO2" /) + nvars = dimsizes(vars) + minP = new(nvars, float) + minP(:) = 1e-3 + maxP = new(nvars, float) + maxP(:) = 500. + pAbbr = new(nvars, string) + pAbbr(:) = "" + + plot_waccm_vcycle(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, minLat, maxLat, latAbbr) + + delete(pAbbr) + delete(maxP) + delete(minP) + delete(vars) + + ; Stratosphere + vars = (/ "CH3CL", "CLO", "CO", "HCL", "HNO3", "HO2", "HOCL", "N2O" /) + nvars = dimsizes(vars) + minP = new(nvars, float) + minP(:) = 1. + maxP = new(nvars, float) + maxP(:) = 200. + pAbbr = new(nvars, string) + pAbbr(:) = "_z" + + plot_waccm_vcycle(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, minLat, maxLat, latAbbr) + delete(inptr2) + + delete(pAbbr) + delete(maxP) + delete(minP) + delete(vars) + + + ; MLSO - Hydroxyl + obs = "mlso" + obsName = "MLS" + years = "(2004-2016)" + + files = systemfunc("ls " + infile2 + "/" + obs + "_??_climo.nc") + if (any(ismissing(files))) then + print(" plot_waccm_vcycle : ERROR - Missing " + obs + " data.") + else + inptr2 = addfiles(files,"r") + + if (isatt(inptr2,"yrs_averaged")) then + years = "(" + inptr2@yrs_averaged + ")" + end if + end if + delete(files) + + ; Middle Atmosphere + vars = (/ "OH" /) + nvars = dimsizes(vars) + minP = new(nvars, float) + minP(:) = 1e-3 + maxP = new(nvars, float) + maxP(:) = 500. + pAbbr = new(nvars, string) + pAbbr(:) = "" + + plot_waccm_vcycle(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, minLat, maxLat, latAbbr) + + delete(pAbbr) + delete(maxP) + delete(minP) + + ; Stratosphere + minP = new(nvars, float) + minP(:) = 1. + maxP = new(nvars, float) + maxP(:) = 200. + pAbbr = new(nvars, string) + pAbbr(:) = "_z" + + plot_waccm_vcycle(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, minLat, maxLat, latAbbr) + delete(inptr2) + + delete(pAbbr) + delete(maxP) + delete(minP) + delete(vars) + else files = systemfunc("ls " + infile2 + "_??_climo.nc") @@ -429,10 +723,42 @@ begin yrs_ave2 = "" end if - ; Do model to model plots. + ; Middle Atmosphere + vars = (/ "CH4", "CO", "CO2", "H2O", "O3", "OH", "QRS_TOT", "QRL_TOT", "RELHUM", "SO2", "T", "U", "V", "Z3" /) + nvars = dimsizes(vars) + minP = new(nvars, float) + minP(:) = 1e-3 + maxP = new(nvars, float) + maxP(:) = 500. + pAbbr = new(nvars, string) + pAbbr(:) = "" + plot_waccm_vcycle(inptr1, vars, inptr2, vars, case2, yrs_ave2, minP, maxP, pAbbr, minLat, maxLat, latAbbr) + + delete(pAbbr) + delete(maxP) + delete(minP) + delete(vars) + + ; Stratosphere + vars = (/ "CH4", "CO", "CO2", "H2O", "N2O", "O3", "OH", "RELHUM", "SO2", "T" /) + nvars = dimsizes(vars) + minP = new(nvars, float) + minP(:) = 1. + maxP = new(nvars, float) + maxP(:) = 200. + pAbbr = new(nvars, string) + pAbbr(:) = "_z" + + plot_waccm_vcycle(inptr1, vars, inptr2, vars, case2, yrs_ave2, minP, maxP, pAbbr, minLat, maxLat, latAbbr) + delete(inptr2) + delete(pAbbr) + delete(maxP) + delete(minP) + delete(vars) + end if end diff --git a/atm_diag/plot_waccm_vzonal.ncl b/atm_diag/plot_waccm_vzonal.ncl index 31e7aa1a..f31c9f50 100644 --- a/atm_diag/plot_waccm_vzonal.ncl +++ b/atm_diag/plot_waccm_vzonal.ncl @@ -90,7 +90,6 @@ begin cres@tiYAxisString = "Pressure (mb)" cres@txFontHeightF = 0.023 if (color_type .eq. "COLOR") then - cres@cnLevelSelectionMode = "ExplicitLevels" cres@cnFillOn = True cres@cnLinesOn = False cres@cnLineLabelsOn = False @@ -112,6 +111,7 @@ begin diffcnlvls = 12 end if + dres = cres pan = True pan@gsnMaximize = True @@ -122,11 +122,33 @@ begin nvars = dimsizes(vars1) do i = 0, nvars-1 - + ; Do vertical interpolation first, since for hydrid coordinates, ; this should be done on lev x lat x lon data prior to averaging. ; Also calculate a zonal average. - var1 = dim_avg_Wrap(inptr1->$vars1(i)$) + if (isfilevar(inptr1, vars1(i))) then + var1 = dim_avg_Wrap(inptr1->$vars1(i)$) + else + + ; If it is missing water vapor, look for specific humidity and convert. + if (vars1(i) .eq. "H2O") then + if (isfilevar(inptr1, "SHUM")) then + var1 = dim_avg_Wrap(inptr1->SHUM) + var1 = (/ var1 * 28.89 / 18. / 1e3 /) ; convert from g/kg to ppv + var1@units = "mol/mol" + else + if (isfilevar(inptr1, "Q")) then + var1 = dim_avg_Wrap(inptr1->Q) + var1 = (/ var1 * 28.89 / 18. /) ; convert from g/kg to ppv + var1@units = "mol/mol" + else + continue + end if + end if + else + continue + end if + end if ; If the OBS/Model2 don't have a corresponding field, then ; skip it. @@ -139,10 +161,12 @@ begin if (isfilevar(inptr2, "SHUM")) then var2 = dim_avg_Wrap(waccm_vintrp(inptr2, inptr2->SHUM, var1&lev)) var2 = (/ var2 * 28.89 / 18. / 1e3 /) ; convert from g/kg to ppv + var2@units = "mol/mol" else if (isfilevar(inptr2, "Q")) then var2 = dim_avg_Wrap(waccm_vintrp(inptr2, inptr2->Q, var1&lev)) var2 = (/ var2 * 28.89 / 18. /) ; convert from g/kg to ppv + var2@units = "mol/mol" else continue end if @@ -153,6 +177,12 @@ begin end if ; Interpolate to the model latitudes + ; + ; NOTE: In data sets where all the values are fill at a particular latitude, + ; the linint1_Wrap call generates an error, but it doesn't really seem to be + ; fatal: + ; + ; fatal:["NclAtt.c":262]:Attribute assignment type mismatch. var1a = var1(0, {minP(i):maxP(i)}, :) var2a = linint1_Wrap(var2&lat, var2(0, {minP(i):maxP(i)}, :), False, var1&lat, 0) @@ -181,7 +211,59 @@ begin end if end if - ; Assign the contour levels for different variables + ; Assign variables generically as 15 linear levels in the + ; range the data will be plotted. Also adjust scales for variables with + ; small numbers to ppm, ppb, ppt as appropriate. + varmax = max((/ max(var1a), max(var2a) /)) + varmin = min((/ min(var1a), min(var2a) /)) + + scale = 1. + units = var1a@units + waccm_scaleunits(vars1(i), var1a@units, varmin, varmax, scale, units) + + if (scale .ne. 1.) then + var1a@units = units + + var1a = (/ var1a * scale /) + var2a = (/ var2a * scale /) + diff = (/ diff * scale /) + + varmax = max((/ max(var1a), max(var2a) /)) + varmin = min((/ min(var1a), min(var2a) /)) + end if + + maxmin = nice_mnmxintvl(varmin, varmax, 15, False) + symMinMaxPlt(diff, 15, False, dres) + + + ; If desired, override the default contour levels with hard coded levels for + ; specific fields. Also some fields need to be scaled to reasonable units. + if (vars1(i) .eq. "CO") then + con = (/ 0.01,0.02,0.04,0.08,0.1,0.2,0.4,0.8,1.,2.,4.,8.,10.,20.,40. /) + dcon = (/ -10.,-4.,-1.,-0.4,-0.1,-.04,-.01,0.,0.01,0.04,0.1,0.4,1.,4.,10. /) + end if + + if (vars1(i) .eq. "H2O") then + var1a@long_name = "Water Vapor" + con = fspan(1, 8, 15) + dcon = (/ -1.8,-1.5,-1.2,-.9,-.6,-.3,-.1,0,.1,.3,.6,.9,1.2,1.5,1.8 /) + end if + + if (vars1(i) .eq. "QRL_TOT") then + var1a@long_name = "Merged LW Heating" + end if + + if (vars1(i) .eq. "QRS_TOT") then + var1a@long_name = "Merged SW Heating" + end if + + if (vars1(i) .eq. "RELHUM") then + var1a@long_name = "Relative Humidity" + var1a@units = "%" + con = fspan(0., 140., 15) + dcon = (/ -18.,-15.,-12.,-9.,-6.,-3.,-1.,0.,1.,3.,6.,9.,12.,15.,18. /) + end if + if (vars1(i) .eq. "T") then var1a@long_name = "Temperature" var1a@units = "K" @@ -202,22 +284,21 @@ begin dcon = (/ -18.,-15.,-12.,-9.,-6.,-3.,-1.,0.,1.,3.,6.,9.,12.,15.,18. /) end if - if (vars1(i) .eq. "RELHUM") then - var1a@long_name = "Relative Humidity" - var1a@units = "%" - con = fspan(0., 140., 15) - dcon = (/ -18.,-15.,-12.,-9.,-6.,-3.,-1.,0.,1.,3.,6.,9.,12.,15.,18. /) - end if + if (vars1(i) .eq. "V") then + var1a@long_name = "Meridional Wind" + var1a@units = "m/s" - if (vars1(i) .eq. "H2O") then - var1a = (/ var1a * 1e6 /) - var2a = (/ var2a * 1e6 /) - diff = (/ diff * 1e6 /) + if (pAbbr(i) .eq. "_z") then + con = fspan(-3.5, 3.5, 15) + dcon = (/ -1.8,-1.5,-1.2,-.9,-.6,-.3,-.1,0.,.1,.3,.6,.9,1.2,1.5,1.8 /) + else + con = fspan(-14., 14., 15) + dcon = (/ -7.2,-6.,-4.8,-3.6,-2.4,-1.2,-.4,0.,.4,1.2,2.4,3.6,4.8,6.,7.2 /) + end if + end if - var1a@long_name = "Water Vapor" - var1a@units = "ppmv" - con = fspan(1, 8, 15) - dcon = (/ -1.8,-1.5,-1.2,-.9,-.6,-.3,-.1,0,.1,.3,.6,.9,1.2,1.5,1.8 /) + if (vars1(i) .eq. "Z3") then + var1a@long_name = "Geopotential Height" end if var2a@long_name = var1a@long_name @@ -233,7 +314,16 @@ begin if (color_type .eq. "COLOR") then cres@lbLabelStride = 2 cres@lbOrientation = "Horizontal" - cres@cnLevels = con(:) + if (isvar("con")) then + cres@cnLevelSelectionMode = "ExplicitLevels" + cres@cnLevels = con(:) + delete(con) + else + cres@cnLevelSelectionMode = "ManualLevels" + cres@cnMinLevelValF = maxmin(0) + cres@cnMaxLevelValF = maxmin(1) + cres@cnLevelSpacingF = maxmin(2) + end if cres@cnFillPalette = cmap cres@cnLinesOn = False cres@cnLineLabelsOn = False @@ -268,26 +358,32 @@ begin mind = min(diff) maxd = max(diff) - cres@tiMainString = case1 + " - " + case2 + dres@tiMainString = case1 + " - " + case2 if (color_type .eq. "COLOR") then - cres@lbLabelStride = 1 - cres@lbOrientation = "Vertical" - cres@lbBoxMinorExtentF = 0.18 - cres@cnLevels = dcon(:) - cres@cnFillPalette = cmapd - cres@lbTitleString = "MIN = " + sprintf("%6.2f",mind) + " MAX = " + sprintf("%6.2f",maxd) - cres@cnLinesOn = True - cres@cnLineLabelsOn = True - cres@cnLineLabelPlacementMode = "Constant" + dres@lbLabelStride = 1 + dres@lbOrientation = "Vertical" + dres@lbBoxMinorExtentF = 0.18 + if (isvar("dcon")) then + dres@cnLevelSelectionMode = "ExplicitLevels" + dres@cnLevels = dcon(:) + delete(dcon) + else + dres@cnLevelSelectionMode = "ManualLevels" + end if + dres@cnFillPalette = cmapd + dres@lbTitleString = "MIN = " + sprintf("%6.2f",mind) + " MAX = " + sprintf("%6.2f",maxd) + dres@cnLinesOn = True + dres@cnLineLabelsOn = True + dres@cnLineLabelPlacementMode = "Constant" else mnmxint = nice_mnmxintvl (mind, maxd, diffcnlvls, False) - cres@cnMinLevelValF = mnmxint(0) - cres@cnMaxLevelValF = mnmxint(1) - cres@cnLevelSpacingF = mnmxint(2) + dres@cnMinLevelValF = mnmxint(0) + dres@cnMaxLevelValF = mnmxint(1) + dres@cnLevelSpacingF = mnmxint(2) delete(mnmxint) end if - cnplot(2) = gsn_csm_pres_hgt(wks, diff(lev|:, lat|:), cres) + cnplot(2) = gsn_csm_pres_hgt(wks, diff(lev|:, lat|:), dres) ; Create the panel. @@ -318,12 +414,6 @@ begin periods = (/ "06", "12", "JJA", "MAM", "SON", "DJF", "ANN" /) nPeriods = dimsizes(periods) - ; Define the model variables and the range of pressure levels over - ; which to plot them. - vars = (/ "U", "T", "H2O", "T", "H2O", "RELHUM" /) - minP = (/ 1e-3, 1e-3, 1e-3, 10., 10., 10. /) - maxP = (/ 500., 500., 120., 200., 120., 500. /) - pAbbr = (/ "", "", "", "_z", "_z", "_z" /) do p = 0, nPeriods-1 @@ -340,33 +430,248 @@ begin ; Get data from the OBS or other model. if (compare .eq. "OBS") then - ; Reanalysis data sets. - ; - ; NOTE: For WACCM, we need to make reanalysis data sets that go - ; to higher altitudes (lower pressures). - obs = (/ "MLS", "ERAI", "MERRAW_19x2" /) - obsName = (/ "MLS", "ERAI", "MERRA" /) - years = (/ "(2004-2012)", "(1989-2005)", "(1975-2015)" /) - nobs = dimsizes(obs) + ; ERAI + obs = "ERAI" + obsName = "ERAI" + years = "(1989-2005)" + + files = systemfunc("ls " + infile2 + "/" + obs + "_" + periods(p) + "_climo.nc") + if (any(ismissing(files))) then + print(" plot_waccm_vzonal : ERROR - Missing " + obs + " data.") + else + inptr2 = addfile(files(0),"r") + + if (isatt(inptr2,"yrs_averaged")) then + years = "(" + inptr2@yrs_averaged + ")" + end if + end if + delete(files) + + ; Stratosphere + vars = (/ "H2O", "O3", "RELHUM", "T", "U", "V" /) + nvars = dimsizes(vars) + minP = new(nvars, float) + minP(:) = 1. + maxP = new(nvars, float) + maxP(:) = 200. + pAbbr = new(nvars, string) + pAbbr(:) = "_z" + + plot_waccm_vzonal(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, periods(p)) + delete(inptr2) - do r = 0, nobs-1 + delete(pAbbr) + delete(maxP) + delete(minP) + delete(vars) + + + ; MERRA + obs = "MERRAW_19x2" + obsName = "MERRA" + years = "(1975-2015)" + + files = systemfunc("ls " + infile2 + "/" + obs + "_" + periods(p) + "_climo.nc") + if (any(ismissing(files))) then + print(" plot_waccm_vzonal : ERROR - Missing " + obs + " data.") + else + inptr2 = addfile(files(0),"r") + + if (isatt(inptr2,"yrs_averaged")) then + years = "(" + inptr2@yrs_averaged + ")" + end if + end if + delete(files) + + ; Middle Atmosphere + vars = (/ "H2O", "T", "U", "V" /) + nvars = dimsizes(vars) + minP = new(nvars, float) + minP(:) = 1e-3 + maxP = new(nvars, float) + maxP(:) = 500. + pAbbr = new(nvars, string) + pAbbr(:) = "" + + plot_waccm_vzonal(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, periods(p)) + + delete(pAbbr) + delete(maxP) + delete(minP) + + ; Stratosphere + minP = new(nvars, float) + minP(:) = 1. + maxP = new(nvars, float) + maxP(:) = 200. + pAbbr = new(nvars, string) + pAbbr(:) = "_z" + + plot_waccm_vzonal(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, periods(p)) + delete(inptr2) - files = systemfunc("ls " + infile2 + "/" + obs(r) + "_" + periods(p) + "_climo.nc") - if (any(ismissing(files))) then - print(" plot_waccm_vzonal : ERROR - Missing " + obs(r) + " data.") - else - inptr2 = addfile(files(0),"r") + delete(pAbbr) + delete(maxP) + delete(minP) + delete(vars) + + + ; MLSW - Temperature, Water vapor, ... + obs = "mlsw" + obsName = "MLS" + years = "(2004-2016)" + + files = systemfunc("ls " + infile2 + "/" + obs + "_" + periods(p) + "_climo.nc") + if (any(ismissing(files))) then + print(" plot_waccm_vzonal : ERROR - Missing " + obs + " data.") + else + inptr2 = addfile(files(0),"r") + + if (isatt(inptr2,"yrs_averaged")) then + years = "(" + inptr2@yrs_averaged + ")" end if - delete(files) + end if + delete(files) - ; Do model to obs plots. - plot_waccm_vzonal(inptr1, vars, inptr2, vars, obsName(r), years(r), minP, maxP, pAbbr, periods(p)) - delete(inptr2) + ; Middle Atmosphere + vars = (/ "H2O", "O3", "RELHUM", "T", "Z3" /) + nvars = dimsizes(vars) + minP = new(nvars, float) + minP(:) = 1e-3 + maxP = new(nvars, float) + maxP(:) = 500. + pAbbr = new(nvars, string) + pAbbr(:) = "" - end do + plot_waccm_vzonal(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, periods(p)) + + delete(pAbbr) + delete(maxP) + delete(minP) + + ; Stratosphere + minP = new(nvars, float) + minP(:) = 1. + maxP = new(nvars, float) + maxP(:) = 200. + pAbbr = new(nvars, string) + pAbbr(:) = "_z" + + plot_waccm_vzonal(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, periods(p)) + delete(inptr2) + + delete(pAbbr) + delete(maxP) + delete(minP) + delete(vars) + + + ; MLSG - Most Trace Gases + obs = "mlsg" + obsName = "MLS" + years = "(2004-2016)" + + files = systemfunc("ls " + infile2 + "/" + obs + "_" + periods(p) + "_climo.nc") + if (any(ismissing(files))) then + print(" plot_waccm_vzonal : ERROR - Missing " + obs + " data.") + else + inptr2 = addfile(files(0),"r") + + if (isatt(inptr2,"yrs_averaged")) then + years = "(" + inptr2@yrs_averaged + ")" + end if + end if + delete(files) + + ; Middle Atmosphere + vars = (/ "CO", "HO2" /) + nvars = dimsizes(vars) + minP = new(nvars, float) + minP(:) = 1e-3 + maxP = new(nvars, float) + maxP(:) = 500. + pAbbr = new(nvars, string) + pAbbr(:) = "" + + plot_waccm_vzonal(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, periods(p)) + + delete(pAbbr) + delete(maxP) + delete(minP) + delete(vars) + + ; Stratosphere + vars = (/ "BRO", "CH3CL", "CLO", "CO", "HCL", "HNO3", "HO2", "HOCL", "N2O" /) + nvars = dimsizes(vars) + minP = new(nvars, float) + minP(:) = 1. + maxP = new(nvars, float) + maxP(:) = 200. + pAbbr = new(nvars, string) + pAbbr(:) = "_z" + + plot_waccm_vzonal(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, periods(p)) + delete(inptr2) + + delete(pAbbr) + delete(maxP) + delete(minP) + delete(vars) + + + ; MLSO - OH + obs = "mlso" + obsName = "MLS" + years = "(2004-2016)" + + files = systemfunc("ls " + infile2 + "/" + obs + "_" + periods(p) + "_climo.nc") + if (any(ismissing(files))) then + print(" plot_waccm_vzonal : ERROR - Missing " + obs + " data.") + else + inptr2 = addfile(files(0),"r") + + if (isatt(inptr2,"yrs_averaged")) then + years = "(" + inptr2@yrs_averaged + ")" + end if + end if + delete(files) + + ; Middle Atmosphere + vars = (/ "OH" /) + nvars = dimsizes(vars) + minP = new(nvars, float) + minP(:) = 1e-3 + maxP = new(nvars, float) + maxP(:) = 500. + pAbbr = new(nvars, string) + pAbbr(:) = "" + + plot_waccm_vzonal(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, periods(p)) + + delete(pAbbr) + delete(maxP) + delete(minP) + + ; Stratosphere + minP = new(nvars, float) + minP(:) = 1. + maxP = new(nvars, float) + maxP(:) = 200. + pAbbr = new(nvars, string) + pAbbr(:) = "_z" + + plot_waccm_vzonal(inptr1, vars, inptr2, vars, obsName, years, minP, maxP, pAbbr, periods(p)) + delete(inptr2) + + delete(pAbbr) + delete(maxP) + delete(minP) + delete(vars) else + ; Model to Model + files = systemfunc("ls " + infile2 + "_" + periods(p) + "_climo.nc") if (any(ismissing(files))) then print(" plot_waccm_vzonal : ERROR - Missing model 2 data.") @@ -393,10 +698,42 @@ begin yrs_ave2 = "" end if - ; Do model to model plots. + ; Middle Atmosphere + vars = (/ "CH4", "CO", "CO2", "H2O", "O3", "OH", "RELHUM", "QRS_TOT", "QRL_TOT", "SO2", "T", "U", "V" /) + nvars = dimsizes(vars) + minP = new(nvars, float) + minP(:) = 1e-3 + maxP = new(nvars, float) + maxP(:) = 500. + pAbbr = new(nvars, string) + pAbbr(:) = "" + + plot_waccm_vzonal(inptr1, vars, inptr2, vars, case2, yrs_ave2, minP, maxP, pAbbr, periods(p)) + + delete(pAbbr) + delete(maxP) + delete(minP) + delete(vars) + + ; Stratosphere + vars = (/ "CH4", "CO", "CO2", "H2O", "N2O", "O3", "OH", "RELHUM", "SO2", "T" /) + nvars = dimsizes(vars) + minP = new(nvars, float) + minP(:) = 1. + maxP = new(nvars, float) + maxP(:) = 200. + pAbbr = new(nvars, string) + pAbbr(:) = "_z" + plot_waccm_vzonal(inptr1, vars, inptr2, vars, case2, yrs_ave2, minP, maxP, pAbbr, periods(p)) + delete(inptr2) + delete(pAbbr) + delete(maxP) + delete(minP) + delete(vars) + end if end do end diff --git a/atm_diag/tables_waccm.ncl b/atm_diag/tables_waccm.ncl index e01fb485..ab69c73a 100644 --- a/atm_diag/tables_waccm.ncl +++ b/atm_diag/tables_waccm.ncl @@ -64,7 +64,27 @@ begin ; Do vertical interpolation first, since for hydrid coordinates, ; this should be done on lev x lat x lon data prior to averaging. ; Also calculate a zonal average. - var1 = inptr1[:]->$vars1(i)$ + if (isfilevar(inptr1[0], vars1(i))) then + var1 = inptr1[:]->$vars1(i)$ + else + + ; If it is missing water vapor, look for specific humidity and convert. + if (vars1(i) .eq. "H2O") then + if (isfilevar(inptr1[0], "SHUM")) then + var1 = inptr1[:]->SHUM + var1 = (/ var1 * 28.89 / 18. / 1e3 /) ; convert from g/kg to ppv + else + if (isfilevar(inptr1[0], "Q")) then + var1 = inptr1[:]->Q + var1 = (/ var1 * 28.89 / 18. /) ; convert from g/kg to ppv + else + continue + end if + end if + else + continue + end if + end if ; If the OBS/Model2 don't have a corresponding field, then ; skip it. @@ -99,6 +119,11 @@ begin nlats = dimsizes(minLat) do j = 0, nlats-1 + ; Skip cases that are outside the range of the model data. + if (minP(i) .lt. min(var1&lev)) then + continue + end if + ; Calculate the min/max/mean of the min values each month. rbase = r*nvars*3 tvars(j, rbase+i*3+0) = vars1(i) + "_" + pAbbr(i) + "_MIN" + obsName @@ -216,8 +241,8 @@ begin ; ; NOTE: For WACCM, we need to make reanalysis data sets that go ; to higher altitudes (lower pressures). - obs = (/ "MLS", "MERRAW_19x2" /) - obsName = (/ "MLS", "MERRA" /) + obs = (/ "mlsw", "MERRAW_19x2" /) + obsName = (/ "MLS", "MERRA" /) nObs = dimsizes(obs) tvars = new((/ nTables, nVars * nObs * 3 /), string) diff --git a/diagnostics/diagnostics/atm/atm_avg_generator.py b/diagnostics/diagnostics/atm/atm_avg_generator.py index 8e70b51f..7b34acee 100644 --- a/diagnostics/diagnostics/atm/atm_avg_generator.py +++ b/diagnostics/diagnostics/atm/atm_avg_generator.py @@ -198,7 +198,8 @@ def get_variable_list(envDict,in_dir,case_prefix, key_infile, htype, stream): 'so4_a2SFWET','so4_a3SFWET','so4_a4SFWET','so4_a5SFWET','so4_a6SFWET','so4_a7SFWET','so4_c1DDF','so4_c2DDF', 'so4_c3DDF','so4_c4DDF','so4_c5DDF','so4_c6DDF','so4_c7DDF','so4_c1SFWET','so4_c2SFWET','so4_c3SFWET','so4_c4SFWET', 'so4_c5SFWET','so4_c6SFWET','so4_c7SFWET'] - waccm_vars = ['QRS_TOT', 'QRL_TOT'] + waccm_vars = ['BRO','CH3CL','CLO','CO2','HCL','HO2','HOCL','QRL_TOT','QRS_TOT'] + #waccm_vars = ['QRS_TOT', 'QRL_TOT'] var_list = [] fileVars = []