From 09846f44bf6529b4db5fd529a01e92903f6d2f59 Mon Sep 17 00:00:00 2001 From: Kefei Mo Date: Fri, 14 Jun 2024 15:18:06 +0000 Subject: [PATCH] Updated notebooks to allow qc plot as much as possible. --- VAPs/quicklook/2DS-AIR/2DS-AIR_tutorial.ipynb | 4 +- VAPs/quicklook/2DS-AIR/aaf2dsh.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/2DS-AIR/aaf2dsv.c1.ipynb | 43 +++++++++++----- .../ACSMCDCE/ACSMCDCE_tutorial.ipynb | 4 +- VAPs/quicklook/ACSMCDCE/acsmcdce.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/ACSMCDCE/acsmcdce.c2.ipynb | 43 +++++++++++----- VAPs/quicklook/ACSMCDCE/acsmtofcdce.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/AERINF/AERINF_tutorial.ipynb | 4 +- VAPs/quicklook/AERINF/aerich1nf1turn.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/AERINF/aerich2nf1turn.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/AERIOE/AERIOE_tutorial.ipynb | 4 +- VAPs/quicklook/AERIOE/aerioe1turn.c1.ipynb | 43 +++++++++++----- .../AERIPROF/AERIPROF_tutorial.ipynb | 4 +- .../AERIPROF/aeri01prof3feltz.c1.ipynb | 43 +++++++++++----- .../AERIPROF/aeriprof3feltz.c1.ipynb | 47 ++++++++++++----- VAPs/quicklook/AERIPROF/qmeaeriprof.c1.ipynb | 43 +++++++++++----- .../AEROSOLBE/AEROSOLBE_tutorial.ipynb | 4 +- .../AEROSOLBE/aerosolbe1turn.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/AIP/AIP_tutorial.ipynb | 4 +- VAPs/quicklook/AIP/aip1ogren.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/AIP/aipavg1ogren.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/AIP/aipfitrh1ogren.c1.ipynb | 43 +++++++++++----- .../AOD-MFRSR/AOD-MFRSR_tutorial.ipynb | 4 +- .../AOD-MFRSR/mfrsr7nchaod1mich.c1.ipynb | 43 +++++++++++----- .../quicklook/AOD-MFRSR/mfrsr7nchcal.c1.ipynb | 43 +++++++++++----- .../AOD-MFRSR/mfrsraod1mich.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/AOD-MFRSR/mfrsrcal.c1.ipynb | 43 +++++++++++----- .../AOD-NIMFR/AOD-NIMFR_tutorial.ipynb | 4 +- .../AOD-NIMFR/nimfraod1mich.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/AOD/AOD_tutorial.ipynb | 4 +- VAPs/quicklook/AOD/sasheniraod.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/AOD/sashevisaod.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/AODBE/AODBE_tutorial.ipynb | 4 +- VAPs/quicklook/AODBE/aodbe2ch.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/AODBE/aodbe5ch.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/AOP/AOP_tutorial.ipynb | 4 +- VAPs/quicklook/AOP/aopclap1flynn1m.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/AOP/aoppsap1flynn1h.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/AOP/aoppsap1flynn1m.c1.ipynb | 43 +++++++++++----- .../AOSCCNAVG/AOSCCNAVG_tutorial.ipynb | 4 +- VAPs/quicklook/AOSCCNAVG/aosccnavg.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/AOSCCNAVG/aosccnavg.c2.ipynb | 43 +++++++++++----- .../AOSSP2BC/AOSSP2BC_tutorial.ipynb | 4 +- VAPs/quicklook/AOSSP2BC/aossp2rbc1m.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/ARMBE/ARMBE_tutorial.ipynb | 4 +- VAPs/quicklook/ARMBE/armbeatm.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/ARMBE/armbecldrad.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/ARSCL/ARSCL_tutorial.ipynb | 4 +- VAPs/quicklook/ARSCL/arscl1cloth.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/ARSCL/arsclbnd1cloth.c1.ipynb | 43 +++++++++++----- .../ASDBE-AIR/ASDBE-AIR_tutorial.ipynb | 4 +- .../ASDBE-AIR/aafmergedaerosolsd.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/BAEBBR/30baebbr.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/BAEBBR/BAEBBR_tutorial.ipynb | 4 +- .../BBHRP/1bbhrpripbe1mcfarlane.c1.ipynb | 43 +++++++++++----- .../BBHRP/30bbhrpripbe1mcfarlane.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/BBHRP/BBHRP_tutorial.ipynb | 4 +- VAPs/quicklook/BBHRP/bbhrpavg1mlawer.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/BEFLUX/BEFLUX_tutorial.ipynb | 4 +- VAPs/quicklook/BEFLUX/beflux1long.c1.ipynb | 47 ++++++++++++----- VAPs/quicklook/BEFLUX/qcflux1long.c1.ipynb | 47 ++++++++++++----- .../CCNKAPPA/CCNKAPPA_tutorial.ipynb | 4 +- .../CCNKAPPA/aosccnsmpskappa.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/CCNPROF/CCNPROF_tutorial.ipynb | 4 +- .../quicklook/CCNPROF/rlccnprof1ghan.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/CLAP/CLAP_tutorial.ipynb | 4 +- VAPs/quicklook/CLAP/aosclap3w.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/CLDTYPE/CLDTYPE_tutorial.ipynb | 4 +- VAPs/quicklook/CLDTYPE/cldtype.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/CMAC2/CMAC2_tutorial.ipynb | 4 +- VAPs/quicklook/CMAC2/cmac2.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/CO-AIR/CO-AIR_tutorial.ipynb | 4 +- VAPs/quicklook/CO-AIR/aafco.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/COGS/COGS_tutorial.ipynb | 4 +- VAPs/quicklook/COGS/cogs.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/DIFFCOR/DIFFCOR_tutorial.ipynb | 4 +- VAPs/quicklook/DIFFCOR/brs1dutt.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/DIFFCOR/siros1dutt.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/DIFFCOR/sirs1dutt.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/DLMC/DLMC_tutorial.ipynb | 4 +- VAPs/quicklook/DLMC/dlmcfpt.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/DLMC/dlmcusr.c1.ipynb | 43 +++++++++++----- .../DLMCPROF-WIND_tutorial.ipynb | 4 +- .../DLMCPROF-WIND/dlmcprofwindnews.c1.ipynb | 43 +++++++++++----- .../DLPROF-WIND/DLPROF-WIND_tutorial.ipynb | 4 +- .../DLPROF-WIND/dlprofwind4news.c1.ipynb | 43 +++++++++++----- .../DLPROF-WSTATS_tutorial.ipynb | 4 +- .../DLPROF-WSTATS/dlprofwstats4news.c1.ipynb | 43 +++++++++++----- .../FCDP-AIR/FCDP-AIR_tutorial.ipynb | 4 +- VAPs/quicklook/FCDP-AIR/aaffcdp.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/GVR/GVR_tutorial.ipynb | 4 +- VAPs/quicklook/GVR/gvr.c1.ipynb | 47 ++++++++++++----- .../HVPS-AIR/HVPS-AIR_tutorial.ipynb | 4 +- VAPs/quicklook/HVPS-AIR/aafhvps.c1.ipynb | 43 +++++++++++----- .../INLETCVI-AIR/INLETCVI-AIR_tutorial.ipynb | 4 +- .../INLETCVI-AIR/aafinletcvi.c1.ipynb | 43 +++++++++++----- .../INTERPSONDE/INTERPSONDE_tutorial.ipynb | 4 +- .../INTERPSONDE/interpolatedsonde.c1.ipynb | 47 ++++++++++++----- .../KAZRARSCL/KAZRARSCL_tutorial.ipynb | 4 +- .../KAZRARSCL/arsclkazr1kollias.c1.ipynb | 43 +++++++++++----- .../KAZRARSCL/arsclkazrbnd1kollias.c1.ipynb | 43 +++++++++++----- .../KAZRARSCLCLOUDSAT_tutorial.ipynb | 4 +- .../arsclkazrcloudsat.c1.ipynb | 43 +++++++++++----- .../KAZRCFRCOR/KAZRCFRCOR_tutorial.ipynb | 4 +- .../KAZRCFRCOR/kazrcfrcorge.c1.ipynb | 43 +++++++++++----- .../KAZRCFRCOR/kazrcfrcormd.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/KAZRCOR/KAZRCOR_tutorial.ipynb | 4 +- VAPs/quicklook/KAZRCOR/kazrcorge.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/KAZRCOR/kazrcorhi.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/KAZRCOR/kazrcormd.c1.ipynb | 43 +++++++++++----- .../LCLHEIGHT/LCLHEIGHT_tutorial.ipynb | 4 +- VAPs/quicklook/LCLHEIGHT/lcl.c1.ipynb | 43 +++++++++++----- .../LDQUANTS/LDQUANTS_tutorial.ipynb | 4 +- VAPs/quicklook/LDQUANTS/ldquants.c1.ipynb | 47 ++++++++++++----- VAPs/quicklook/LSSONDE/LSSONDE_tutorial.ipynb | 4 +- VAPs/quicklook/LSSONDE/lssonde.c1.ipynb | 43 +++++++++++----- .../MASCPARTICLES_tutorial.ipynb | 4 +- .../MASCPARTICLES/mascparticles.c1.ipynb | 43 +++++++++++----- .../MASCPARTICLES/mascparticlesavg.c1.ipynb | 43 +++++++++++----- .../MERGED-COMMON_tutorial.ipynb | 4 +- .../MERGED-COMMON/aafmergedcldsd.c1.ipynb | 43 +++++++++++----- .../MERGEDSMPSAPS_tutorial.ipynb | 4 +- .../MERGEDSMPSAPS/mergedsmpsaps.c1.ipynb | 43 +++++++++++----- .../MERGESONDE/MERGESONDE_tutorial.ipynb | 4 +- .../MERGESONDE/mergesonde1mace.c1.ipynb | 43 +++++++++++----- .../MERGESONDE/mergesonde2mace.c1.ipynb | 43 +++++++++++----- .../MFRSRCLDOD/MFRSRCLDOD_tutorial.ipynb | 4 +- .../MFRSRCLDOD/mfrsrcldod1min.c1.ipynb | 43 +++++++++++----- .../MFRSRLANG/MFRSRLANG_tutorial.ipynb | 4 +- .../MFRSRLANG/mfrsr7nchlangley.c1.ipynb | 43 +++++++++++----- .../MFRSRLANG/mfrsr7nchlangplot.c1.ipynb | 43 +++++++++++----- .../MICROBASE/MICROBASE_tutorial.ipynb | 4 +- VAPs/quicklook/MICROBASE/microbasepi.c1.ipynb | 43 +++++++++++----- .../quicklook/MICROBASE/microbasepi2.c1.ipynb | 43 +++++++++++----- .../MICROBASE/microbasepiavg.c1.ipynb | 43 +++++++++++----- .../MICROBASEKAPLUS_tutorial.ipynb | 4 +- .../MICROBASEKAPLUS/microbase.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/MPLAVG/MPLAVG_tutorial.ipynb | 4 +- VAPs/quicklook/MPLAVG/mplpolavg.c1.ipynb | 43 +++++++++++----- .../MPLCMASK/30smplcmask1zwang.c1.ipynb | 51 +++++++++++++------ .../MPLCMASK/MPLCMASK_tutorial.ipynb | 8 +-- .../MPLCMASKML/MPLCMASKML_tutorial.ipynb | 4 +- VAPs/quicklook/MPLCMASKML/mplcmaskml.c1.ipynb | 47 ++++++++++++----- VAPs/quicklook/MPLNOR/MPLNOR_tutorial.ipynb | 4 +- VAPs/quicklook/MPLNOR/mplnor1camp.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/MWRRET/MWRRET_tutorial.ipynb | 4 +- .../quicklook/MWRRET/mwrret1liljclou.c1.ipynb | 47 ++++++++++++----- .../quicklook/MWRRET/mwrret1liljclou.c2.ipynb | 43 +++++++++++----- .../MWRRETV2/MWRRETV2_tutorial.ipynb | 4 +- VAPs/quicklook/MWRRETV2/mwrret2turn.c1.ipynb | 43 +++++++++++----- .../NAVMET-AIR/NAVMET-AIR_tutorial.ipynb | 4 +- VAPs/quicklook/NAVMET-AIR/aafnaviwg.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/NDROP/NDROP_tutorial.ipynb | 4 +- VAPs/quicklook/NDROP/ndropmfrsr.c1.ipynb | 43 +++++++++++----- .../NEPHELOMETER/NEPHELOMETER_tutorial.ipynb | 4 +- .../NEPHELOMETER/aosnephdry.c1.ipynb | 43 +++++++++++----- .../NEPHELOMETER/aosnephwet.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/NIMFR/NIMFR_tutorial.ipynb | 4 +- .../quicklook/NIMFR/nimfr7nchlangley.c1.ipynb | 43 +++++++++++----- .../NIMFR/nimfr7nchlangplot.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/OKMSOIL/OKMSOIL_tutorial.ipynb | 4 +- VAPs/quicklook/OKMSOIL/okmsoil.c1.ipynb | 43 +++++++++++----- .../OZONE-AIR/OZONE-AIR_tutorial.ipynb | 4 +- VAPs/quicklook/OZONE-AIR/aafo3.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/PBLHT/PBLHT_tutorial.ipynb | 4 +- .../PBLHT/pblhtsonde1mcfarl.c1.ipynb | 43 +++++++++++----- .../PBLHT/pblhtsondeyr1mcfarl.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/PCCP/PCCP_tutorial.ipynb | 14 ++--- VAPs/quicklook/PCCP/pccp.c1.ipynb | 12 ++--- VAPs/quicklook/PSAP/PSAP_tutorial.ipynb | 4 +- VAPs/quicklook/PSAP/aospsap3w.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/QCRAD/QCRAD_tutorial.ipynb | 4 +- VAPs/quicklook/QCRAD/qcrad1long.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/QCRAD/qcrad1long.c2.ipynb | 43 +++++++++++----- .../quicklook/QCRAD/qcradbeflux1long.c1.ipynb | 47 ++++++++++++----- .../quicklook/QCRAD/qcradbeflux1long.c2.ipynb | 43 +++++++++++----- VAPs/quicklook/QCRAD/qcradbrs1long.c1.ipynb | 47 ++++++++++++----- VAPs/quicklook/QCRAD/qcradbrs1long.c2.ipynb | 43 +++++++++++----- .../RADFLUXANAL/RADFLUXANAL_tutorial.ipynb | 4 +- .../RADFLUXANAL/radflux1long.c1.ipynb | 43 +++++++++++----- .../RADFLUXANAL/radflux1long.c2.ipynb | 43 +++++++++++----- .../RADFLUXANAL/radfluxbrs1long.c2.ipynb | 43 +++++++++++----- .../RIPBE/30ripbe1mcfarlane.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/RIPBE/RIPBE_tutorial.ipynb | 4 +- VAPs/quicklook/RIPBE/ripbe1mcfarlane.c1.ipynb | 43 +++++++++++----- .../quicklook/RLPROF/10rlprofbe1news.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/RLPROF/RLPROF_tutorial.ipynb | 4 +- .../SACRADV3D3C/SACRADV3D3C_tutorial.ipynb | 4 +- .../SACRADV3D3C/kasacradv3d3c.c1.ipynb | 43 +++++++++++----- .../SACRADVVAD/SACRADVVAD_tutorial.ipynb | 4 +- .../SACRADVVAD/kasacradvvad.c1.ipynb | 43 +++++++++++----- .../SFCCLDGRID/15swfcldgrid1long.c1.ipynb | 43 +++++++++++----- .../SFCCLDGRID/SFCCLDGRID_tutorial.ipynb | 4 +- .../sfccldgrid2longcaracena.c1.ipynb | 43 +++++++++++----- .../sfccldgrid2longstation.c1.ipynb | 43 +++++++++++----- .../SHALLOWCUMULUS_tutorial.ipynb | 4 +- .../SHALLOWCUMULUS/shallowcumulus.c1.ipynb | 43 +++++++++++----- .../SHALLOWCUMULUS/shcusummary.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/SO2-AIR/SO2-AIR_tutorial.ipynb | 4 +- VAPs/quicklook/SO2-AIR/aafso2.c1.ipynb | 43 +++++++++++----- .../SONDEADJUST/SONDEADJUST_tutorial.ipynb | 10 ++-- .../SONDEADJUST/sondeadjust.c1.ipynb | 49 ++++++++++++------ .../SONDEPARAM/SONDEPARAM_tutorial.ipynb | 4 +- VAPs/quicklook/SONDEPARAM/sondeparam.c1.ipynb | 47 ++++++++++++----- VAPs/quicklook/SP2-AIR/SP2-AIR_tutorial.ipynb | 4 +- VAPs/quicklook/SP2-AIR/aafsp2rbc10s.c1.ipynb | 43 +++++++++++----- .../SPHOTCOD/SPHOTCOD_tutorial.ipynb | 4 +- .../quicklook/SPHOTCOD/sphotcod2chiu.c1.ipynb | 43 +++++++++++----- .../SURFSPECALB/SURFSPECALB_tutorial.ipynb | 4 +- .../SURFSPECALB/surfspecalb1mlawer.c1.ipynb | 43 +++++++++++----- .../surfspecalb7nch1mlawer.c1.ipynb | 43 +++++++++++----- .../TBSMERGED/TBSMERGED_tutorial.ipynb | 4 +- VAPs/quicklook/TBSMERGED/tbsmerged.c1.ipynb | 43 +++++++++++----- .../TBSMERGED/tbsmergedincloud.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/TDMA/TDMA_tutorial.ipynb | 4 +- VAPs/quicklook/TDMA/tdmaapssize.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/TWRMR/1twrmr.c1.ipynb | 47 ++++++++++++----- VAPs/quicklook/TWRMR/30twrmr.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/TWRMR/TWRMR_tutorial.ipynb | 4 +- .../quicklook/VARANAL/180varanaecmwf.c1.ipynb | 43 +++++++++++----- .../VARANAL/180varanamerra001.c1.ipynb | 43 +++++++++++----- VAPs/quicklook/VARANAL/VARANAL_tutorial.ipynb | 4 +- .../VARANAL3D/180varanal3dera5.c1.ipynb | 43 +++++++++++----- .../VARANAL3D/180varanal3dncep.c1.ipynb | 43 +++++++++++----- .../VARANAL3D/VARANAL3D_tutorial.ipynb | 4 +- .../VDISQUANTS/VDISQUANTS_tutorial.ipynb | 4 +- VAPs/quicklook/VDISQUANTS/vdisquants.c1.ipynb | 47 ++++++++++++----- .../WACRARSCL/WACRARSCL_tutorial.ipynb | 4 +- .../WACRARSCL/arsclwacr1kollias.c1.ipynb | 43 +++++++++++----- .../WACRARSCL/arsclwacrbnd1kollias.c1.ipynb | 43 +++++++++++----- 230 files changed, 4684 insertions(+), 1829 deletions(-) diff --git a/VAPs/quicklook/2DS-AIR/2DS-AIR_tutorial.ipynb b/VAPs/quicklook/2DS-AIR/2DS-AIR_tutorial.ipynb index 8c69eeb8..ee9ed2b3 100644 --- a/VAPs/quicklook/2DS-AIR/2DS-AIR_tutorial.ipynb +++ b/VAPs/quicklook/2DS-AIR/2DS-AIR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/2DS-AIR/aaf2dsh.c1.ipynb b/VAPs/quicklook/2DS-AIR/aaf2dsh.c1.ipynb index e2d97a92..8bdfa9c3 100644 --- a/VAPs/quicklook/2DS-AIR/aaf2dsh.c1.ipynb +++ b/VAPs/quicklook/2DS-AIR/aaf2dsh.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/2DS-AIR/aaf2dsv.c1.ipynb b/VAPs/quicklook/2DS-AIR/aaf2dsv.c1.ipynb index 618a069e..ef286215 100644 --- a/VAPs/quicklook/2DS-AIR/aaf2dsv.c1.ipynb +++ b/VAPs/quicklook/2DS-AIR/aaf2dsv.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/ACSMCDCE/ACSMCDCE_tutorial.ipynb b/VAPs/quicklook/ACSMCDCE/ACSMCDCE_tutorial.ipynb index f0206b06..5c2475bb 100644 --- a/VAPs/quicklook/ACSMCDCE/ACSMCDCE_tutorial.ipynb +++ b/VAPs/quicklook/ACSMCDCE/ACSMCDCE_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/ACSMCDCE/acsmcdce.c1.ipynb b/VAPs/quicklook/ACSMCDCE/acsmcdce.c1.ipynb index 1a8af504..e04d41a9 100644 --- a/VAPs/quicklook/ACSMCDCE/acsmcdce.c1.ipynb +++ b/VAPs/quicklook/ACSMCDCE/acsmcdce.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'total_organics'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'total_organics'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/ACSMCDCE/acsmcdce.c2.ipynb b/VAPs/quicklook/ACSMCDCE/acsmcdce.c2.ipynb index 9c3b1d5f..05f9127b 100644 --- a/VAPs/quicklook/ACSMCDCE/acsmcdce.c2.ipynb +++ b/VAPs/quicklook/ACSMCDCE/acsmcdce.c2.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'total_organics_CDCE'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'total_organics_CDCE'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/ACSMCDCE/acsmtofcdce.c1.ipynb b/VAPs/quicklook/ACSMCDCE/acsmtofcdce.c1.ipynb index 06e49985..eb580ab7 100644 --- a/VAPs/quicklook/ACSMCDCE/acsmtofcdce.c1.ipynb +++ b/VAPs/quicklook/ACSMCDCE/acsmtofcdce.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'chloride'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'chloride'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AERINF/AERINF_tutorial.ipynb b/VAPs/quicklook/AERINF/AERINF_tutorial.ipynb index 54ae229e..6740fbc0 100644 --- a/VAPs/quicklook/AERINF/AERINF_tutorial.ipynb +++ b/VAPs/quicklook/AERINF/AERINF_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/AERINF/aerich1nf1turn.c1.ipynb b/VAPs/quicklook/AERINF/aerich1nf1turn.c1.ipynb index 9f7306f8..5c7c53ec 100644 --- a/VAPs/quicklook/AERINF/aerich1nf1turn.c1.ipynb +++ b/VAPs/quicklook/AERINF/aerich1nf1turn.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AERINF/aerich2nf1turn.c1.ipynb b/VAPs/quicklook/AERINF/aerich2nf1turn.c1.ipynb index 0fe98aed..b96686b9 100644 --- a/VAPs/quicklook/AERINF/aerich2nf1turn.c1.ipynb +++ b/VAPs/quicklook/AERINF/aerich2nf1turn.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AERIOE/AERIOE_tutorial.ipynb b/VAPs/quicklook/AERIOE/AERIOE_tutorial.ipynb index 9870fa59..75fd71d3 100644 --- a/VAPs/quicklook/AERIOE/AERIOE_tutorial.ipynb +++ b/VAPs/quicklook/AERIOE/AERIOE_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/AERIOE/aerioe1turn.c1.ipynb b/VAPs/quicklook/AERIOE/aerioe1turn.c1.ipynb index 09a36ec0..53f82fbe 100644 --- a/VAPs/quicklook/AERIOE/aerioe1turn.c1.ipynb +++ b/VAPs/quicklook/AERIOE/aerioe1turn.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AERIPROF/AERIPROF_tutorial.ipynb b/VAPs/quicklook/AERIPROF/AERIPROF_tutorial.ipynb index 4cbb96b1..ade6ae51 100644 --- a/VAPs/quicklook/AERIPROF/AERIPROF_tutorial.ipynb +++ b/VAPs/quicklook/AERIPROF/AERIPROF_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/AERIPROF/aeri01prof3feltz.c1.ipynb b/VAPs/quicklook/AERIPROF/aeri01prof3feltz.c1.ipynb index f41b5cf3..6e5731d0 100644 --- a/VAPs/quicklook/AERIPROF/aeri01prof3feltz.c1.ipynb +++ b/VAPs/quicklook/AERIPROF/aeri01prof3feltz.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'pressure'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'pressure'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AERIPROF/aeriprof3feltz.c1.ipynb b/VAPs/quicklook/AERIPROF/aeriprof3feltz.c1.ipynb index 5807dce0..7637659d 100644 --- a/VAPs/quicklook/AERIPROF/aeriprof3feltz.c1.ipynb +++ b/VAPs/quicklook/AERIPROF/aeriprof3feltz.c1.ipynb @@ -78,8 +78,8 @@ "source": [ "site_facility = ( 'sgp', 'C1' )\n", "\n", - "date_start = '2024-06-08'\n", - "date_end = '2024-06-10'" + "date_start = '2024-06-09'\n", + "date_end = '2024-06-11'" ] }, { @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'pressure'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'pressure'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AERIPROF/qmeaeriprof.c1.ipynb b/VAPs/quicklook/AERIPROF/qmeaeriprof.c1.ipynb index 87d1269d..4d3d4747 100644 --- a/VAPs/quicklook/AERIPROF/qmeaeriprof.c1.ipynb +++ b/VAPs/quicklook/AERIPROF/qmeaeriprof.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AEROSOLBE/AEROSOLBE_tutorial.ipynb b/VAPs/quicklook/AEROSOLBE/AEROSOLBE_tutorial.ipynb index 6c206c11..3e680e80 100644 --- a/VAPs/quicklook/AEROSOLBE/AEROSOLBE_tutorial.ipynb +++ b/VAPs/quicklook/AEROSOLBE/AEROSOLBE_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/AEROSOLBE/aerosolbe1turn.c1.ipynb b/VAPs/quicklook/AEROSOLBE/aerosolbe1turn.c1.ipynb index 1917696b..34d5eae7 100644 --- a/VAPs/quicklook/AEROSOLBE/aerosolbe1turn.c1.ipynb +++ b/VAPs/quicklook/AEROSOLBE/aerosolbe1turn.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'be_aod_500'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'be_aod_500'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AIP/AIP_tutorial.ipynb b/VAPs/quicklook/AIP/AIP_tutorial.ipynb index 30b87f3b..442bb5c1 100644 --- a/VAPs/quicklook/AIP/AIP_tutorial.ipynb +++ b/VAPs/quicklook/AIP/AIP_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/AIP/aip1ogren.c1.ipynb b/VAPs/quicklook/AIP/aip1ogren.c1.ipynb index bd220fdc..9a5becd8 100644 --- a/VAPs/quicklook/AIP/aip1ogren.c1.ipynb +++ b/VAPs/quicklook/AIP/aip1ogren.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'Ba_G_Dry_10um_PSAP1W_1'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'Ba_G_Dry_10um_PSAP1W_1'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AIP/aipavg1ogren.c1.ipynb b/VAPs/quicklook/AIP/aipavg1ogren.c1.ipynb index 951233ec..bd1dca52 100644 --- a/VAPs/quicklook/AIP/aipavg1ogren.c1.ipynb +++ b/VAPs/quicklook/AIP/aipavg1ogren.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'Ba_G_Dry_1um_PSAP1W_1'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'Ba_G_Dry_1um_PSAP1W_1'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AIP/aipfitrh1ogren.c1.ipynb b/VAPs/quicklook/AIP/aipfitrh1ogren.c1.ipynb index c59ef566..dba27aa4 100644 --- a/VAPs/quicklook/AIP/aipfitrh1ogren.c1.ipynb +++ b/VAPs/quicklook/AIP/aipfitrh1ogren.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'ratio_85by40_Bs_R_10um_3p'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'ratio_85by40_Bs_R_10um_3p'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AOD-MFRSR/AOD-MFRSR_tutorial.ipynb b/VAPs/quicklook/AOD-MFRSR/AOD-MFRSR_tutorial.ipynb index c4a783e7..12703499 100644 --- a/VAPs/quicklook/AOD-MFRSR/AOD-MFRSR_tutorial.ipynb +++ b/VAPs/quicklook/AOD-MFRSR/AOD-MFRSR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/AOD-MFRSR/mfrsr7nchaod1mich.c1.ipynb b/VAPs/quicklook/AOD-MFRSR/mfrsr7nchaod1mich.c1.ipynb index 46b48629..20b6ca3d 100644 --- a/VAPs/quicklook/AOD-MFRSR/mfrsr7nchaod1mich.c1.ipynb +++ b/VAPs/quicklook/AOD-MFRSR/mfrsr7nchaod1mich.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'hemisp_narrowband_filter1'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'hemisp_narrowband_filter1'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AOD-MFRSR/mfrsr7nchcal.c1.ipynb b/VAPs/quicklook/AOD-MFRSR/mfrsr7nchcal.c1.ipynb index dfe7efc7..25b43b2a 100644 --- a/VAPs/quicklook/AOD-MFRSR/mfrsr7nchcal.c1.ipynb +++ b/VAPs/quicklook/AOD-MFRSR/mfrsr7nchcal.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'Io_filter1'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'Io_filter1'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AOD-MFRSR/mfrsraod1mich.c1.ipynb b/VAPs/quicklook/AOD-MFRSR/mfrsraod1mich.c1.ipynb index 0f165a78..1560bbdc 100644 --- a/VAPs/quicklook/AOD-MFRSR/mfrsraod1mich.c1.ipynb +++ b/VAPs/quicklook/AOD-MFRSR/mfrsraod1mich.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'hemisp_broadband'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'hemisp_broadband'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AOD-MFRSR/mfrsrcal.c1.ipynb b/VAPs/quicklook/AOD-MFRSR/mfrsrcal.c1.ipynb index 9bc59961..4733a9fb 100644 --- a/VAPs/quicklook/AOD-MFRSR/mfrsrcal.c1.ipynb +++ b/VAPs/quicklook/AOD-MFRSR/mfrsrcal.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'Io_filter1'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'Io_filter1'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AOD-NIMFR/AOD-NIMFR_tutorial.ipynb b/VAPs/quicklook/AOD-NIMFR/AOD-NIMFR_tutorial.ipynb index 0f946fec..bc356a21 100644 --- a/VAPs/quicklook/AOD-NIMFR/AOD-NIMFR_tutorial.ipynb +++ b/VAPs/quicklook/AOD-NIMFR/AOD-NIMFR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/AOD-NIMFR/nimfraod1mich.c1.ipynb b/VAPs/quicklook/AOD-NIMFR/nimfraod1mich.c1.ipynb index 7f5c6356..85d62c72 100644 --- a/VAPs/quicklook/AOD-NIMFR/nimfraod1mich.c1.ipynb +++ b/VAPs/quicklook/AOD-NIMFR/nimfraod1mich.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'direct_normal_broadband'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'direct_normal_broadband'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AOD/AOD_tutorial.ipynb b/VAPs/quicklook/AOD/AOD_tutorial.ipynb index c3b44258..fba2dccb 100644 --- a/VAPs/quicklook/AOD/AOD_tutorial.ipynb +++ b/VAPs/quicklook/AOD/AOD_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/AOD/sasheniraod.c1.ipynb b/VAPs/quicklook/AOD/sasheniraod.c1.ipynb index d639d971..3c9f225d 100644 --- a/VAPs/quicklook/AOD/sasheniraod.c1.ipynb +++ b/VAPs/quicklook/AOD/sasheniraod.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'aerosol_optical_depth'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'aerosol_optical_depth'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AOD/sashevisaod.c1.ipynb b/VAPs/quicklook/AOD/sashevisaod.c1.ipynb index 82306043..31d9e395 100644 --- a/VAPs/quicklook/AOD/sashevisaod.c1.ipynb +++ b/VAPs/quicklook/AOD/sashevisaod.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'aerosol_optical_depth'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'aerosol_optical_depth'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AODBE/AODBE_tutorial.ipynb b/VAPs/quicklook/AODBE/AODBE_tutorial.ipynb index e7a6de3f..65532f25 100644 --- a/VAPs/quicklook/AODBE/AODBE_tutorial.ipynb +++ b/VAPs/quicklook/AODBE/AODBE_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/AODBE/aodbe2ch.c1.ipynb b/VAPs/quicklook/AODBE/aodbe2ch.c1.ipynb index 64f85bd2..c30c65c8 100644 --- a/VAPs/quicklook/AODBE/aodbe2ch.c1.ipynb +++ b/VAPs/quicklook/AODBE/aodbe2ch.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'aod_nimfr_500'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'aod_nimfr_500'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AODBE/aodbe5ch.c1.ipynb b/VAPs/quicklook/AODBE/aodbe5ch.c1.ipynb index 0d3d4278..04d87a10 100644 --- a/VAPs/quicklook/AODBE/aodbe5ch.c1.ipynb +++ b/VAPs/quicklook/AODBE/aodbe5ch.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'aod_mfrsr_415'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'aod_mfrsr_415'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AOP/AOP_tutorial.ipynb b/VAPs/quicklook/AOP/AOP_tutorial.ipynb index 046cb98d..716b1f56 100644 --- a/VAPs/quicklook/AOP/AOP_tutorial.ipynb +++ b/VAPs/quicklook/AOP/AOP_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/AOP/aopclap1flynn1m.c1.ipynb b/VAPs/quicklook/AOP/aopclap1flynn1m.c1.ipynb index 67b2a769..33742593 100644 --- a/VAPs/quicklook/AOP/aopclap1flynn1m.c1.ipynb +++ b/VAPs/quicklook/AOP/aopclap1flynn1m.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'Bs_B'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'Bs_B'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AOP/aoppsap1flynn1h.c1.ipynb b/VAPs/quicklook/AOP/aoppsap1flynn1h.c1.ipynb index 259edcc5..c06cb514 100644 --- a/VAPs/quicklook/AOP/aoppsap1flynn1h.c1.ipynb +++ b/VAPs/quicklook/AOP/aoppsap1flynn1h.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'Bs_B_1um'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'Bs_B_1um'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AOP/aoppsap1flynn1m.c1.ipynb b/VAPs/quicklook/AOP/aoppsap1flynn1m.c1.ipynb index 6fe2f247..841b0308 100644 --- a/VAPs/quicklook/AOP/aoppsap1flynn1m.c1.ipynb +++ b/VAPs/quicklook/AOP/aoppsap1flynn1m.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'Bs_B'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'Bs_B'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AOSCCNAVG/AOSCCNAVG_tutorial.ipynb b/VAPs/quicklook/AOSCCNAVG/AOSCCNAVG_tutorial.ipynb index 119617a9..0b2f68ec 100644 --- a/VAPs/quicklook/AOSCCNAVG/AOSCCNAVG_tutorial.ipynb +++ b/VAPs/quicklook/AOSCCNAVG/AOSCCNAVG_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/AOSCCNAVG/aosccnavg.c1.ipynb b/VAPs/quicklook/AOSCCNAVG/aosccnavg.c1.ipynb index b02c7119..f4dcf0b0 100644 --- a/VAPs/quicklook/AOSCCNAVG/aosccnavg.c1.ipynb +++ b/VAPs/quicklook/AOSCCNAVG/aosccnavg.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'supersaturation_setpoint'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'supersaturation_setpoint'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AOSCCNAVG/aosccnavg.c2.ipynb b/VAPs/quicklook/AOSCCNAVG/aosccnavg.c2.ipynb index bbdb98ff..e86e27f9 100644 --- a/VAPs/quicklook/AOSCCNAVG/aosccnavg.c2.ipynb +++ b/VAPs/quicklook/AOSCCNAVG/aosccnavg.c2.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'supersaturation_setpoint'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'supersaturation_setpoint'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/AOSSP2BC/AOSSP2BC_tutorial.ipynb b/VAPs/quicklook/AOSSP2BC/AOSSP2BC_tutorial.ipynb index 8424ceb8..fe848849 100644 --- a/VAPs/quicklook/AOSSP2BC/AOSSP2BC_tutorial.ipynb +++ b/VAPs/quicklook/AOSSP2BC/AOSSP2BC_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/AOSSP2BC/aossp2rbc1m.c1.ipynb b/VAPs/quicklook/AOSSP2BC/aossp2rbc1m.c1.ipynb index 4e97ce5d..de2eeaad 100644 --- a/VAPs/quicklook/AOSSP2BC/aossp2rbc1m.c1.ipynb +++ b/VAPs/quicklook/AOSSP2BC/aossp2rbc1m.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'rBC'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'rBC'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/ARMBE/ARMBE_tutorial.ipynb b/VAPs/quicklook/ARMBE/ARMBE_tutorial.ipynb index adc7a0c4..de79cadb 100644 --- a/VAPs/quicklook/ARMBE/ARMBE_tutorial.ipynb +++ b/VAPs/quicklook/ARMBE/ARMBE_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/ARMBE/armbeatm.c1.ipynb b/VAPs/quicklook/ARMBE/armbeatm.c1.ipynb index 83a646f4..e9a7d9d8 100644 --- a/VAPs/quicklook/ARMBE/armbeatm.c1.ipynb +++ b/VAPs/quicklook/ARMBE/armbeatm.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/ARMBE/armbecldrad.c1.ipynb b/VAPs/quicklook/ARMBE/armbecldrad.c1.ipynb index c495d58c..571c6718 100644 --- a/VAPs/quicklook/ARMBE/armbecldrad.c1.ipynb +++ b/VAPs/quicklook/ARMBE/armbecldrad.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'cld_frac'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'cld_frac'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/ARSCL/ARSCL_tutorial.ipynb b/VAPs/quicklook/ARSCL/ARSCL_tutorial.ipynb index 99ccc88f..c82373ec 100644 --- a/VAPs/quicklook/ARSCL/ARSCL_tutorial.ipynb +++ b/VAPs/quicklook/ARSCL/ARSCL_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/ARSCL/arscl1cloth.c1.ipynb b/VAPs/quicklook/ARSCL/arscl1cloth.c1.ipynb index 5ce801bb..efc01db0 100644 --- a/VAPs/quicklook/ARSCL/arscl1cloth.c1.ipynb +++ b/VAPs/quicklook/ARSCL/arscl1cloth.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'RadarArtifacts'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'RadarArtifacts'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/ARSCL/arsclbnd1cloth.c1.ipynb b/VAPs/quicklook/ARSCL/arsclbnd1cloth.c1.ipynb index 41573eeb..e5b18a25 100644 --- a/VAPs/quicklook/ARSCL/arsclbnd1cloth.c1.ipynb +++ b/VAPs/quicklook/ARSCL/arsclbnd1cloth.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'CloudLayerTopHeightMplCamp'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'CloudLayerTopHeightMplCamp'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/ASDBE-AIR/ASDBE-AIR_tutorial.ipynb b/VAPs/quicklook/ASDBE-AIR/ASDBE-AIR_tutorial.ipynb index 990074c5..13e5ff78 100644 --- a/VAPs/quicklook/ASDBE-AIR/ASDBE-AIR_tutorial.ipynb +++ b/VAPs/quicklook/ASDBE-AIR/ASDBE-AIR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/ASDBE-AIR/aafmergedaerosolsd.c1.ipynb b/VAPs/quicklook/ASDBE-AIR/aafmergedaerosolsd.c1.ipynb index 3bdc23f5..0f1de519 100644 --- a/VAPs/quicklook/ASDBE-AIR/aafmergedaerosolsd.c1.ipynb +++ b/VAPs/quicklook/ASDBE-AIR/aafmergedaerosolsd.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/BAEBBR/30baebbr.c1.ipynb b/VAPs/quicklook/BAEBBR/30baebbr.c1.ipynb index abb07cd8..f4435828 100644 --- a/VAPs/quicklook/BAEBBR/30baebbr.c1.ipynb +++ b/VAPs/quicklook/BAEBBR/30baebbr.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'aerodynamic_latent_heat_flux'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'aerodynamic_latent_heat_flux'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/BAEBBR/BAEBBR_tutorial.ipynb b/VAPs/quicklook/BAEBBR/BAEBBR_tutorial.ipynb index d33fceb1..d49cb808 100644 --- a/VAPs/quicklook/BAEBBR/BAEBBR_tutorial.ipynb +++ b/VAPs/quicklook/BAEBBR/BAEBBR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/BBHRP/1bbhrpripbe1mcfarlane.c1.ipynb b/VAPs/quicklook/BBHRP/1bbhrpripbe1mcfarlane.c1.ipynb index 3699d22b..8d23e3f9 100644 --- a/VAPs/quicklook/BBHRP/1bbhrpripbe1mcfarlane.c1.ipynb +++ b/VAPs/quicklook/BBHRP/1bbhrpripbe1mcfarlane.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'down_long_surf_flux'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'down_long_surf_flux'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/BBHRP/30bbhrpripbe1mcfarlane.c1.ipynb b/VAPs/quicklook/BBHRP/30bbhrpripbe1mcfarlane.c1.ipynb index c8cb54df..593bc912 100644 --- a/VAPs/quicklook/BBHRP/30bbhrpripbe1mcfarlane.c1.ipynb +++ b/VAPs/quicklook/BBHRP/30bbhrpripbe1mcfarlane.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'long_heating_rate'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'long_heating_rate'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/BBHRP/BBHRP_tutorial.ipynb b/VAPs/quicklook/BBHRP/BBHRP_tutorial.ipynb index c96913b2..dd578453 100644 --- a/VAPs/quicklook/BBHRP/BBHRP_tutorial.ipynb +++ b/VAPs/quicklook/BBHRP/BBHRP_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/BBHRP/bbhrpavg1mlawer.c1.ipynb b/VAPs/quicklook/BBHRP/bbhrpavg1mlawer.c1.ipynb index dc29e337..2b4b071a 100644 --- a/VAPs/quicklook/BBHRP/bbhrpavg1mlawer.c1.ipynb +++ b/VAPs/quicklook/BBHRP/bbhrpavg1mlawer.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'flux'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'flux'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/BEFLUX/BEFLUX_tutorial.ipynb b/VAPs/quicklook/BEFLUX/BEFLUX_tutorial.ipynb index f3f1ac60..c9fdc722 100644 --- a/VAPs/quicklook/BEFLUX/BEFLUX_tutorial.ipynb +++ b/VAPs/quicklook/BEFLUX/BEFLUX_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/BEFLUX/beflux1long.c1.ipynb b/VAPs/quicklook/BEFLUX/beflux1long.c1.ipynb index 66a9ddd1..aaceb056 100644 --- a/VAPs/quicklook/BEFLUX/beflux1long.c1.ipynb +++ b/VAPs/quicklook/BEFLUX/beflux1long.c1.ipynb @@ -78,8 +78,8 @@ "source": [ "site_facility = ( 'sgp', 'C1' )\n", "\n", - "date_start = '2024-06-09'\n", - "date_end = '2024-06-11'" + "date_start = '2024-06-10'\n", + "date_end = '2024-06-12'" ] }, { @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/BEFLUX/qcflux1long.c1.ipynb b/VAPs/quicklook/BEFLUX/qcflux1long.c1.ipynb index 0b95d2d2..9a1a6cd0 100644 --- a/VAPs/quicklook/BEFLUX/qcflux1long.c1.ipynb +++ b/VAPs/quicklook/BEFLUX/qcflux1long.c1.ipynb @@ -78,8 +78,8 @@ "source": [ "site_facility = ( 'sgp', 'C1' )\n", "\n", - "date_start = '2024-06-09'\n", - "date_end = '2024-06-11'" + "date_start = '2024-06-10'\n", + "date_end = '2024-06-12'" ] }, { @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/CCNKAPPA/CCNKAPPA_tutorial.ipynb b/VAPs/quicklook/CCNKAPPA/CCNKAPPA_tutorial.ipynb index e4b34d58..82eb32fa 100644 --- a/VAPs/quicklook/CCNKAPPA/CCNKAPPA_tutorial.ipynb +++ b/VAPs/quicklook/CCNKAPPA/CCNKAPPA_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/CCNKAPPA/aosccnsmpskappa.c1.ipynb b/VAPs/quicklook/CCNKAPPA/aosccnsmpskappa.c1.ipynb index ba4a0281..4fba663d 100644 --- a/VAPs/quicklook/CCNKAPPA/aosccnsmpskappa.c1.ipynb +++ b/VAPs/quicklook/CCNKAPPA/aosccnsmpskappa.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'kappa'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'kappa'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/CCNPROF/CCNPROF_tutorial.ipynb b/VAPs/quicklook/CCNPROF/CCNPROF_tutorial.ipynb index 8e68e62d..e382c59d 100644 --- a/VAPs/quicklook/CCNPROF/CCNPROF_tutorial.ipynb +++ b/VAPs/quicklook/CCNPROF/CCNPROF_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/CCNPROF/rlccnprof1ghan.c1.ipynb b/VAPs/quicklook/CCNPROF/rlccnprof1ghan.c1.ipynb index 7dff0fe3..3a15b28c 100644 --- a/VAPs/quicklook/CCNPROF/rlccnprof1ghan.c1.ipynb +++ b/VAPs/quicklook/CCNPROF/rlccnprof1ghan.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'rh_mean'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'rh_mean'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/CLAP/CLAP_tutorial.ipynb b/VAPs/quicklook/CLAP/CLAP_tutorial.ipynb index ee9c3bd2..24556364 100644 --- a/VAPs/quicklook/CLAP/CLAP_tutorial.ipynb +++ b/VAPs/quicklook/CLAP/CLAP_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/CLAP/aosclap3w.c1.ipynb b/VAPs/quicklook/CLAP/aosclap3w.c1.ipynb index 0d26236e..8b97af78 100644 --- a/VAPs/quicklook/CLAP/aosclap3w.c1.ipynb +++ b/VAPs/quicklook/CLAP/aosclap3w.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'Ba_B_CLAP3W_1'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'Ba_B_CLAP3W_1'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/CLDTYPE/CLDTYPE_tutorial.ipynb b/VAPs/quicklook/CLDTYPE/CLDTYPE_tutorial.ipynb index d9182f2e..6ff2f957 100644 --- a/VAPs/quicklook/CLDTYPE/CLDTYPE_tutorial.ipynb +++ b/VAPs/quicklook/CLDTYPE/CLDTYPE_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/CLDTYPE/cldtype.c1.ipynb b/VAPs/quicklook/CLDTYPE/cldtype.c1.ipynb index c3bc4d76..c596b00a 100644 --- a/VAPs/quicklook/CLDTYPE/cldtype.c1.ipynb +++ b/VAPs/quicklook/CLDTYPE/cldtype.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'cloudtype'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'cloudtype'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/CMAC2/CMAC2_tutorial.ipynb b/VAPs/quicklook/CMAC2/CMAC2_tutorial.ipynb index 9407cd06..d3098b69 100644 --- a/VAPs/quicklook/CMAC2/CMAC2_tutorial.ipynb +++ b/VAPs/quicklook/CMAC2/CMAC2_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/CMAC2/cmac2.c1.ipynb b/VAPs/quicklook/CMAC2/cmac2.c1.ipynb index 9a3ae817..ffa16f11 100644 --- a/VAPs/quicklook/CMAC2/cmac2.c1.ipynb +++ b/VAPs/quicklook/CMAC2/cmac2.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/CO-AIR/CO-AIR_tutorial.ipynb b/VAPs/quicklook/CO-AIR/CO-AIR_tutorial.ipynb index 96f15f99..449660bd 100644 --- a/VAPs/quicklook/CO-AIR/CO-AIR_tutorial.ipynb +++ b/VAPs/quicklook/CO-AIR/CO-AIR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/CO-AIR/aafco.c1.ipynb b/VAPs/quicklook/CO-AIR/aafco.c1.ipynb index 8d273239..eea25053 100644 --- a/VAPs/quicklook/CO-AIR/aafco.c1.ipynb +++ b/VAPs/quicklook/CO-AIR/aafco.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/COGS/COGS_tutorial.ipynb b/VAPs/quicklook/COGS/COGS_tutorial.ipynb index 4b77be7b..974a72f6 100644 --- a/VAPs/quicklook/COGS/COGS_tutorial.ipynb +++ b/VAPs/quicklook/COGS/COGS_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/COGS/cogs.c1.ipynb b/VAPs/quicklook/COGS/cogs.c1.ipynb index df570db1..9e0d8f1c 100644 --- a/VAPs/quicklook/COGS/cogs.c1.ipynb +++ b/VAPs/quicklook/COGS/cogs.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/DIFFCOR/DIFFCOR_tutorial.ipynb b/VAPs/quicklook/DIFFCOR/DIFFCOR_tutorial.ipynb index 0e49becf..a82192e1 100644 --- a/VAPs/quicklook/DIFFCOR/DIFFCOR_tutorial.ipynb +++ b/VAPs/quicklook/DIFFCOR/DIFFCOR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/DIFFCOR/brs1dutt.c1.ipynb b/VAPs/quicklook/DIFFCOR/brs1dutt.c1.ipynb index 3b237a0b..f16d0a8b 100644 --- a/VAPs/quicklook/DIFFCOR/brs1dutt.c1.ipynb +++ b/VAPs/quicklook/DIFFCOR/brs1dutt.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/DIFFCOR/siros1dutt.c1.ipynb b/VAPs/quicklook/DIFFCOR/siros1dutt.c1.ipynb index 6b1f67ab..1f115b55 100644 --- a/VAPs/quicklook/DIFFCOR/siros1dutt.c1.ipynb +++ b/VAPs/quicklook/DIFFCOR/siros1dutt.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/DIFFCOR/sirs1dutt.c1.ipynb b/VAPs/quicklook/DIFFCOR/sirs1dutt.c1.ipynb index d494bf23..47cca105 100644 --- a/VAPs/quicklook/DIFFCOR/sirs1dutt.c1.ipynb +++ b/VAPs/quicklook/DIFFCOR/sirs1dutt.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/DLMC/DLMC_tutorial.ipynb b/VAPs/quicklook/DLMC/DLMC_tutorial.ipynb index 3d8e4b52..98505b52 100644 --- a/VAPs/quicklook/DLMC/DLMC_tutorial.ipynb +++ b/VAPs/quicklook/DLMC/DLMC_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/DLMC/dlmcfpt.c1.ipynb b/VAPs/quicklook/DLMC/dlmcfpt.c1.ipynb index 289a5578..974550e9 100644 --- a/VAPs/quicklook/DLMC/dlmcfpt.c1.ipynb +++ b/VAPs/quicklook/DLMC/dlmcfpt.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'azimuth'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'azimuth'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/DLMC/dlmcusr.c1.ipynb b/VAPs/quicklook/DLMC/dlmcusr.c1.ipynb index 1cf85101..7245838a 100644 --- a/VAPs/quicklook/DLMC/dlmcusr.c1.ipynb +++ b/VAPs/quicklook/DLMC/dlmcusr.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'azimuth'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'azimuth'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/DLMCPROF-WIND/DLMCPROF-WIND_tutorial.ipynb b/VAPs/quicklook/DLMCPROF-WIND/DLMCPROF-WIND_tutorial.ipynb index cbca3513..658fe06a 100644 --- a/VAPs/quicklook/DLMCPROF-WIND/DLMCPROF-WIND_tutorial.ipynb +++ b/VAPs/quicklook/DLMCPROF-WIND/DLMCPROF-WIND_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/DLMCPROF-WIND/dlmcprofwindnews.c1.ipynb b/VAPs/quicklook/DLMCPROF-WIND/dlmcprofwindnews.c1.ipynb index dc8f7541..d16e0b3a 100644 --- a/VAPs/quicklook/DLMCPROF-WIND/dlmcprofwindnews.c1.ipynb +++ b/VAPs/quicklook/DLMCPROF-WIND/dlmcprofwindnews.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/DLPROF-WIND/DLPROF-WIND_tutorial.ipynb b/VAPs/quicklook/DLPROF-WIND/DLPROF-WIND_tutorial.ipynb index 9bd878f3..cd3ae723 100644 --- a/VAPs/quicklook/DLPROF-WIND/DLPROF-WIND_tutorial.ipynb +++ b/VAPs/quicklook/DLPROF-WIND/DLPROF-WIND_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/DLPROF-WIND/dlprofwind4news.c1.ipynb b/VAPs/quicklook/DLPROF-WIND/dlprofwind4news.c1.ipynb index a674475c..73a9e4c2 100644 --- a/VAPs/quicklook/DLPROF-WIND/dlprofwind4news.c1.ipynb +++ b/VAPs/quicklook/DLPROF-WIND/dlprofwind4news.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/DLPROF-WSTATS/DLPROF-WSTATS_tutorial.ipynb b/VAPs/quicklook/DLPROF-WSTATS/DLPROF-WSTATS_tutorial.ipynb index 42e1edfd..25c0e419 100644 --- a/VAPs/quicklook/DLPROF-WSTATS/DLPROF-WSTATS_tutorial.ipynb +++ b/VAPs/quicklook/DLPROF-WSTATS/DLPROF-WSTATS_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/DLPROF-WSTATS/dlprofwstats4news.c1.ipynb b/VAPs/quicklook/DLPROF-WSTATS/dlprofwstats4news.c1.ipynb index 6a4c77ed..19a3e035 100644 --- a/VAPs/quicklook/DLPROF-WSTATS/dlprofwstats4news.c1.ipynb +++ b/VAPs/quicklook/DLPROF-WSTATS/dlprofwstats4news.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/FCDP-AIR/FCDP-AIR_tutorial.ipynb b/VAPs/quicklook/FCDP-AIR/FCDP-AIR_tutorial.ipynb index 0dc53712..f9dee886 100644 --- a/VAPs/quicklook/FCDP-AIR/FCDP-AIR_tutorial.ipynb +++ b/VAPs/quicklook/FCDP-AIR/FCDP-AIR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/FCDP-AIR/aaffcdp.c1.ipynb b/VAPs/quicklook/FCDP-AIR/aaffcdp.c1.ipynb index 3937aa15..58c7a8d3 100644 --- a/VAPs/quicklook/FCDP-AIR/aaffcdp.c1.ipynb +++ b/VAPs/quicklook/FCDP-AIR/aaffcdp.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/GVR/GVR_tutorial.ipynb b/VAPs/quicklook/GVR/GVR_tutorial.ipynb index 64740bdd..89a4e35a 100644 --- a/VAPs/quicklook/GVR/GVR_tutorial.ipynb +++ b/VAPs/quicklook/GVR/GVR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/GVR/gvr.c1.ipynb b/VAPs/quicklook/GVR/gvr.c1.ipynb index 01a24000..e956f96d 100644 --- a/VAPs/quicklook/GVR/gvr.c1.ipynb +++ b/VAPs/quicklook/GVR/gvr.c1.ipynb @@ -78,8 +78,8 @@ "source": [ "site_facility = ( 'nsa', 'C1' )\n", "\n", - "date_start = '2024-06-07'\n", - "date_end = '2024-06-09'" + "date_start = '2024-06-08'\n", + "date_end = '2024-06-10'" ] }, { @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'tbsky1'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'tbsky1'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/HVPS-AIR/HVPS-AIR_tutorial.ipynb b/VAPs/quicklook/HVPS-AIR/HVPS-AIR_tutorial.ipynb index b8af1139..e568b551 100644 --- a/VAPs/quicklook/HVPS-AIR/HVPS-AIR_tutorial.ipynb +++ b/VAPs/quicklook/HVPS-AIR/HVPS-AIR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/HVPS-AIR/aafhvps.c1.ipynb b/VAPs/quicklook/HVPS-AIR/aafhvps.c1.ipynb index 30779ed5..95bbf01c 100644 --- a/VAPs/quicklook/HVPS-AIR/aafhvps.c1.ipynb +++ b/VAPs/quicklook/HVPS-AIR/aafhvps.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/INLETCVI-AIR/INLETCVI-AIR_tutorial.ipynb b/VAPs/quicklook/INLETCVI-AIR/INLETCVI-AIR_tutorial.ipynb index 3f230f7e..8afbcdaa 100644 --- a/VAPs/quicklook/INLETCVI-AIR/INLETCVI-AIR_tutorial.ipynb +++ b/VAPs/quicklook/INLETCVI-AIR/INLETCVI-AIR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/INLETCVI-AIR/aafinletcvi.c1.ipynb b/VAPs/quicklook/INLETCVI-AIR/aafinletcvi.c1.ipynb index 773c2a81..2831e83f 100644 --- a/VAPs/quicklook/INLETCVI-AIR/aafinletcvi.c1.ipynb +++ b/VAPs/quicklook/INLETCVI-AIR/aafinletcvi.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'cvi_cut_size'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'cvi_cut_size'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/INTERPSONDE/INTERPSONDE_tutorial.ipynb b/VAPs/quicklook/INTERPSONDE/INTERPSONDE_tutorial.ipynb index 15f09408..06ddcec0 100644 --- a/VAPs/quicklook/INTERPSONDE/INTERPSONDE_tutorial.ipynb +++ b/VAPs/quicklook/INTERPSONDE/INTERPSONDE_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/INTERPSONDE/interpolatedsonde.c1.ipynb b/VAPs/quicklook/INTERPSONDE/interpolatedsonde.c1.ipynb index 4c9d19d9..c790bcdf 100644 --- a/VAPs/quicklook/INTERPSONDE/interpolatedsonde.c1.ipynb +++ b/VAPs/quicklook/INTERPSONDE/interpolatedsonde.c1.ipynb @@ -78,8 +78,8 @@ "source": [ "site_facility = ( 'sgp', 'C1' )\n", "\n", - "date_start = '2024-06-02'\n", - "date_end = '2024-06-04'" + "date_start = '2024-06-03'\n", + "date_end = '2024-06-05'" ] }, { @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'precip'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'precip'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/KAZRARSCL/KAZRARSCL_tutorial.ipynb b/VAPs/quicklook/KAZRARSCL/KAZRARSCL_tutorial.ipynb index 8f93ec70..dc785747 100644 --- a/VAPs/quicklook/KAZRARSCL/KAZRARSCL_tutorial.ipynb +++ b/VAPs/quicklook/KAZRARSCL/KAZRARSCL_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/KAZRARSCL/arsclkazr1kollias.c1.ipynb b/VAPs/quicklook/KAZRARSCL/arsclkazr1kollias.c1.ipynb index d70ca971..92f64847 100644 --- a/VAPs/quicklook/KAZRARSCL/arsclkazr1kollias.c1.ipynb +++ b/VAPs/quicklook/KAZRARSCL/arsclkazr1kollias.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'reflectivity_best_estimate'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'reflectivity_best_estimate'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/KAZRARSCL/arsclkazrbnd1kollias.c1.ipynb b/VAPs/quicklook/KAZRARSCL/arsclkazrbnd1kollias.c1.ipynb index cbba25f0..650beba6 100644 --- a/VAPs/quicklook/KAZRARSCL/arsclkazrbnd1kollias.c1.ipynb +++ b/VAPs/quicklook/KAZRARSCL/arsclkazrbnd1kollias.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/KAZRARSCLCLOUDSAT/KAZRARSCLCLOUDSAT_tutorial.ipynb b/VAPs/quicklook/KAZRARSCLCLOUDSAT/KAZRARSCLCLOUDSAT_tutorial.ipynb index 3dcc4e13..49baca7a 100644 --- a/VAPs/quicklook/KAZRARSCLCLOUDSAT/KAZRARSCLCLOUDSAT_tutorial.ipynb +++ b/VAPs/quicklook/KAZRARSCLCLOUDSAT/KAZRARSCLCLOUDSAT_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/KAZRARSCLCLOUDSAT/arsclkazrcloudsat.c1.ipynb b/VAPs/quicklook/KAZRARSCLCLOUDSAT/arsclkazrcloudsat.c1.ipynb index 3d91c679..9d3952c8 100644 --- a/VAPs/quicklook/KAZRARSCLCLOUDSAT/arsclkazrcloudsat.c1.ipynb +++ b/VAPs/quicklook/KAZRARSCLCLOUDSAT/arsclkazrcloudsat.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'reflectivity_best_estimate'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'reflectivity_best_estimate'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/KAZRCFRCOR/KAZRCFRCOR_tutorial.ipynb b/VAPs/quicklook/KAZRCFRCOR/KAZRCFRCOR_tutorial.ipynb index 4a310388..a34958d6 100644 --- a/VAPs/quicklook/KAZRCFRCOR/KAZRCFRCOR_tutorial.ipynb +++ b/VAPs/quicklook/KAZRCFRCOR/KAZRCFRCOR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/KAZRCFRCOR/kazrcfrcorge.c1.ipynb b/VAPs/quicklook/KAZRCFRCOR/kazrcfrcorge.c1.ipynb index b9843e4d..05fdad00 100644 --- a/VAPs/quicklook/KAZRCFRCOR/kazrcfrcorge.c1.ipynb +++ b/VAPs/quicklook/KAZRCFRCOR/kazrcfrcorge.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'mean_doppler_velocity'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'mean_doppler_velocity'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/KAZRCFRCOR/kazrcfrcormd.c1.ipynb b/VAPs/quicklook/KAZRCFRCOR/kazrcfrcormd.c1.ipynb index 616a9d95..939a90bc 100644 --- a/VAPs/quicklook/KAZRCFRCOR/kazrcfrcormd.c1.ipynb +++ b/VAPs/quicklook/KAZRCFRCOR/kazrcfrcormd.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'mean_doppler_velocity'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'mean_doppler_velocity'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/KAZRCOR/KAZRCOR_tutorial.ipynb b/VAPs/quicklook/KAZRCOR/KAZRCOR_tutorial.ipynb index 71e289f5..67b016d6 100644 --- a/VAPs/quicklook/KAZRCOR/KAZRCOR_tutorial.ipynb +++ b/VAPs/quicklook/KAZRCOR/KAZRCOR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/KAZRCOR/kazrcorge.c1.ipynb b/VAPs/quicklook/KAZRCOR/kazrcorge.c1.ipynb index 1d601081..9b4ab23c 100644 --- a/VAPs/quicklook/KAZRCOR/kazrcorge.c1.ipynb +++ b/VAPs/quicklook/KAZRCOR/kazrcorge.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'reflectivity'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'reflectivity'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/KAZRCOR/kazrcorhi.c1.ipynb b/VAPs/quicklook/KAZRCOR/kazrcorhi.c1.ipynb index dcd4c549..eda0c800 100644 --- a/VAPs/quicklook/KAZRCOR/kazrcorhi.c1.ipynb +++ b/VAPs/quicklook/KAZRCOR/kazrcorhi.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'reflectivity'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'reflectivity'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/KAZRCOR/kazrcormd.c1.ipynb b/VAPs/quicklook/KAZRCOR/kazrcormd.c1.ipynb index ce6080ea..c707bd36 100644 --- a/VAPs/quicklook/KAZRCOR/kazrcormd.c1.ipynb +++ b/VAPs/quicklook/KAZRCOR/kazrcormd.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'reflectivity'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'reflectivity'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/LCLHEIGHT/LCLHEIGHT_tutorial.ipynb b/VAPs/quicklook/LCLHEIGHT/LCLHEIGHT_tutorial.ipynb index 390180bc..6251a64e 100644 --- a/VAPs/quicklook/LCLHEIGHT/LCLHEIGHT_tutorial.ipynb +++ b/VAPs/quicklook/LCLHEIGHT/LCLHEIGHT_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/LCLHEIGHT/lcl.c1.ipynb b/VAPs/quicklook/LCLHEIGHT/lcl.c1.ipynb index 228d41ed..340e4e09 100644 --- a/VAPs/quicklook/LCLHEIGHT/lcl.c1.ipynb +++ b/VAPs/quicklook/LCLHEIGHT/lcl.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'temperature'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'temperature'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/LDQUANTS/LDQUANTS_tutorial.ipynb b/VAPs/quicklook/LDQUANTS/LDQUANTS_tutorial.ipynb index 0c67f4f5..07696d8d 100644 --- a/VAPs/quicklook/LDQUANTS/LDQUANTS_tutorial.ipynb +++ b/VAPs/quicklook/LDQUANTS/LDQUANTS_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/LDQUANTS/ldquants.c1.ipynb b/VAPs/quicklook/LDQUANTS/ldquants.c1.ipynb index 2165e1b8..38c67d9e 100644 --- a/VAPs/quicklook/LDQUANTS/ldquants.c1.ipynb +++ b/VAPs/quicklook/LDQUANTS/ldquants.c1.ipynb @@ -78,8 +78,8 @@ "source": [ "site_facility = ( 'sgp', 'C1' )\n", "\n", - "date_start = '2024-06-09'\n", - "date_end = '2024-06-11'" + "date_start = '2024-06-10'\n", + "date_end = '2024-06-12'" ] }, { @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/LSSONDE/LSSONDE_tutorial.ipynb b/VAPs/quicklook/LSSONDE/LSSONDE_tutorial.ipynb index f5de87c4..26fe541e 100644 --- a/VAPs/quicklook/LSSONDE/LSSONDE_tutorial.ipynb +++ b/VAPs/quicklook/LSSONDE/LSSONDE_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/LSSONDE/lssonde.c1.ipynb b/VAPs/quicklook/LSSONDE/lssonde.c1.ipynb index 15db210c..70ca3968 100644 --- a/VAPs/quicklook/LSSONDE/lssonde.c1.ipynb +++ b/VAPs/quicklook/LSSONDE/lssonde.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,linestyle='None')\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,linestyle='None')\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MASCPARTICLES/MASCPARTICLES_tutorial.ipynb b/VAPs/quicklook/MASCPARTICLES/MASCPARTICLES_tutorial.ipynb index 9a6512de..94244237 100644 --- a/VAPs/quicklook/MASCPARTICLES/MASCPARTICLES_tutorial.ipynb +++ b/VAPs/quicklook/MASCPARTICLES/MASCPARTICLES_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/MASCPARTICLES/mascparticles.c1.ipynb b/VAPs/quicklook/MASCPARTICLES/mascparticles.c1.ipynb index 53d86019..654650f7 100644 --- a/VAPs/quicklook/MASCPARTICLES/mascparticles.c1.ipynb +++ b/VAPs/quicklook/MASCPARTICLES/mascparticles.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'snowflake_fall_speed'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'snowflake_fall_speed'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MASCPARTICLES/mascparticlesavg.c1.ipynb b/VAPs/quicklook/MASCPARTICLES/mascparticlesavg.c1.ipynb index 152fb216..8d69d805 100644 --- a/VAPs/quicklook/MASCPARTICLES/mascparticlesavg.c1.ipynb +++ b/VAPs/quicklook/MASCPARTICLES/mascparticlesavg.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'num_particles_total'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'num_particles_total'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MERGED-COMMON/MERGED-COMMON_tutorial.ipynb b/VAPs/quicklook/MERGED-COMMON/MERGED-COMMON_tutorial.ipynb index a4135270..26a315a6 100644 --- a/VAPs/quicklook/MERGED-COMMON/MERGED-COMMON_tutorial.ipynb +++ b/VAPs/quicklook/MERGED-COMMON/MERGED-COMMON_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/MERGED-COMMON/aafmergedcldsd.c1.ipynb b/VAPs/quicklook/MERGED-COMMON/aafmergedcldsd.c1.ipynb index 476c1c20..adf3b5b3 100644 --- a/VAPs/quicklook/MERGED-COMMON/aafmergedcldsd.c1.ipynb +++ b/VAPs/quicklook/MERGED-COMMON/aafmergedcldsd.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MERGEDSMPSAPS/MERGEDSMPSAPS_tutorial.ipynb b/VAPs/quicklook/MERGEDSMPSAPS/MERGEDSMPSAPS_tutorial.ipynb index 70f55f35..f342df14 100644 --- a/VAPs/quicklook/MERGEDSMPSAPS/MERGEDSMPSAPS_tutorial.ipynb +++ b/VAPs/quicklook/MERGEDSMPSAPS/MERGEDSMPSAPS_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/MERGEDSMPSAPS/mergedsmpsaps.c1.ipynb b/VAPs/quicklook/MERGEDSMPSAPS/mergedsmpsaps.c1.ipynb index 92ef6c17..5afbccd0 100644 --- a/VAPs/quicklook/MERGEDSMPSAPS/mergedsmpsaps.c1.ipynb +++ b/VAPs/quicklook/MERGEDSMPSAPS/mergedsmpsaps.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'effective_density'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'effective_density'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MERGESONDE/MERGESONDE_tutorial.ipynb b/VAPs/quicklook/MERGESONDE/MERGESONDE_tutorial.ipynb index b9076219..da64fab3 100644 --- a/VAPs/quicklook/MERGESONDE/MERGESONDE_tutorial.ipynb +++ b/VAPs/quicklook/MERGESONDE/MERGESONDE_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/MERGESONDE/mergesonde1mace.c1.ipynb b/VAPs/quicklook/MERGESONDE/mergesonde1mace.c1.ipynb index c204c85b..51e08079 100644 --- a/VAPs/quicklook/MERGESONDE/mergesonde1mace.c1.ipynb +++ b/VAPs/quicklook/MERGESONDE/mergesonde1mace.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'precip'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'precip'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MERGESONDE/mergesonde2mace.c1.ipynb b/VAPs/quicklook/MERGESONDE/mergesonde2mace.c1.ipynb index da8efd72..df3d2b9a 100644 --- a/VAPs/quicklook/MERGESONDE/mergesonde2mace.c1.ipynb +++ b/VAPs/quicklook/MERGESONDE/mergesonde2mace.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'precip'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'precip'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MFRSRCLDOD/MFRSRCLDOD_tutorial.ipynb b/VAPs/quicklook/MFRSRCLDOD/MFRSRCLDOD_tutorial.ipynb index 35f91ade..3c8cfe5f 100644 --- a/VAPs/quicklook/MFRSRCLDOD/MFRSRCLDOD_tutorial.ipynb +++ b/VAPs/quicklook/MFRSRCLDOD/MFRSRCLDOD_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/MFRSRCLDOD/mfrsrcldod1min.c1.ipynb b/VAPs/quicklook/MFRSRCLDOD/mfrsrcldod1min.c1.ipynb index 60a52a07..6034752a 100644 --- a/VAPs/quicklook/MFRSRCLDOD/mfrsrcldod1min.c1.ipynb +++ b/VAPs/quicklook/MFRSRCLDOD/mfrsrcldod1min.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'optical_depth_instantaneous'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'optical_depth_instantaneous'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MFRSRLANG/MFRSRLANG_tutorial.ipynb b/VAPs/quicklook/MFRSRLANG/MFRSRLANG_tutorial.ipynb index c5b5e289..2ba49b45 100644 --- a/VAPs/quicklook/MFRSRLANG/MFRSRLANG_tutorial.ipynb +++ b/VAPs/quicklook/MFRSRLANG/MFRSRLANG_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/MFRSRLANG/mfrsr7nchlangley.c1.ipynb b/VAPs/quicklook/MFRSRLANG/mfrsr7nchlangley.c1.ipynb index e9ed7dd4..3bdd1654 100644 --- a/VAPs/quicklook/MFRSRLANG/mfrsr7nchlangley.c1.ipynb +++ b/VAPs/quicklook/MFRSRLANG/mfrsr7nchlangley.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MFRSRLANG/mfrsr7nchlangplot.c1.ipynb b/VAPs/quicklook/MFRSRLANG/mfrsr7nchlangplot.c1.ipynb index d69bab23..fcafb0fd 100644 --- a/VAPs/quicklook/MFRSRLANG/mfrsr7nchlangplot.c1.ipynb +++ b/VAPs/quicklook/MFRSRLANG/mfrsr7nchlangplot.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MICROBASE/MICROBASE_tutorial.ipynb b/VAPs/quicklook/MICROBASE/MICROBASE_tutorial.ipynb index 279bea38..2cf5181e 100644 --- a/VAPs/quicklook/MICROBASE/MICROBASE_tutorial.ipynb +++ b/VAPs/quicklook/MICROBASE/MICROBASE_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/MICROBASE/microbasepi.c1.ipynb b/VAPs/quicklook/MICROBASE/microbasepi.c1.ipynb index 689f3dca..22dda3b3 100644 --- a/VAPs/quicklook/MICROBASE/microbasepi.c1.ipynb +++ b/VAPs/quicklook/MICROBASE/microbasepi.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MICROBASE/microbasepi2.c1.ipynb b/VAPs/quicklook/MICROBASE/microbasepi2.c1.ipynb index c536eb89..14696c55 100644 --- a/VAPs/quicklook/MICROBASE/microbasepi2.c1.ipynb +++ b/VAPs/quicklook/MICROBASE/microbasepi2.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MICROBASE/microbasepiavg.c1.ipynb b/VAPs/quicklook/MICROBASE/microbasepiavg.c1.ipynb index e938e462..6b4c1e52 100644 --- a/VAPs/quicklook/MICROBASE/microbasepiavg.c1.ipynb +++ b/VAPs/quicklook/MICROBASE/microbasepiavg.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MICROBASEKAPLUS/MICROBASEKAPLUS_tutorial.ipynb b/VAPs/quicklook/MICROBASEKAPLUS/MICROBASEKAPLUS_tutorial.ipynb index 7ba2f53e..2fff67c7 100644 --- a/VAPs/quicklook/MICROBASEKAPLUS/MICROBASEKAPLUS_tutorial.ipynb +++ b/VAPs/quicklook/MICROBASEKAPLUS/MICROBASEKAPLUS_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/MICROBASEKAPLUS/microbase.c1.ipynb b/VAPs/quicklook/MICROBASEKAPLUS/microbase.c1.ipynb index 359c0727..8dbf022a 100644 --- a/VAPs/quicklook/MICROBASEKAPLUS/microbase.c1.ipynb +++ b/VAPs/quicklook/MICROBASEKAPLUS/microbase.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'liquid_water_content'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'liquid_water_content'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MPLAVG/MPLAVG_tutorial.ipynb b/VAPs/quicklook/MPLAVG/MPLAVG_tutorial.ipynb index 2c7468e7..21a16885 100644 --- a/VAPs/quicklook/MPLAVG/MPLAVG_tutorial.ipynb +++ b/VAPs/quicklook/MPLAVG/MPLAVG_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/MPLAVG/mplpolavg.c1.ipynb b/VAPs/quicklook/MPLAVG/mplpolavg.c1.ipynb index 568525c8..afed20a3 100644 --- a/VAPs/quicklook/MPLAVG/mplpolavg.c1.ipynb +++ b/VAPs/quicklook/MPLAVG/mplpolavg.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'range_offset'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'range_offset'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MPLCMASK/30smplcmask1zwang.c1.ipynb b/VAPs/quicklook/MPLCMASK/30smplcmask1zwang.c1.ipynb index aca86f50..c60c0bef 100644 --- a/VAPs/quicklook/MPLCMASK/30smplcmask1zwang.c1.ipynb +++ b/VAPs/quicklook/MPLCMASK/30smplcmask1zwang.c1.ipynb @@ -78,8 +78,8 @@ "source": [ "site_facility = ( 'sgp', 'C1' )\n", "\n", - "date_start = '2024-06-07'\n", - "date_end = '2024-06-09'" + "date_start = '2024-06-08'\n", + "date_end = '2024-06-10'" ] }, { @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'linear_depol_ratio'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'linear_depol_ratio'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { @@ -326,7 +345,7 @@ }, { "cell_type": "markdown", - "id": "c8605fca", + "id": "ba2a3456", "metadata": {}, "source": [ "## Backscatter Plot" @@ -335,7 +354,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5ddcda93", + "id": "656828b5", "metadata": {}, "outputs": [], "source": [ diff --git a/VAPs/quicklook/MPLCMASK/MPLCMASK_tutorial.ipynb b/VAPs/quicklook/MPLCMASK/MPLCMASK_tutorial.ipynb index 4741e6ff..4c4c50dd 100644 --- a/VAPs/quicklook/MPLCMASK/MPLCMASK_tutorial.ipynb +++ b/VAPs/quicklook/MPLCMASK/MPLCMASK_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -833,7 +835,7 @@ }, { "cell_type": "markdown", - "id": "5b9a170c", + "id": "88d98f69", "metadata": {}, "source": [ "## Backscatter Plot" @@ -842,7 +844,7 @@ { "cell_type": "code", "execution_count": null, - "id": "edd78247", + "id": "95e7e08c", "metadata": {}, "outputs": [], "source": [ diff --git a/VAPs/quicklook/MPLCMASKML/MPLCMASKML_tutorial.ipynb b/VAPs/quicklook/MPLCMASKML/MPLCMASKML_tutorial.ipynb index e3dcefe8..afece68e 100644 --- a/VAPs/quicklook/MPLCMASKML/MPLCMASKML_tutorial.ipynb +++ b/VAPs/quicklook/MPLCMASKML/MPLCMASKML_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/MPLCMASKML/mplcmaskml.c1.ipynb b/VAPs/quicklook/MPLCMASKML/mplcmaskml.c1.ipynb index d4b51c76..a8cfa2bb 100644 --- a/VAPs/quicklook/MPLCMASKML/mplcmaskml.c1.ipynb +++ b/VAPs/quicklook/MPLCMASKML/mplcmaskml.c1.ipynb @@ -78,8 +78,8 @@ "source": [ "site_facility = ( 'sgp', 'C1' )\n", "\n", - "date_start = '2024-06-06'\n", - "date_end = '2024-06-08'" + "date_start = '2024-06-07'\n", + "date_end = '2024-06-09'" ] }, { @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'backscatter'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'backscatter'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MPLNOR/MPLNOR_tutorial.ipynb b/VAPs/quicklook/MPLNOR/MPLNOR_tutorial.ipynb index 4ae2fcaf..e99848b0 100644 --- a/VAPs/quicklook/MPLNOR/MPLNOR_tutorial.ipynb +++ b/VAPs/quicklook/MPLNOR/MPLNOR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/MPLNOR/mplnor1camp.c1.ipynb b/VAPs/quicklook/MPLNOR/mplnor1camp.c1.ipynb index ad7a33c5..f1257378 100644 --- a/VAPs/quicklook/MPLNOR/mplnor1camp.c1.ipynb +++ b/VAPs/quicklook/MPLNOR/mplnor1camp.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MWRRET/MWRRET_tutorial.ipynb b/VAPs/quicklook/MWRRET/MWRRET_tutorial.ipynb index 36ddad98..743107e4 100644 --- a/VAPs/quicklook/MWRRET/MWRRET_tutorial.ipynb +++ b/VAPs/quicklook/MWRRET/MWRRET_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/MWRRET/mwrret1liljclou.c1.ipynb b/VAPs/quicklook/MWRRET/mwrret1liljclou.c1.ipynb index 06140ffd..f82cad8f 100644 --- a/VAPs/quicklook/MWRRET/mwrret1liljclou.c1.ipynb +++ b/VAPs/quicklook/MWRRET/mwrret1liljclou.c1.ipynb @@ -78,8 +78,8 @@ "source": [ "site_facility = ( 'sgp', 'C1' )\n", "\n", - "date_start = '2024-06-05'\n", - "date_end = '2024-06-07'" + "date_start = '2024-06-06'\n", + "date_end = '2024-06-08'" ] }, { @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'be_pwv'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'be_pwv'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MWRRET/mwrret1liljclou.c2.ipynb b/VAPs/quicklook/MWRRET/mwrret1liljclou.c2.ipynb index e524dc45..9459c045 100644 --- a/VAPs/quicklook/MWRRET/mwrret1liljclou.c2.ipynb +++ b/VAPs/quicklook/MWRRET/mwrret1liljclou.c2.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'be_pwv'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'be_pwv'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/MWRRETV2/MWRRETV2_tutorial.ipynb b/VAPs/quicklook/MWRRETV2/MWRRETV2_tutorial.ipynb index f3afb6c2..aa0b86fb 100644 --- a/VAPs/quicklook/MWRRETV2/MWRRETV2_tutorial.ipynb +++ b/VAPs/quicklook/MWRRETV2/MWRRETV2_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/MWRRETV2/mwrret2turn.c1.ipynb b/VAPs/quicklook/MWRRETV2/mwrret2turn.c1.ipynb index a2c4a49a..2cfe338e 100644 --- a/VAPs/quicklook/MWRRETV2/mwrret2turn.c1.ipynb +++ b/VAPs/quicklook/MWRRETV2/mwrret2turn.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'phys_pwv'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'phys_pwv'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/NAVMET-AIR/NAVMET-AIR_tutorial.ipynb b/VAPs/quicklook/NAVMET-AIR/NAVMET-AIR_tutorial.ipynb index a5c985c5..befc03f8 100644 --- a/VAPs/quicklook/NAVMET-AIR/NAVMET-AIR_tutorial.ipynb +++ b/VAPs/quicklook/NAVMET-AIR/NAVMET-AIR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/NAVMET-AIR/aafnaviwg.c1.ipynb b/VAPs/quicklook/NAVMET-AIR/aafnaviwg.c1.ipynb index abd0b5de..fad83262 100644 --- a/VAPs/quicklook/NAVMET-AIR/aafnaviwg.c1.ipynb +++ b/VAPs/quicklook/NAVMET-AIR/aafnaviwg.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/NDROP/NDROP_tutorial.ipynb b/VAPs/quicklook/NDROP/NDROP_tutorial.ipynb index cca05d1c..8ec272f5 100644 --- a/VAPs/quicklook/NDROP/NDROP_tutorial.ipynb +++ b/VAPs/quicklook/NDROP/NDROP_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/NDROP/ndropmfrsr.c1.ipynb b/VAPs/quicklook/NDROP/ndropmfrsr.c1.ipynb index caf9312f..2d93f5c3 100644 --- a/VAPs/quicklook/NDROP/ndropmfrsr.c1.ipynb +++ b/VAPs/quicklook/NDROP/ndropmfrsr.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'optical_depth_instantaneous'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'optical_depth_instantaneous'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/NEPHELOMETER/NEPHELOMETER_tutorial.ipynb b/VAPs/quicklook/NEPHELOMETER/NEPHELOMETER_tutorial.ipynb index b2ceda03..97505fad 100644 --- a/VAPs/quicklook/NEPHELOMETER/NEPHELOMETER_tutorial.ipynb +++ b/VAPs/quicklook/NEPHELOMETER/NEPHELOMETER_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/NEPHELOMETER/aosnephdry.c1.ipynb b/VAPs/quicklook/NEPHELOMETER/aosnephdry.c1.ipynb index 65e2c966..a0078467 100644 --- a/VAPs/quicklook/NEPHELOMETER/aosnephdry.c1.ipynb +++ b/VAPs/quicklook/NEPHELOMETER/aosnephdry.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'Bs_B_Dry_Neph3W_1'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'Bs_B_Dry_Neph3W_1'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/NEPHELOMETER/aosnephwet.c1.ipynb b/VAPs/quicklook/NEPHELOMETER/aosnephwet.c1.ipynb index 9bfda13e..d41cd228 100644 --- a/VAPs/quicklook/NEPHELOMETER/aosnephwet.c1.ipynb +++ b/VAPs/quicklook/NEPHELOMETER/aosnephwet.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'Bs_B_Wet_Neph3W_2'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'Bs_B_Wet_Neph3W_2'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/NIMFR/NIMFR_tutorial.ipynb b/VAPs/quicklook/NIMFR/NIMFR_tutorial.ipynb index d1fcc1dc..2e7a8eaa 100644 --- a/VAPs/quicklook/NIMFR/NIMFR_tutorial.ipynb +++ b/VAPs/quicklook/NIMFR/NIMFR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/NIMFR/nimfr7nchlangley.c1.ipynb b/VAPs/quicklook/NIMFR/nimfr7nchlangley.c1.ipynb index 8ec65029..34de4bf9 100644 --- a/VAPs/quicklook/NIMFR/nimfr7nchlangley.c1.ipynb +++ b/VAPs/quicklook/NIMFR/nimfr7nchlangley.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/NIMFR/nimfr7nchlangplot.c1.ipynb b/VAPs/quicklook/NIMFR/nimfr7nchlangplot.c1.ipynb index ee3c8488..b8be3487 100644 --- a/VAPs/quicklook/NIMFR/nimfr7nchlangplot.c1.ipynb +++ b/VAPs/quicklook/NIMFR/nimfr7nchlangplot.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/OKMSOIL/OKMSOIL_tutorial.ipynb b/VAPs/quicklook/OKMSOIL/OKMSOIL_tutorial.ipynb index 4eaf6e94..135a865f 100644 --- a/VAPs/quicklook/OKMSOIL/OKMSOIL_tutorial.ipynb +++ b/VAPs/quicklook/OKMSOIL/OKMSOIL_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/OKMSOIL/okmsoil.c1.ipynb b/VAPs/quicklook/OKMSOIL/okmsoil.c1.ipynb index 120016dd..757bb29a 100644 --- a/VAPs/quicklook/OKMSOIL/okmsoil.c1.ipynb +++ b/VAPs/quicklook/OKMSOIL/okmsoil.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'sensor_temperature_rise'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'sensor_temperature_rise'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/OZONE-AIR/OZONE-AIR_tutorial.ipynb b/VAPs/quicklook/OZONE-AIR/OZONE-AIR_tutorial.ipynb index 93c0c7e2..a8d5555a 100644 --- a/VAPs/quicklook/OZONE-AIR/OZONE-AIR_tutorial.ipynb +++ b/VAPs/quicklook/OZONE-AIR/OZONE-AIR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/OZONE-AIR/aafo3.c1.ipynb b/VAPs/quicklook/OZONE-AIR/aafo3.c1.ipynb index 681b80cf..a76d20e1 100644 --- a/VAPs/quicklook/OZONE-AIR/aafo3.c1.ipynb +++ b/VAPs/quicklook/OZONE-AIR/aafo3.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/PBLHT/PBLHT_tutorial.ipynb b/VAPs/quicklook/PBLHT/PBLHT_tutorial.ipynb index 09baa9b0..e8ab933c 100644 --- a/VAPs/quicklook/PBLHT/PBLHT_tutorial.ipynb +++ b/VAPs/quicklook/PBLHT/PBLHT_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/PBLHT/pblhtsonde1mcfarl.c1.ipynb b/VAPs/quicklook/PBLHT/pblhtsonde1mcfarl.c1.ipynb index bf8e0d0f..a20aa0af 100644 --- a/VAPs/quicklook/PBLHT/pblhtsonde1mcfarl.c1.ipynb +++ b/VAPs/quicklook/PBLHT/pblhtsonde1mcfarl.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'pbl_height_heffter'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'pbl_height_heffter'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/PBLHT/pblhtsondeyr1mcfarl.c1.ipynb b/VAPs/quicklook/PBLHT/pblhtsondeyr1mcfarl.c1.ipynb index 7a7600db..7dbaa1e7 100644 --- a/VAPs/quicklook/PBLHT/pblhtsondeyr1mcfarl.c1.ipynb +++ b/VAPs/quicklook/PBLHT/pblhtsondeyr1mcfarl.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'pbl_height_heffter'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'pbl_height_heffter'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/PCCP/PCCP_tutorial.ipynb b/VAPs/quicklook/PCCP/PCCP_tutorial.ipynb index d5dcc57f..ba4c1201 100644 --- a/VAPs/quicklook/PCCP/PCCP_tutorial.ipynb +++ b/VAPs/quicklook/PCCP/PCCP_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -833,7 +835,7 @@ }, { "cell_type": "markdown", - "id": "fa3b9423", + "id": "40ce3116", "metadata": {}, "source": [ "## Point Cloud of Cloud of Points" @@ -842,7 +844,7 @@ { "cell_type": "code", "execution_count": null, - "id": "77feecd9", + "id": "2e3a9a2c", "metadata": {}, "outputs": [], "source": [ @@ -853,7 +855,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9fffa76c", + "id": "2a2b5e19", "metadata": {}, "outputs": [], "source": [ @@ -870,7 +872,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d543bea3", + "id": "75906384", "metadata": {}, "outputs": [], "source": [ @@ -886,7 +888,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a2d2ef16", + "id": "2b084a50", "metadata": {}, "outputs": [], "source": [ diff --git a/VAPs/quicklook/PCCP/pccp.c1.ipynb b/VAPs/quicklook/PCCP/pccp.c1.ipynb index 4eaa05b8..ab85d4ef 100644 --- a/VAPs/quicklook/PCCP/pccp.c1.ipynb +++ b/VAPs/quicklook/PCCP/pccp.c1.ipynb @@ -170,13 +170,13 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, { "cell_type": "markdown", - "id": "7ebbe9c4", + "id": "8c45d2f0", "metadata": {}, "source": [ "## Point Cloud of Cloud of Points" @@ -185,7 +185,7 @@ { "cell_type": "code", "execution_count": null, - "id": "14abe5fa", + "id": "62daef31", "metadata": {}, "outputs": [], "source": [ @@ -196,7 +196,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4e88cab2", + "id": "02c5c552", "metadata": {}, "outputs": [], "source": [ @@ -213,7 +213,7 @@ { "cell_type": "code", "execution_count": null, - "id": "69f70f60", + "id": "32db0f8a", "metadata": {}, "outputs": [], "source": [ @@ -229,7 +229,7 @@ { "cell_type": "code", "execution_count": null, - "id": "50ef3fda", + "id": "8c1cdeb7", "metadata": {}, "outputs": [], "source": [ diff --git a/VAPs/quicklook/PSAP/PSAP_tutorial.ipynb b/VAPs/quicklook/PSAP/PSAP_tutorial.ipynb index e1903e64..a6b04129 100644 --- a/VAPs/quicklook/PSAP/PSAP_tutorial.ipynb +++ b/VAPs/quicklook/PSAP/PSAP_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/PSAP/aospsap3w.c1.ipynb b/VAPs/quicklook/PSAP/aospsap3w.c1.ipynb index 2057e4cb..681af98c 100644 --- a/VAPs/quicklook/PSAP/aospsap3w.c1.ipynb +++ b/VAPs/quicklook/PSAP/aospsap3w.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'transmittance_blue'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'transmittance_blue'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/QCRAD/QCRAD_tutorial.ipynb b/VAPs/quicklook/QCRAD/QCRAD_tutorial.ipynb index 6ad3cb76..aa3913c6 100644 --- a/VAPs/quicklook/QCRAD/QCRAD_tutorial.ipynb +++ b/VAPs/quicklook/QCRAD/QCRAD_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/QCRAD/qcrad1long.c1.ipynb b/VAPs/quicklook/QCRAD/qcrad1long.c1.ipynb index 7e1d1a8f..83faf94d 100644 --- a/VAPs/quicklook/QCRAD/qcrad1long.c1.ipynb +++ b/VAPs/quicklook/QCRAD/qcrad1long.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'BestEstimate_down_short_hemisp'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'BestEstimate_down_short_hemisp'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/QCRAD/qcrad1long.c2.ipynb b/VAPs/quicklook/QCRAD/qcrad1long.c2.ipynb index c5dff5c9..a30db231 100644 --- a/VAPs/quicklook/QCRAD/qcrad1long.c2.ipynb +++ b/VAPs/quicklook/QCRAD/qcrad1long.c2.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'BestEstimate_down_short_hemisp'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'BestEstimate_down_short_hemisp'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/QCRAD/qcradbeflux1long.c1.ipynb b/VAPs/quicklook/QCRAD/qcradbeflux1long.c1.ipynb index 5267952d..12016aca 100644 --- a/VAPs/quicklook/QCRAD/qcradbeflux1long.c1.ipynb +++ b/VAPs/quicklook/QCRAD/qcradbeflux1long.c1.ipynb @@ -78,8 +78,8 @@ "source": [ "site_facility = ( 'sgp', 'C1' )\n", "\n", - "date_start = '2024-06-08'\n", - "date_end = '2024-06-10'" + "date_start = '2024-06-09'\n", + "date_end = '2024-06-11'" ] }, { @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'BestEstimate_down_short_hemisp'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'BestEstimate_down_short_hemisp'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/QCRAD/qcradbeflux1long.c2.ipynb b/VAPs/quicklook/QCRAD/qcradbeflux1long.c2.ipynb index 05cff103..5ab9e3e4 100644 --- a/VAPs/quicklook/QCRAD/qcradbeflux1long.c2.ipynb +++ b/VAPs/quicklook/QCRAD/qcradbeflux1long.c2.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'BestEstimate_down_short_hemisp'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'BestEstimate_down_short_hemisp'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/QCRAD/qcradbrs1long.c1.ipynb b/VAPs/quicklook/QCRAD/qcradbrs1long.c1.ipynb index 683f1390..0f50bda8 100644 --- a/VAPs/quicklook/QCRAD/qcradbrs1long.c1.ipynb +++ b/VAPs/quicklook/QCRAD/qcradbrs1long.c1.ipynb @@ -78,8 +78,8 @@ "source": [ "site_facility = ( 'sgp', 'C1' )\n", "\n", - "date_start = '2024-06-09'\n", - "date_end = '2024-06-11'" + "date_start = '2024-06-10'\n", + "date_end = '2024-06-12'" ] }, { @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'BestEstimate_down_short_hemisp'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'BestEstimate_down_short_hemisp'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/QCRAD/qcradbrs1long.c2.ipynb b/VAPs/quicklook/QCRAD/qcradbrs1long.c2.ipynb index 15d57c92..8bc57807 100644 --- a/VAPs/quicklook/QCRAD/qcradbrs1long.c2.ipynb +++ b/VAPs/quicklook/QCRAD/qcradbrs1long.c2.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'BestEstimate_down_short_hemisp'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'BestEstimate_down_short_hemisp'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/RADFLUXANAL/RADFLUXANAL_tutorial.ipynb b/VAPs/quicklook/RADFLUXANAL/RADFLUXANAL_tutorial.ipynb index 0a02d891..34c9bc0c 100644 --- a/VAPs/quicklook/RADFLUXANAL/RADFLUXANAL_tutorial.ipynb +++ b/VAPs/quicklook/RADFLUXANAL/RADFLUXANAL_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/RADFLUXANAL/radflux1long.c1.ipynb b/VAPs/quicklook/RADFLUXANAL/radflux1long.c1.ipynb index 92102ecf..34ce4300 100644 --- a/VAPs/quicklook/RADFLUXANAL/radflux1long.c1.ipynb +++ b/VAPs/quicklook/RADFLUXANAL/radflux1long.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'downwelling_shortwave'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'downwelling_shortwave'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/RADFLUXANAL/radflux1long.c2.ipynb b/VAPs/quicklook/RADFLUXANAL/radflux1long.c2.ipynb index 9b09d135..a502c78f 100644 --- a/VAPs/quicklook/RADFLUXANAL/radflux1long.c2.ipynb +++ b/VAPs/quicklook/RADFLUXANAL/radflux1long.c2.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'downwelling_shortwave'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'downwelling_shortwave'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/RADFLUXANAL/radfluxbrs1long.c2.ipynb b/VAPs/quicklook/RADFLUXANAL/radfluxbrs1long.c2.ipynb index c340bff3..263ecc2a 100644 --- a/VAPs/quicklook/RADFLUXANAL/radfluxbrs1long.c2.ipynb +++ b/VAPs/quicklook/RADFLUXANAL/radfluxbrs1long.c2.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'downwelling_shortwave'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'downwelling_shortwave'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/RIPBE/30ripbe1mcfarlane.c1.ipynb b/VAPs/quicklook/RIPBE/30ripbe1mcfarlane.c1.ipynb index 5a134c34..c4bb8789 100644 --- a/VAPs/quicklook/RIPBE/30ripbe1mcfarlane.c1.ipynb +++ b/VAPs/quicklook/RIPBE/30ripbe1mcfarlane.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'clear_sky_frac'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'clear_sky_frac'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/RIPBE/RIPBE_tutorial.ipynb b/VAPs/quicklook/RIPBE/RIPBE_tutorial.ipynb index a8754755..8cf769f3 100644 --- a/VAPs/quicklook/RIPBE/RIPBE_tutorial.ipynb +++ b/VAPs/quicklook/RIPBE/RIPBE_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/RIPBE/ripbe1mcfarlane.c1.ipynb b/VAPs/quicklook/RIPBE/ripbe1mcfarlane.c1.ipynb index 4541d00d..daf8a12e 100644 --- a/VAPs/quicklook/RIPBE/ripbe1mcfarlane.c1.ipynb +++ b/VAPs/quicklook/RIPBE/ripbe1mcfarlane.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'clear_sky_flag'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'clear_sky_flag'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/RLPROF/10rlprofbe1news.c1.ipynb b/VAPs/quicklook/RLPROF/10rlprofbe1news.c1.ipynb index ab07dc26..270c9157 100644 --- a/VAPs/quicklook/RLPROF/10rlprofbe1news.c1.ipynb +++ b/VAPs/quicklook/RLPROF/10rlprofbe1news.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'asr'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'asr'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/RLPROF/RLPROF_tutorial.ipynb b/VAPs/quicklook/RLPROF/RLPROF_tutorial.ipynb index 0b821760..6b6c1d13 100644 --- a/VAPs/quicklook/RLPROF/RLPROF_tutorial.ipynb +++ b/VAPs/quicklook/RLPROF/RLPROF_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/SACRADV3D3C/SACRADV3D3C_tutorial.ipynb b/VAPs/quicklook/SACRADV3D3C/SACRADV3D3C_tutorial.ipynb index e1314fa9..babb27d7 100644 --- a/VAPs/quicklook/SACRADV3D3C/SACRADV3D3C_tutorial.ipynb +++ b/VAPs/quicklook/SACRADV3D3C/SACRADV3D3C_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/SACRADV3D3C/kasacradv3d3c.c1.ipynb b/VAPs/quicklook/SACRADV3D3C/kasacradv3d3c.c1.ipynb index ef767f0c..389ff154 100644 --- a/VAPs/quicklook/SACRADV3D3C/kasacradv3d3c.c1.ipynb +++ b/VAPs/quicklook/SACRADV3D3C/kasacradv3d3c.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/SACRADVVAD/SACRADVVAD_tutorial.ipynb b/VAPs/quicklook/SACRADVVAD/SACRADVVAD_tutorial.ipynb index 0e4c7658..1c707f2c 100644 --- a/VAPs/quicklook/SACRADVVAD/SACRADVVAD_tutorial.ipynb +++ b/VAPs/quicklook/SACRADVVAD/SACRADVVAD_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/SACRADVVAD/kasacradvvad.c1.ipynb b/VAPs/quicklook/SACRADVVAD/kasacradvvad.c1.ipynb index 1b5f2f43..3427a3d8 100644 --- a/VAPs/quicklook/SACRADVVAD/kasacradvvad.c1.ipynb +++ b/VAPs/quicklook/SACRADVVAD/kasacradvvad.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/SFCCLDGRID/15swfcldgrid1long.c1.ipynb b/VAPs/quicklook/SFCCLDGRID/15swfcldgrid1long.c1.ipynb index 99a1d888..8d2b118c 100644 --- a/VAPs/quicklook/SFCCLDGRID/15swfcldgrid1long.c1.ipynb +++ b/VAPs/quicklook/SFCCLDGRID/15swfcldgrid1long.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'cloudfraction'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'cloudfraction'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/SFCCLDGRID/SFCCLDGRID_tutorial.ipynb b/VAPs/quicklook/SFCCLDGRID/SFCCLDGRID_tutorial.ipynb index 29da62c7..82174c86 100644 --- a/VAPs/quicklook/SFCCLDGRID/SFCCLDGRID_tutorial.ipynb +++ b/VAPs/quicklook/SFCCLDGRID/SFCCLDGRID_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/SFCCLDGRID/sfccldgrid2longcaracena.c1.ipynb b/VAPs/quicklook/SFCCLDGRID/sfccldgrid2longcaracena.c1.ipynb index 45f5cf30..055bd629 100644 --- a/VAPs/quicklook/SFCCLDGRID/sfccldgrid2longcaracena.c1.ipynb +++ b/VAPs/quicklook/SFCCLDGRID/sfccldgrid2longcaracena.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'downwelling_shortwave'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'downwelling_shortwave'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/SFCCLDGRID/sfccldgrid2longstation.c1.ipynb b/VAPs/quicklook/SFCCLDGRID/sfccldgrid2longstation.c1.ipynb index 08978c48..5f29aad5 100644 --- a/VAPs/quicklook/SFCCLDGRID/sfccldgrid2longstation.c1.ipynb +++ b/VAPs/quicklook/SFCCLDGRID/sfccldgrid2longstation.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'swdn'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'swdn'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/SHALLOWCUMULUS/SHALLOWCUMULUS_tutorial.ipynb b/VAPs/quicklook/SHALLOWCUMULUS/SHALLOWCUMULUS_tutorial.ipynb index 2ae30103..6bf2d145 100644 --- a/VAPs/quicklook/SHALLOWCUMULUS/SHALLOWCUMULUS_tutorial.ipynb +++ b/VAPs/quicklook/SHALLOWCUMULUS/SHALLOWCUMULUS_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/SHALLOWCUMULUS/shallowcumulus.c1.ipynb b/VAPs/quicklook/SHALLOWCUMULUS/shallowcumulus.c1.ipynb index fd1603e5..71021a4d 100644 --- a/VAPs/quicklook/SHALLOWCUMULUS/shallowcumulus.c1.ipynb +++ b/VAPs/quicklook/SHALLOWCUMULUS/shallowcumulus.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/SHALLOWCUMULUS/shcusummary.c1.ipynb b/VAPs/quicklook/SHALLOWCUMULUS/shcusummary.c1.ipynb index d26c9f2e..13fd5314 100644 --- a/VAPs/quicklook/SHALLOWCUMULUS/shcusummary.c1.ipynb +++ b/VAPs/quicklook/SHALLOWCUMULUS/shcusummary.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/SO2-AIR/SO2-AIR_tutorial.ipynb b/VAPs/quicklook/SO2-AIR/SO2-AIR_tutorial.ipynb index ca72202b..22f7af92 100644 --- a/VAPs/quicklook/SO2-AIR/SO2-AIR_tutorial.ipynb +++ b/VAPs/quicklook/SO2-AIR/SO2-AIR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/SO2-AIR/aafso2.c1.ipynb b/VAPs/quicklook/SO2-AIR/aafso2.c1.ipynb index 9e6d741a..6e06130d 100644 --- a/VAPs/quicklook/SO2-AIR/aafso2.c1.ipynb +++ b/VAPs/quicklook/SO2-AIR/aafso2.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/SONDEADJUST/SONDEADJUST_tutorial.ipynb b/VAPs/quicklook/SONDEADJUST/SONDEADJUST_tutorial.ipynb index 5b6118e3..7d989798 100644 --- a/VAPs/quicklook/SONDEADJUST/SONDEADJUST_tutorial.ipynb +++ b/VAPs/quicklook/SONDEADJUST/SONDEADJUST_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -833,7 +835,7 @@ }, { "cell_type": "markdown", - "id": "8c0d31db", + "id": "ba109712", "metadata": {}, "source": [ "## Skew-T Plot" @@ -842,7 +844,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ca1a1723", + "id": "faa48021", "metadata": {}, "outputs": [], "source": [ @@ -854,7 +856,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3a59a15c", + "id": "bf500c18", "metadata": {}, "outputs": [], "source": [ diff --git a/VAPs/quicklook/SONDEADJUST/sondeadjust.c1.ipynb b/VAPs/quicklook/SONDEADJUST/sondeadjust.c1.ipynb index 97da7b6c..eb9a4d0d 100644 --- a/VAPs/quicklook/SONDEADJUST/sondeadjust.c1.ipynb +++ b/VAPs/quicklook/SONDEADJUST/sondeadjust.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,linestyle='None')\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'pres'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,linestyle='None')\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'pres'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { @@ -326,7 +345,7 @@ }, { "cell_type": "markdown", - "id": "e2c73ffe", + "id": "88e1347d", "metadata": {}, "source": [ "## Skew-T Plot" @@ -335,7 +354,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6a315bc0", + "id": "d33e7044", "metadata": {}, "outputs": [], "source": [ @@ -347,7 +366,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5ebe7bba", + "id": "25b1e079", "metadata": {}, "outputs": [], "source": [ diff --git a/VAPs/quicklook/SONDEPARAM/SONDEPARAM_tutorial.ipynb b/VAPs/quicklook/SONDEPARAM/SONDEPARAM_tutorial.ipynb index 5ebb1f0e..a79aa4e6 100644 --- a/VAPs/quicklook/SONDEPARAM/SONDEPARAM_tutorial.ipynb +++ b/VAPs/quicklook/SONDEPARAM/SONDEPARAM_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/SONDEPARAM/sondeparam.c1.ipynb b/VAPs/quicklook/SONDEPARAM/sondeparam.c1.ipynb index 217f5ab6..aecc6b74 100644 --- a/VAPs/quicklook/SONDEPARAM/sondeparam.c1.ipynb +++ b/VAPs/quicklook/SONDEPARAM/sondeparam.c1.ipynb @@ -78,8 +78,8 @@ "source": [ "site_facility = ( 'sgp', 'C1' )\n", "\n", - "date_start = '2024-06-09'\n", - "date_end = '2024-06-11'" + "date_start = '2024-06-10'\n", + "date_end = '2024-06-12'" ] }, { @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/SP2-AIR/SP2-AIR_tutorial.ipynb b/VAPs/quicklook/SP2-AIR/SP2-AIR_tutorial.ipynb index 2b4c1833..f9271be7 100644 --- a/VAPs/quicklook/SP2-AIR/SP2-AIR_tutorial.ipynb +++ b/VAPs/quicklook/SP2-AIR/SP2-AIR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/SP2-AIR/aafsp2rbc10s.c1.ipynb b/VAPs/quicklook/SP2-AIR/aafsp2rbc10s.c1.ipynb index d7b4dfc9..9341cf9c 100644 --- a/VAPs/quicklook/SP2-AIR/aafsp2rbc10s.c1.ipynb +++ b/VAPs/quicklook/SP2-AIR/aafsp2rbc10s.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'rBC'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'rBC'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/SPHOTCOD/SPHOTCOD_tutorial.ipynb b/VAPs/quicklook/SPHOTCOD/SPHOTCOD_tutorial.ipynb index 2a2b1519..b80f9d26 100644 --- a/VAPs/quicklook/SPHOTCOD/SPHOTCOD_tutorial.ipynb +++ b/VAPs/quicklook/SPHOTCOD/SPHOTCOD_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/SPHOTCOD/sphotcod2chiu.c1.ipynb b/VAPs/quicklook/SPHOTCOD/sphotcod2chiu.c1.ipynb index 2801c8d6..bcc743de 100644 --- a/VAPs/quicklook/SPHOTCOD/sphotcod2chiu.c1.ipynb +++ b/VAPs/quicklook/SPHOTCOD/sphotcod2chiu.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/SURFSPECALB/SURFSPECALB_tutorial.ipynb b/VAPs/quicklook/SURFSPECALB/SURFSPECALB_tutorial.ipynb index e0ec3e8b..f3ff012c 100644 --- a/VAPs/quicklook/SURFSPECALB/SURFSPECALB_tutorial.ipynb +++ b/VAPs/quicklook/SURFSPECALB/SURFSPECALB_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/SURFSPECALB/surfspecalb1mlawer.c1.ipynb b/VAPs/quicklook/SURFSPECALB/surfspecalb1mlawer.c1.ipynb index 981e41d0..a912949b 100644 --- a/VAPs/quicklook/SURFSPECALB/surfspecalb1mlawer.c1.ipynb +++ b/VAPs/quicklook/SURFSPECALB/surfspecalb1mlawer.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,force_line_plot=True)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'hemisp_broadband_mfrsrC1'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,force_line_plot=True)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'hemisp_broadband_mfrsrC1'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/SURFSPECALB/surfspecalb7nch1mlawer.c1.ipynb b/VAPs/quicklook/SURFSPECALB/surfspecalb7nch1mlawer.c1.ipynb index f739cccb..4152253d 100644 --- a/VAPs/quicklook/SURFSPECALB/surfspecalb7nch1mlawer.c1.ipynb +++ b/VAPs/quicklook/SURFSPECALB/surfspecalb7nch1mlawer.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'hemisp_narrowband_mfrsrC1'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'hemisp_narrowband_mfrsrC1'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/TBSMERGED/TBSMERGED_tutorial.ipynb b/VAPs/quicklook/TBSMERGED/TBSMERGED_tutorial.ipynb index bc62fa23..989b656c 100644 --- a/VAPs/quicklook/TBSMERGED/TBSMERGED_tutorial.ipynb +++ b/VAPs/quicklook/TBSMERGED/TBSMERGED_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/TBSMERGED/tbsmerged.c1.ipynb b/VAPs/quicklook/TBSMERGED/tbsmerged.c1.ipynb index fa338c55..2d530e16 100644 --- a/VAPs/quicklook/TBSMERGED/tbsmerged.c1.ipynb +++ b/VAPs/quicklook/TBSMERGED/tbsmerged.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'tbscpc_total_concentration'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'tbscpc_total_concentration'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/TBSMERGED/tbsmergedincloud.c1.ipynb b/VAPs/quicklook/TBSMERGED/tbsmergedincloud.c1.ipynb index e3dc7f05..7bdd250f 100644 --- a/VAPs/quicklook/TBSMERGED/tbsmergedincloud.c1.ipynb +++ b/VAPs/quicklook/TBSMERGED/tbsmergedincloud.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'bl_height_1'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'bl_height_1'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/TDMA/TDMA_tutorial.ipynb b/VAPs/quicklook/TDMA/TDMA_tutorial.ipynb index ec998bbb..81719860 100644 --- a/VAPs/quicklook/TDMA/TDMA_tutorial.ipynb +++ b/VAPs/quicklook/TDMA/TDMA_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/TDMA/tdmaapssize.c1.ipynb b/VAPs/quicklook/TDMA/tdmaapssize.c1.ipynb index e869014a..3e402425 100644 --- a/VAPs/quicklook/TDMA/tdmaapssize.c1.ipynb +++ b/VAPs/quicklook/TDMA/tdmaapssize.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'number_concentration_DMA_APS'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'number_concentration_DMA_APS'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/TWRMR/1twrmr.c1.ipynb b/VAPs/quicklook/TWRMR/1twrmr.c1.ipynb index af589522..1240e56f 100644 --- a/VAPs/quicklook/TWRMR/1twrmr.c1.ipynb +++ b/VAPs/quicklook/TWRMR/1twrmr.c1.ipynb @@ -78,8 +78,8 @@ "source": [ "site_facility = ( 'sgp', 'C1' )\n", "\n", - "date_start = '2024-06-08'\n", - "date_end = '2024-06-10'" + "date_start = '2024-06-09'\n", + "date_end = '2024-06-11'" ] }, { @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'pres_02m'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'pres_02m'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/TWRMR/30twrmr.c1.ipynb b/VAPs/quicklook/TWRMR/30twrmr.c1.ipynb index c7f1ae56..a002c392 100644 --- a/VAPs/quicklook/TWRMR/30twrmr.c1.ipynb +++ b/VAPs/quicklook/TWRMR/30twrmr.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/TWRMR/TWRMR_tutorial.ipynb b/VAPs/quicklook/TWRMR/TWRMR_tutorial.ipynb index c2543711..b3970950 100644 --- a/VAPs/quicklook/TWRMR/TWRMR_tutorial.ipynb +++ b/VAPs/quicklook/TWRMR/TWRMR_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/VARANAL/180varanaecmwf.c1.ipynb b/VAPs/quicklook/VARANAL/180varanaecmwf.c1.ipynb index 37e40b9e..f9491fd0 100644 --- a/VAPs/quicklook/VARANAL/180varanaecmwf.c1.ipynb +++ b/VAPs/quicklook/VARANAL/180varanaecmwf.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/VARANAL/180varanamerra001.c1.ipynb b/VAPs/quicklook/VARANAL/180varanamerra001.c1.ipynb index 7867f10a..9f5b1dba 100644 --- a/VAPs/quicklook/VARANAL/180varanamerra001.c1.ipynb +++ b/VAPs/quicklook/VARANAL/180varanamerra001.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/VARANAL/VARANAL_tutorial.ipynb b/VAPs/quicklook/VARANAL/VARANAL_tutorial.ipynb index ae7a5050..79cbe8d4 100644 --- a/VAPs/quicklook/VARANAL/VARANAL_tutorial.ipynb +++ b/VAPs/quicklook/VARANAL/VARANAL_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/VARANAL3D/180varanal3dera5.c1.ipynb b/VAPs/quicklook/VARANAL3D/180varanal3dera5.c1.ipynb index c690f5fd..5f02850f 100644 --- a/VAPs/quicklook/VARANAL3D/180varanal3dera5.c1.ipynb +++ b/VAPs/quicklook/VARANAL3D/180varanal3dera5.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/VARANAL3D/180varanal3dncep.c1.ipynb b/VAPs/quicklook/VARANAL3D/180varanal3dncep.c1.ipynb index b991b59e..339445d0 100644 --- a/VAPs/quicklook/VARANAL3D/180varanal3dncep.c1.ipynb +++ b/VAPs/quicklook/VARANAL3D/180varanal3dncep.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/VARANAL3D/VARANAL3D_tutorial.ipynb b/VAPs/quicklook/VARANAL3D/VARANAL3D_tutorial.ipynb index b06d9c8e..a4829393 100644 --- a/VAPs/quicklook/VARANAL3D/VARANAL3D_tutorial.ipynb +++ b/VAPs/quicklook/VARANAL3D/VARANAL3D_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/VDISQUANTS/VDISQUANTS_tutorial.ipynb b/VAPs/quicklook/VDISQUANTS/VDISQUANTS_tutorial.ipynb index eb03a471..d8be6ccc 100644 --- a/VAPs/quicklook/VDISQUANTS/VDISQUANTS_tutorial.ipynb +++ b/VAPs/quicklook/VDISQUANTS/VDISQUANTS_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/VDISQUANTS/vdisquants.c1.ipynb b/VAPs/quicklook/VDISQUANTS/vdisquants.c1.ipynb index 642a789f..c37812be 100644 --- a/VAPs/quicklook/VDISQUANTS/vdisquants.c1.ipynb +++ b/VAPs/quicklook/VDISQUANTS/vdisquants.c1.ipynb @@ -78,8 +78,8 @@ "source": [ "site_facility = ( 'sgp', 'C1' )\n", "\n", - "date_start = '2024-06-07'\n", - "date_end = '2024-06-09'" + "date_start = '2024-06-08'\n", + "date_end = '2024-06-10'" ] }, { @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'None'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'None'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/WACRARSCL/WACRARSCL_tutorial.ipynb b/VAPs/quicklook/WACRARSCL/WACRARSCL_tutorial.ipynb index c12b57bf..a5825075 100644 --- a/VAPs/quicklook/WACRARSCL/WACRARSCL_tutorial.ipynb +++ b/VAPs/quicklook/WACRARSCL/WACRARSCL_tutorial.ipynb @@ -510,7 +510,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", diff --git a/VAPs/quicklook/WACRARSCL/arsclwacr1kollias.c1.ipynb b/VAPs/quicklook/WACRARSCL/arsclwacr1kollias.c1.ipynb index 49b417f3..fcd94766 100644 --- a/VAPs/quicklook/WACRARSCL/arsclwacr1kollias.c1.ipynb +++ b/VAPs/quicklook/WACRARSCL/arsclwacr1kollias.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'radar_first_top'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'radar_first_top'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, { diff --git a/VAPs/quicklook/WACRARSCL/arsclwacrbnd1kollias.c1.ipynb b/VAPs/quicklook/WACRARSCL/arsclwacrbnd1kollias.c1.ipynb index 8004d724..c36b2bf5 100644 --- a/VAPs/quicklook/WACRARSCL/arsclwacrbnd1kollias.c1.ipynb +++ b/VAPs/quicklook/WACRARSCL/arsclwacrbnd1kollias.c1.ipynb @@ -170,7 +170,7 @@ "\n", "# ds = xr.open_mfdataset(files_list) # open multiple netCDF files and merge as on dataset. (not always work)\n", "ds = xr.open_dataset(files_list[0]) # open the first file for analysis\n", - "\n", + "ds.clean.cleanup() # note: ARM's QC does not work directly with the internal logic. The ARM QC needs to be converted to CF QC before the QC will work.\n", "ds\n" ] }, @@ -190,7 +190,9 @@ " # if dim_name in [\"time\", \"bound\"]:\n", " # continue\n", " dim = ds[dim_name].values\n", - " if not any(np.isinf(dim)):\n", + " if not np.issubdtype(ds[dim_name].values.dtype, np.number): # only works for numerical dtype\n", + " continue\n", + " if not any(np.isinf(dim)): # skip if there is no inf value\n", " continue\n", " dim_replaced = np.where(np.isinf(dim), np.nanmax(dim[np.isfinite(dim)]) * 1.1, dim)\n", " ds[dim_name] = ((dim_name,), dim_replaced)\n", @@ -246,6 +248,18 @@ "#### Define variable for QC plot" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "21c39b16", + "metadata": {}, + "outputs": [], + "source": [ + "# existing qc variables\n", + "qc_variables = [var for var in list(ds.variables) if \"qc_\" in var]\n", + "qc_variables" + ] + }, { "cell_type": "code", "execution_count": null, @@ -253,20 +267,25 @@ "metadata": {}, "outputs": [], "source": [ - "# # QC Plot (Not guarantee to work)\n", + "# QC Plot \n", + "def qc_plot_example(ds, qc_variable):\n", + " # Plot\n", + " qc_display = act.plotting.TimeSeriesDisplay(ds)\n", + " qc_display.add_subplots((2,), figsize = (9.5,10))\n", + " qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", + " qc_ax.grid()\n", + " qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", "\n", - "# qc_variable = 'radar_first_top'\n", + " plt.show()\n", "\n", - "# ('qc_'+qc_variable) in ds.variables:\n", "\n", - "# # Plot\n", - "# qc_display = act.plotting.TimeSeriesDisplay(ds)\n", - "# qc_display.add_subplots((2,), figsize = (9.5,10))\n", - "# qc_ax = qc_display.plot(qc_variable, subplot_index=(0,), set_title=\"QC results on field: \" + qc_variable,)\n", - "# qc_ax.grid()\n", - "# qc_display.qc_flag_block_plot(qc_variable, subplot_index=(1,))\n", + "qc_variable = 'radar_first_top'\n", "\n", - "# plt.show()" + "if qc_variable:\n", + " try:\n", + " qc_plot_example(ds=ds, qc_variable=qc_variable)\n", + " except Exception as e:\n", + " print(e)" ] }, {