Skip to content

Commit 05e8c72

Browse files
Update downloadable tutorial Python script
1 parent b19de18 commit 05e8c72

1 file changed

Lines changed: 27 additions & 3 deletions

File tree

docs/_downloads/tutorial.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
y = cf.read('$PWD') # Raises Exception
1212
except Exception:
1313
pass
14-
y = cf.read('$PWD', file_type='netCDF')
14+
y = cf.read('$PWD', dataset_type='netCDF')
1515
len(y)
1616
x = cf.read('file.nc')
1717
x
@@ -765,7 +765,7 @@
765765
import netCDF4
766766
nc = netCDF4.Dataset('file.nc', 'r')
767767
v = nc.variables['ta']
768-
netcdf_array = cf.NetCDF4Array(filename='file.nc', address='ta',
768+
netcdf_array = cf.XnetcdfArray(filename='file.nc', address='ta',
769769
dtype=v.dtype, shape=v.shape)
770770
data_disk = cf.Data(netcdf_array)
771771
numpy_array = v[...]
@@ -828,7 +828,7 @@
828828
cf.read('append-example-file.nc')
829829
h = cf.example_field(0)
830830
h
831-
cf.write(h, 'append-example-file.nc', mode='a')
831+
cf.write(h, 'append-example-file.nc', mode='a', backend='netCDF4')
832832
cf.read('append-example-file.nc')
833833
f = cf.read('q_file.nc')[0]
834834
q.equals(f)
@@ -1059,6 +1059,30 @@
10591059
list_variable
10601060
print(list_variable.array)
10611061
cf.write(P, 'P_gathered.nc')
1062+
f = cf.read('subsampled.nc')[0]
1063+
print(f)
1064+
lon = f.construct('longitude')
1065+
lon
1066+
lon.data.source()
1067+
print(lon.array)
1068+
lon.data.source().source()
1069+
print(lon.data.source().source().array)
1070+
g = f[0, 6, :]
1071+
print(g)
1072+
print(g.construct('longitude').array)
1073+
lon = f.construct('longitude')
1074+
d = lon.data.source()
1075+
d.get_tie_point_indices()
1076+
d.get_computational_precision()
1077+
q, t = cf.read('file.nc')
1078+
t.set_quantize_on_write(algorithm='bitgroom', quantization_nsd=1)
1079+
cf.write(t, 'quantized.nc', backend='netCDF4')
1080+
quantized = cf.read('quantized.nc')[0]
1081+
c = quantized.get_quantization()
1082+
c
1083+
c.parameters()
1084+
t[0, 0, 0].array
1085+
quantized[0, 0, 0].array
10621086
pp = cf.read('umfile.pp')
10631087
pp
10641088
print(pp[0])

0 commit comments

Comments
 (0)