@@ -377,8 +377,8 @@ See: :ref:`copy_notes`
377377
378378Extract a subsection by indexing
379379--------------------------------
380- The nicest way is usually just to use the :meth: `~ncdata.Ncdata.slicer ` method to specify
381- dimensions to index, and then index the result.
380+ The nicest way is usually to use the NcData :meth: `~ncdata.Ncdata.slicer ` method to
381+ specify dimensions to index, and then index the result.
382382
383383.. testsetup ::
384384
@@ -388,22 +388,22 @@ dimensions to index, and then index the result.
388388 >>> for nn, dim in full_data.dimensions.items():
389389 ... full_data.variables.add(NcVariable(nn, dimensions = [nn], data = np.arange(dim.size)))
390390
391- .. doctest ::
392-
393- >>> for dimname in full_data.dimensions:
394- ... print (dimname, ' :' , full_data.variables[dimname].data)
395- x : [0 1 2 3 4 5 6]
396- y : [0 1 2 3 4 5]
397-
398391.. doctest ::
399392
400393 >>> data_region = full_data.slicer(" y" , " x" )[3 , 1 ::2 ]
401394
395+ effect:
396+
402397.. doctest ::
403398
399+ >>> for dimname in full_data.dimensions:
400+ ... print (" (original)" , dimname, ' :' , full_data.variables[dimname].data)
401+ (original) x : [0 1 2 3 4 5 6]
402+ (original) y : [0 1 2 3 4 5]
403+
404404 >>> for dimname in data_region.dimensions:
405- ... print (dimname, ' :' , data_region.variables[dimname].data)
406- x : [1 3 5]
405+ ... print (" (new) " , dimname, ' :' , data_region.variables[dimname].data)
406+ (new) x : [1 3 5]
407407
408408You can also slice data directly, which simply acts on the dimensions in order:
409409
@@ -413,7 +413,7 @@ You can also slice data directly, which simply acts on the dimensions in order:
413413 >>> data_region_2 == data_region
414414 True
415415
416- See: :ref: `indexing_overview `
416+ See: :ref: `utils_indexing `
417417
418418
419419Read data from a NetCDF file
@@ -454,8 +454,8 @@ Use the ``dim_chunks`` argument in the :func:`ncdata.netcdf4.from_nc4` function
454454
455455 >>> from ncdata.netcdf4 import from_nc4
456456 >>> ds = from_nc4(filepath, dim_chunks = {" time" : 3 })
457- >>> print (ds.variables[" time" ].data.chunksize )
458- (3 ,)
457+ >>> print (ds.variables[" time" ].data.chunks )
458+ ((3, 3, 3, 1) ,)
459459
460460
461461Save data to a new file
@@ -531,8 +531,28 @@ Use :func:`ncdata.xarray.to_xarray` and :func:`ncdata.xarray.from_xarray`.
531531 >>> from ncdata.xarray import from_xarray, to_xarray
532532 >>> dataset = xarray.open_dataset(filepath)
533533 >>> ncdata = from_xarray(dataset)
534- >>>
534+
535+ >>> print (ncdata)
536+ <NcData: <'no-name'>
537+ variables:
538+ <NcVariable(float64): vx()
539+ vx:units = 'm.s-1'
540+ vx:q = 4.2
541+ vx:_FillValue = nan
542+ >
543+ <BLANKLINE>
544+ global attributes:
545+ :experiment = 'A301.7'
546+ >
547+
535548 >>> ds2 = to_xarray(ncdata)
549+ >>> print (ds2)
550+ <xarray.Dataset> Size: 8B
551+ Dimensions: ()
552+ Data variables:
553+ vx float64 8B nan
554+ Attributes:
555+ experiment: A301.7
536556
537557Note that:
538558
@@ -573,7 +593,7 @@ passed using specific dictionary keywords, e.g.
573593 ... iris_load_kwargs= {' constraints' : ' air_temperature' },
574594 ... xr_save_kwargs= {' unlimited_dims' : (' time' ,)},
575595 ... )
576- ...
596+
577597
578598Combine data from different input files into one output
579599-------------------------------------------------------
0 commit comments