Skip to content

Commit fc8d700

Browse files
committed
changes to reading netcdf files using the latest netCDF4 package instead of the older Scipy library
1 parent 4766bc1 commit fc8d700

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

_episodes/10-diagnostics.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,17 +385,17 @@ def compute_diagnostic(filename):
385385
> {: .solution}
386386
{: .challenge}
387387
388-
> ## Reading data using Scipy's netCDF library
388+
> ## Reading data using the netCDF4 package
389389
>
390390
> Yet another option to read the NetCDF file data is to use
391-
> the [SciPy's netCDF library][netCDF].
391+
> the [netCDF-4 Python interface](https://unidata.github.io/netcdf4-python/) to the netCDF C library.
392392
>
393393
>> ## Answer
394394
>>
395-
>> First, import the ``netcdfx`` package at the top of the script as:
395+
>> First, import the ``netCDF4`` package at the top of the script as:
396396
>>
397397
>>~~~python
398-
>>from scipy.io import netcdfx
398+
>>import netCDF4
399399
>>~~~
400400
>>
401401
>> Then, change ``compute_diagnostic`` as:
@@ -404,7 +404,7 @@ def compute_diagnostic(filename):
404404
>>def compute_diagnostic(filename):
405405
>> """Compute an example diagnostic."""
406406
>> logger.debug("Loading %s", filename)
407-
>> netcdf_file = netcdf.netcdf_file(filename,'r')
407+
>> nc_data = netCDF4.Dataset(filename,'r')
408408
>>
409409
>> #do your analyses on the data here
410410
>>

0 commit comments

Comments
 (0)