import netCDF4 as ncfn = ‘/path/to/file.nc4’
ds = nc.Dataset(fn)
# import Dataset from netCDF4
from netCDF4 import Dataset
# open nc file and save to nc
ds = Dataset('myfile.nc')
# print all metadata
print(ds)
# print metadata in key and value
print(ds.__dict__)
# print a specific key value
print(ds.__dict__['creator']
# print dimensions
print(ds.dimensions) or
for dim in ds.dimensions.values():
print(dim)
# print variable names only
print(ds.variables.keys())
# print crs
crs = nc.variables['crs']