Skip to content

Commit 6a67e9d

Browse files
authored
Merge branch 'main' into main
2 parents fe4d12a + f1a2eaa commit 6a67e9d

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,3 @@ Fienen MN, Hughes, JD, Langevin, CL, Larsen, JD, and Leaf, AT. 2024.
1818
python-for-hydrology
1919
U.S. Geological Survey software release. Reston, VA.
2020
https://doi.org/10.5066/P1QTRYJY
21-
22-
23-
_For USGS internal use, this is related to IP-162677._

notebooks/part0_python_intro/11_xarray_mt_rainier_precip.ipynb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@
589589
"outputs": [],
590590
"source": [
591591
"# make an output folder first\n",
592-
"output_folder = Path('11-0output')\n",
592+
"output_folder = Path('11-output')\n",
593593
"output_folder.mkdir(exist_ok=True)\n",
594594
"\n",
595595
"encoding={'prcp': {'zlib': True, # compression algorithm\n",
@@ -966,7 +966,9 @@
966966
"source": [
967967
"### Write an xarray dataset to a raster\n",
968968
"\n",
969-
"Write part of the dataset out to a GeoTIFF. Note that rioxarray requires us to remove the `'grid_mapping'` attribute first (at least in version 0.15, you will get an error otherwise). `grid_mapping` is a variable from the original NetCDF dataset that specifies that coordinate reference information is contained in a variable called `'lambert_conformal_conic'` (we used it above to specify the coordinate reference information for **rioxarray**).\n",
969+
"Write part of the dataset out to a GeoTIFF. \n",
970+
"\n",
971+
"Earlier versions of rioxarray require us to remove the `'grid_mapping'` attribute first (at least in version 0.15, you will get an error otherwise). `grid_mapping` is a variable from the original NetCDF dataset that specifies that coordinate reference information is contained in a variable called `'lambert_conformal_conic'` (we used it above to specify the coordinate reference information for **rioxarray**).\n",
970972
"\n",
971973
"#### Write a single 2D timeslice to a raster"
972974
]
@@ -978,7 +980,9 @@
978980
"outputs": [],
979981
"source": [
980982
"precip_slice = ds.sel(time='2018-12-30')['prcp']\n",
981-
"del precip_slice.attrs['grid_mapping']"
983+
"\n",
984+
"# remove grid_mapping if needed\n",
985+
"#del precip_slice.attrs['grid_mapping']"
982986
]
983987
},
984988
{
@@ -1005,7 +1009,7 @@
10051009
"outputs": [],
10061010
"source": [
10071011
"precip_slice = ds.sel(time=slice('2018-12-25', '2018-12-30'))['prcp']\n",
1008-
"del precip_slice.attrs['grid_mapping']\n",
1012+
"\n",
10091013
"precip_slice.rio.to_raster(output_folder / 'pcrp_20181225-30.tif')"
10101014
]
10111015
},
@@ -1097,7 +1101,7 @@
10971101
"name": "python",
10981102
"nbconvert_exporter": "python",
10991103
"pygments_lexer": "ipython3",
1100-
"version": "3.11.7"
1104+
"version": "3.11.9"
11011105
}
11021106
},
11031107
"nbformat": 4,

0 commit comments

Comments
 (0)