carpentries-lab / python-aos-lesson

Python for Atmosphere and Ocean Scientists
https://carpentries-lab.github.io/python-aos-lesson/
Other
87 stars 49 forks source link

[JOSE] Add netcdf4 to the install in lesson 01-conda #20

Closed RobTheOceanographer closed 5 years ago

RobTheOceanographer commented 5 years ago

The xr.open_dataset call in lesson 02-visualisation threw an TypeError for me. The error was:

TypeError: Error: .../data-carpentry/data/pr_Amon_ACCESS1-3_historical_r1i1p1_200101-200512.nc is not a valid NetCDF 3 file
            If this is a NetCDF4 file, you may need to install the
            netcdf4 library, e.g.,

            $ pip install netcdf4

This is likely due to the an assumption that the conda env built by the users will have the python netcdf4 in it... but that was not the case for my set up so I have submitted an issue to add netcdf4 to the install process in lesson 01-conda.

I recommend adding netCDF4 to to the install explicitly.

CC: openjournals/jose-reviews#37

DamienIrving commented 5 years ago

Thanks for spotting this omission, @RobTheOceanographer.

It's frustrating that the conda recipe for xarray doesn't install netCDF4 by default, but indeed at the xarray website it asks people to install netCDF4, bottleneck and dask. These lessons don't cover parallel processing (and hence dask and bottleneck aren't required), but I've gone ahead and added netCDF4 to the install instructions.

See https://github.com/carpentrieslab/python-aos-lesson/commit/9cc6f698e9869f04f6f9911155c58a3a2daf4431