Skip to content

Commit

Permalink
update example notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfromearth committed Dec 12, 2024
1 parent 9329309 commit fa7172b
Showing 1 changed file with 46 additions and 30 deletions.
76 changes: 46 additions & 30 deletions docs/example/ncompare-example-usage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,19 @@
"cell_type": "code",
"execution_count": 1,
"id": "07e397b3-4964-4a90-b7f5-ae35185f86e5",
"metadata": {},
"metadata": {
"jupyter": {
"is_executing": true
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"usage: ncompare [-h] [-v COMPARISON_VAR_NAME] [-g COMPARISON_VAR_GROUP]\n",
" [--only-diffs] [--file-text FILE_TEXT] [--file-csv FILE_CSV]\n",
" [--file-xlsx FILE_XLSX] [--no-color] [--show-attributes]\n",
" [--show-chunks]\n",
"usage: ncompare [-h] [--only-diffs] [--file-text FILE_TEXT]\n",
" [--file-csv FILE_CSV] [--file-xlsx FILE_XLSX] [--no-color]\n",
" [--show-attributes] [--show-chunks]\n",
" [--column-widths COLUMN_WIDTHS COLUMN_WIDTHS COLUMN_WIDTHS]\n",
" [--version]\n",
" nc_a nc_b\n",
Expand All @@ -59,14 +62,10 @@
"\n",
"positional arguments:\n",
" nc_a First NetCDF file\n",
" nc_b First NetCDF file\n",
" nc_b Second NetCDF file\n",
"\n",
"options:\n",
" -h, --help show this help message and exit\n",
" -v COMPARISON_VAR_NAME, --comparison_var_name COMPARISON_VAR_NAME\n",
" Comparison variable name\n",
" -g COMPARISON_VAR_GROUP, --comparison_var_group COMPARISON_VAR_GROUP\n",
" Comparison variable group\n",
" --only-diffs Only display variables and attributes that are\n",
" different\n",
" --file-text FILE_TEXT\n",
Expand All @@ -75,7 +74,7 @@
" output will be written.\n",
" --file-xlsx FILE_XLSX\n",
" An Excel file to which the output will be written.\n",
" --no-color Turn off all colorized output\n",
" Turn off all colorized output\n",
" --show-attributes Include variable attributes in comparison\n",
" --show-chunks Include chunk sizes in the table that compares\n",
" variables\n",
Expand Down Expand Up @@ -190,8 +189,6 @@
"\u001b[0m\u001b[37m\u001b[0m\u001b[94m\n",
"Root-level Groups:\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\t\u001b[36mAre all items the same? ---> True. (No items exist.)\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\u001b[90m\n",
"No variable group selected for comparison. Skipping..\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\u001b[94m\n",
"All variables:\u001b[0m\n",
"\u001b[0m File A File B\u001b[0m\n",
Expand Down Expand Up @@ -226,8 +223,13 @@
"\u001b[0m dtype: float32 float32\u001b[0m\n",
"\u001b[0m shape: (1, 2) (1, 2)\u001b[0m\n",
"\u001b[0m - -------------------------- --------------------------\u001b[0m\n",
"\u001b[0m Total number of shared items: 8 8\u001b[0m\n",
"\u001b[0m Total number of non-shared items: 0 0\u001b[0m\n",
"\u001b[0m SUMMARY -------------------------- --------------------------\u001b[0m\n",
"\u001b[0m Total # of shared variables: 8 8\u001b[0m\n",
"\u001b[0m Total # of non-shared variables: 0 0\u001b[0m\n",
"\u001b[0m Total # of shared groups: 0 0\u001b[0m\n",
"\u001b[0m Total # of non-shared groups: 0 0\u001b[0m\n",
"\u001b[0m Total # of shared attributes: 16 16\u001b[0m\n",
"\u001b[0m Total # of non-shared attributes: 0 0\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\n",
"Done.\u001b[0m\n",
"\u001b[0m\u001b[0m"
Expand Down Expand Up @@ -261,8 +263,8 @@
"\u001b[0m\u001b[37m\u001b[0mFile B: PERSIANN-CDR_v01r01_20230419_c20231030.nc\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\u001b[94m\n",
"Root-level Dimensions:\u001b[0m\n",
"/usr/local/Caskroom/miniconda/base/envs/ncompare-jupyter-example/lib/python3.12/site-packages/xarray/conventions.py:428: SerializationWarning: variable 'precipitation' has multiple fill values {-9999.0, -1.0}, decoding all values to NaN.\n",
" new_vars[k] = decode_cf_variable(\n",
"/opt/homebrew/Caskroom/miniconda/base/envs/temp_for_ncompare_test/lib/python3.12/site-packages/xarray/conventions.py:286: SerializationWarning: variable 'precipitation' has multiple fill values {-9999.0, -1.0} defined, decoding all values to NaN.\n",
" var = coder.decode(var, name=name)\n",
"\u001b[0m\u001b[37m\u001b[0m\tAre all items the same? ---> \u001b[31mFalse. (2 items are shared, out of 6 total.)\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\t\u001b[31mWhich items are different?\u001b[0m\n",
"\u001b[0m File A File B\u001b[0m\n",
Expand All @@ -276,8 +278,6 @@
"\u001b[0m\u001b[37m\u001b[0m\u001b[94m\n",
"Root-level Groups:\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\t\u001b[36mAre all items the same? ---> True. (No items exist.)\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\u001b[90m\n",
"No variable group selected for comparison. Skipping..\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\u001b[94m\n",
"All variables:\u001b[0m\n",
"\u001b[0m File A File B\u001b[0m\n",
Expand Down Expand Up @@ -327,8 +327,17 @@
"\u001b[0m\u001b[37m\u001b[0m \u001b[31mdtype: float32 \u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m \u001b[31mshape: (1, 2) \u001b[0m\n",
"\u001b[0m - ------------------------------ ------------------------------\u001b[0m\n",
"\u001b[0m Total number of shared items: 1 1\u001b[0m\n",
"\u001b[0m Total number of non-shared items: 7 5\u001b[0m\n",
"\u001b[0m SUMMARY ------------------------------ ------------------------------\u001b[0m\n",
"\u001b[0m Total # of shared variables: 1 1\u001b[0m\n",
"\u001b[0m Total # of non-shared variables: 7 5\u001b[0m\n",
"\u001b[0m Total # of shared groups: 0 0\u001b[0m\n",
"\u001b[0m Total # of non-shared groups: 0 0\u001b[0m\n",
"\u001b[0m Total # of shared attributes: 1 1\u001b[0m\n",
"\u001b[0m Total # of non-shared attributes: 15 11\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\u001b[94m\n",
"Differences were found in these attributes:\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\u001b[94m\n",
"['dtype', 'shape']\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\n",
"Done.\u001b[0m\n",
"\u001b[0m\u001b[0m\u001b[0m"
Expand Down Expand Up @@ -361,8 +370,8 @@
"\u001b[0m\u001b[37m\u001b[0mFile B: PERSIANN-CDR_v01r01_20230419_c20231030.nc\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\u001b[94m\n",
"Root-level Dimensions:\u001b[0m\n",
"/usr/local/Caskroom/miniconda/base/envs/ncompare-jupyter-example/lib/python3.12/site-packages/xarray/conventions.py:428: SerializationWarning: variable 'precipitation' has multiple fill values {-9999.0, -1.0}, decoding all values to NaN.\n",
" new_vars[k] = decode_cf_variable(\n",
"/opt/homebrew/Caskroom/miniconda/base/envs/temp_for_ncompare_test/lib/python3.12/site-packages/xarray/conventions.py:286: SerializationWarning: variable 'precipitation' has multiple fill values {-9999.0, -1.0} defined, decoding all values to NaN.\n",
" var = coder.decode(var, name=name)\n",
"\u001b[0m\u001b[37m\u001b[0m\tAre all items the same? ---> \u001b[31mFalse. (2 items are shared, out of 6 total.)\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\t\u001b[31mWhich items are different?\u001b[0m\n",
"\u001b[0m File A File B\u001b[0m\n",
Expand All @@ -376,8 +385,6 @@
"\u001b[0m\u001b[37m\u001b[0m\u001b[94m\n",
"Root-level Groups:\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\t\u001b[36mAre all items the same? ---> True. (No items exist.)\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\u001b[90m\n",
"No variable group selected for comparison. Skipping..\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\u001b[94m\n",
"All variables:\u001b[0m\n",
"\u001b[0m File A File B\u001b[0m\n",
Expand Down Expand Up @@ -493,8 +500,17 @@
"\u001b[0m\u001b[37m\u001b[0m \u001b[31mchunksize: contiguous \u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m \u001b[31mcomment: time bounds for each time value \u001b[0m\n",
"\u001b[0m - ------------------------------ ------------------------------\u001b[0m\n",
"\u001b[0m Total number of shared items: 1 1\u001b[0m\n",
"\u001b[0m Total number of non-shared items: 7 5\u001b[0m\n",
"\u001b[0m SUMMARY ------------------------------ ------------------------------\u001b[0m\n",
"\u001b[0m Total # of shared variables: 1 1\u001b[0m\n",
"\u001b[0m Total # of non-shared variables: 7 5\u001b[0m\n",
"\u001b[0m Total # of shared groups: 0 0\u001b[0m\n",
"\u001b[0m Total # of non-shared groups: 0 0\u001b[0m\n",
"\u001b[0m Total # of shared attributes: 4 4\u001b[0m\n",
"\u001b[0m Total # of non-shared attributes: 53 37\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\u001b[94m\n",
"Differences were found in these attributes:\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\u001b[94m\n",
"['_FillValue', 'axis', 'bounds', 'calendar', 'cell_method', 'cell_methods', 'chunksize', 'comment', 'coordinates', 'dtype', 'long_name', 'missing_value', 'shape', 'standard_name', 'units', 'valid_max', 'valid_min', 'valid_range']\u001b[0m\n",
"\u001b[0m\u001b[37m\u001b[0m\n",
"Done.\u001b[0m\n",
"\u001b[0m\u001b[0m\u001b[0m"
Expand All @@ -516,9 +532,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "ncompare-jupyter-example",
"display_name": "temp_for_ncompare_test",
"language": "python",
"name": "ncompare-jupyter-example"
"name": "temp_for_ncompare_test"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -530,7 +546,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.12.3"
}
},
"nbformat": 4,
Expand Down

0 comments on commit fa7172b

Please sign in to comment.