I tried to read sequence data in this way:
ds = ncdataset('
http://apdrc.soest.hawaii.edu/dapper/insitu/ladcp.cdp');
location = ds.netcdf.findVariable('location');
profile = location.findVariable('profile');
temperature = profile.findVariable('ctd_t');
Can I select select a region and print first 5 locations with temperature data like Pydap (Python library)?
Example in Pyday: print the data with a small region
>>> from dap.client import open
>>> dataset = open_url('
http://apdrc.soest.hawaii.edu/dapper/insitu/ladcp.cdp')
>>> print type(dataset.location)
<class 'pydap.model.SequenceType'>
>>> print dataset.location.keys()
['time', 'lat', 'lon', '_id', 'profile', 'attributes', 'variable_attributes']
>>> my_location = dataset.location[
... (dataset.location.lat < 0)]
>>> my_location = my_location[:5]
>>> print len(my_location['_id'])
5
>>> my_location.keys()
['time', 'lat', 'lon', '_id', 'profile', 'attributes', 'variable_attributes']
>>> my_location.profile.keys()
['ctd_ss', 'u_do', 'ts', 'range', 'v_shear_method', 'v_do', 'u_up', 'range_up', 'v_up', 'ensemble_vel_err', 'ctd_t', 'ts_out', 'w_shear_method', 'range_do', 'ctd_s', 'v', 'u', 'nvel', 'uerr', 'u_shear_method', 'p', 'z']
>>> for value in my_location.profile.ctd_t:
... print value[:10]
...
[9.8829107, 9.761694, 9.5405989, 9.5265846, 9.5052958, 9.4946136, 9.3353405, 9.2345428, 8.8949976, 8.6744404]
[10.550227, 10.532578, 10.505015, 10.31136, 10.286689, 10.145658, 9.6334896, 9.2090206, 8.9810734, 8.8150978]
[10.647948, 10.556409, 10.12057, 9.7420454, 9.5320473, 9.1422911, 8.9969978, 8.9284277, 8.8854694, 8.8590002]
[9.8911743, 9.8749323, 9.8544912, 9.4953737, 9.4862947, 9.4749165, 9.4250631, 9.0358047, 8.866889, 8.7565432]
[10.543967, 10.211137, 9.9243612, 9.8211136, 9.6091099, 9.1954517, 8.8879824, 8.7605925, 8.592474, 8.5208397]
Reference:
http://www.pydap.org/client.html#accessing-sequential-dataThanks,
Alex