create polyline programamtically in Python to simulate trajectory

Dear Community,

I am trying, without much success so far, to animate a trajectory over time. This trajectory could be a drone or an underwater glider, so at each timestep i have a triplet of (x,y,z) and an associated scalar value (e.g., temp?).

I am using python to read in my data (netcdf) and, inside for each timestep inside my for loop, append new coordinates + scalar.

My strategy is that for each timestep, I could create a new vtk file in python, with increasing number of points (x,y,z, scalar). I would then read it in as a bulk, an animate. This would nicely render the spatial evolution over time, with a nice trailing effect.

I am using pyvista.

When doing it for a simple line, the magic works. Start and endpoint of my line are where they should be, the scalars for each point are correct too and, in PV, I can visualize it as a surface (in my case a coloured line; I am also extruding it linearly to have a nice looking image). The problem is that when I want to add more points (with my for loop), I am failing probably because Line is an entity that only accepts two points.

When, however, I am trying to use a PolyLine, all points are there and where I expect them to be, but I cannot visualize them as SURFACE (only guassian points).

Any idea of how I could achieve my goal?
Thanks!

Hi Marco,

Please share your data

Hi Mathieu.

Thanks for your time.

The original data is the netcdf file attached to this message (CF compliant). However, for the basic case I have shown above, I have used a simple python code to generate random numbers (also attached) and the vtk line shown in the image I have shown in my first post.

ifm10_depl02_R.nc (242.9 KB)
CreateVtk_Line.py (827 Bytes)

Edit: Ideally, I would like to create a streamfile like the the *.vtp file I attach here, where I can prescribe the quadruplet (x,y,z,scalar[s]).
testStream_0_2.vtp (8.1 KB)

Iā€™m unable to open your file with ParaView so far, which reader and param are you using ?

Yes, PV cannot open the netcdf file, that is why I am trying to extract the quadruplets in python (x,y,z,scalar) and then write it to a vtp file.

If I do a ncdump of my netcdf File, I get the message below.

All variables are a function of time only (monotonical ascending, as requested by CF standards). In that respect, what I am trying to achieve is to reshape the data into a format that PV will eventually like and that PV will be able to animate.

Since (x,y,z,scalar) are all functions of time (alone), when clicking the animate button, a coloured snake should start moving through my domain. But it requires some prepropcessing (in python, in my case) that, at the end, would produce a vtp file, PV-cpmaptible.

Thankls again for considering my prblem.

What follows is the result of the ncdump:

netcdf ifm10_depl02_R {
dimensions:
	DATE_TIME = 14 ;
	STRING1024 = 1024 ;
	STRING256 = 256 ;
	STRING512 = 512 ;
	STRING64 = 64 ;
	STRING32 = 32 ;
	STRING16 = 16 ;
	STRING8 = 8 ;
	STRING4 = 4 ;
	STRING2 = 2 ;
	N_PARAM = 7 ;
	N_TRANS_SYSTEM = 1 ;
	N_POSITIONING_SYSTEM = 3 ;
	N_DERIVATION = 7 ;
	N_HISTORY = 3 ;
	TIME_GPS = 123 ;
	TIME = UNLIMITED ; // (1402 currently)
variables:
	double TIME(TIME) ;
		TIME:long_name = "Epoch time" ;
		TIME:standard_name = "time" ;
		TIME:units = "seconds since 1970-01-01T00:00:00Z" ;
		TIME:_FillValue = 9999999999. ;
		TIME:valid_min = 0. ;
		TIME:valid_max = 90000. ;
		TIME:QC_procedure = "EGO QC not applied yet" ;
		TIME:comment = "" ;
		TIME:axis = "T" ;
		TIME:ancillary_variable = "TIME_QC" ;
		TIME:sdn_parameter_urn = "SDN:P01::ELTMEP01" ;
		TIME:sdn_uom_urn = "SDN:P061::UTBB" ;
		TIME:glider_original_parameter_name = "sci_m_present_time" ;
	double JULD(TIME) ;
		JULD:long_name = "Julian 1950 time" ;
		JULD:standard_name = "time" ;
		JULD:units = "days since 1950-01-01T00:00:00Z" ;
		JULD:_FillValue = 999999. ;
		JULD:valid_min = 0. ;
		JULD:valid_max = 90000. ;
		JULD:QC_procedure = "EGO QC not applied yet" ;
		JULD:comment = "" ;
		JULD:axis = "T" ;
		JULD:ancillary_variable = "JULD_QC" ;
		JULD:sdn_parameter_urn = "SDN:P01::XXX" ;
		JULD:sdn_uom_urn = "SDN:P061::UTAA" ;
		JULD:glider_original_parameter_name = "sci_juld" ;
	double LATITUDE(TIME) ;
		LATITUDE:long_name = "Measurement latitude" ;
		LATITUDE:standard_name = "latitude" ;
		LATITUDE:units = "degree_north" ;
		LATITUDE:_FillValue = 99999. ;
		LATITUDE:valid_min = -90. ;
		LATITUDE:valid_max = 90. ;
		LATITUDE:QC_procedure = "EGO QC not applied yet" ;
		LATITUDE:comment = "" ;
		LATITUDE:axis = "Y" ;
		LATITUDE:ancillary_variable = "POSITION_QC" ;
		LATITUDE:reference = "WGS84" ;
		LATITUDE:coordinate_reference_frame = "urn:ogc:crs:EPSG::4326" ;
		LATITUDE:sdn_parameter_urn = "SDN:P01::ALATZZ01" ;
		LATITUDE:sdn_uom_urn = "SDN:P061::DEGN" ;
		LATITUDE:glider_original_parameter_name = "sci_m_lat" ;
	double LONGITUDE(TIME) ;
		LONGITUDE:long_name = "Measurement longitude" ;
		LONGITUDE:standard_name = "longitude" ;
		LONGITUDE:units = "degree_east" ;
		LONGITUDE:_FillValue = 99999. ;
		LONGITUDE:valid_min = -180. ;
		LONGITUDE:valid_max = 180. ;
		LONGITUDE:QC_procedure = "EGO QC not applied yet" ;
		LONGITUDE:comment = "" ;
		LONGITUDE:axis = "X" ;
		LONGITUDE:ancillary_variable = "POSITION_QC" ;
		LONGITUDE:reference = "WGS84" ;
		LONGITUDE:coordinate_reference_frame = "urn:ogc:crs:EPSG::4326" ;
		LONGITUDE:sdn_parameter_urn = "SDN:P01::ALONZZ01" ;
		LONGITUDE:sdn_uom_urn = "SDN:P061::DEGE" ;
		LONGITUDE:glider_original_parameter_name = "sci_m_lon" ;
	double TIME_GPS(TIME_GPS) ;
		TIME_GPS:long_name = "Epoch time of the GPS fixes" ;
		TIME_GPS:standard_name = "time" ;
		TIME_GPS:units = "seconds since 1970-01-01T00:00:00Z" ;
		TIME_GPS:_FillValue = -1. ;
		TIME_GPS:valid_min = 0. ;
		TIME_GPS:valid_max = 90000. ;
		TIME_GPS:QC_procedure = "EGO QC not applied yet" ;
		TIME_GPS:comment = "" ;
		TIME_GPS:axis = "T" ;
		TIME_GPS:ancillary_variable = "TIME_GPS_QC" ;
		TIME_GPS:sdn_parameter_urn = "SDN:P01::ELTMEP01" ;
		TIME_GPS:sdn_uom_urn = "SDN:P061::UTBB" ;
		TIME_GPS:glider_original_parameter_name = "time" ;
	double LATITUDE_GPS(TIME_GPS) ;
		LATITUDE_GPS:long_name = "Gps fixed latitude" ;
		LATITUDE_GPS:standard_name = "latitude" ;
		LATITUDE_GPS:units = "degree_north" ;
		LATITUDE_GPS:_FillValue = 99999. ;
		LATITUDE_GPS:valid_min = -90. ;
		LATITUDE_GPS:valid_max = 90. ;
		LATITUDE_GPS:QC_procedure = "EGO QC not applied yet" ;
		LATITUDE_GPS:comment = "" ;
		LATITUDE_GPS:axis = "Y" ;
		LATITUDE_GPS:ancillary_variable = "POSITION_GPS_QC" ;
		LATITUDE_GPS:reference = "WGS84" ;
		LATITUDE_GPS:coordinate_reference_frame = "urn:ogc:crs:EPSG::4326" ;
		LATITUDE_GPS:sdn_parameter_urn = "SDN:P01::ALATZZ01" ;
		LATITUDE_GPS:sdn_uom_urn = "SDN:P061::DEGN" ;
		LATITUDE_GPS:glider_original_parameter_name = "latitude" ;
	double LONGITUDE_GPS(TIME_GPS) ;
		LONGITUDE_GPS:long_name = "Gps fixed longitude" ;
		LONGITUDE_GPS:standard_name = "longitude" ;
		LONGITUDE_GPS:units = "degree_east" ;
		LONGITUDE_GPS:_FillValue = 99999. ;
		LONGITUDE_GPS:valid_min = -180. ;
		LONGITUDE_GPS:valid_max = 180. ;
		LONGITUDE_GPS:QC_procedure = "EGO QC not applied yet" ;
		LONGITUDE_GPS:comment = "" ;
		LONGITUDE_GPS:axis = "X" ;
		LONGITUDE_GPS:ancillary_variable = "POSITION_GPS_QC" ;
		LONGITUDE_GPS:reference = "WGS84" ;
		LONGITUDE_GPS:coordinate_reference_frame = "urn:ogc:crs:EPSG::4326" ;
		LONGITUDE_GPS:sdn_parameter_urn = "SDN:P01::ALONZZ01" ;
		LONGITUDE_GPS:sdn_uom_urn = "SDN:P061::DEGE" ;
		LONGITUDE_GPS:glider_original_parameter_name = "longitude" ;
	byte TIME_QC(TIME) ;
		TIME_QC:long_name = "Quality flag" ;
		TIME_QC:conventions = "EGO reference table 2" ;
		TIME_QC:_FillValue = -128b ;
		TIME_QC:valid_min = 0b ;
		TIME_QC:valid_max = 9b ;
		TIME_QC:flag_values = 0b, 1b, 2b, 3b, 4b, 5b, 8b, 9b ;
		TIME_QC:flag_meanings = "no_qc_performed good_data probably_good_data bad_data_that_are_potentially_correctable bad_data value_changed interpolated_value missing_value" ;
	byte JULD_QC(TIME) ;
		JULD_QC:long_name = "Quality flag" ;
		JULD_QC:conventions = "EGO reference table 2" ;
		JULD_QC:_FillValue = -128b ;
		JULD_QC:valid_min = 0b ;
		JULD_QC:valid_max = 9b ;
		JULD_QC:flag_values = 0b, 1b, 2b, 3b, 4b, 5b, 8b, 9b ;
		JULD_QC:flag_meanings = "no_qc_performed good_data probably_good_data bad_data_that_are_potentially_correctable bad_data value_changed interpolated_value missing_value" ;
	byte POSITION_QC(TIME) ;
		POSITION_QC:long_name = "Quality flag" ;
		POSITION_QC:conventions = "EGO reference table 2" ;
		POSITION_QC:_FillValue = -128b ;
		POSITION_QC:valid_min = 0b ;
		POSITION_QC:valid_max = 9b ;
		POSITION_QC:flag_values = 0b, 1b, 2b, 3b, 4b, 5b, 8b, 9b ;
		POSITION_QC:flag_meanings = "no_qc_performed good_data probably_good_data bad_data_that_are_potentially_correctable bad_data value_changed interpolated_value missing_value" ;
	byte TIME_GPS_QC(TIME_GPS) ;
		TIME_GPS_QC:long_name = "Quality flag" ;
		TIME_GPS_QC:conventions = "EGO reference table 2" ;
		TIME_GPS_QC:_FillValue = -128b ;
		TIME_GPS_QC:valid_min = 0b ;
		TIME_GPS_QC:valid_max = 9b ;
		TIME_GPS_QC:flag_values = 0b, 1b, 2b, 3b, 4b, 5b, 8b, 9b ;
		TIME_GPS_QC:flag_meanings = "no_qc_performed good_data probably_good_data bad_data_that_are_potentially_correctable bad_data value_changed interpolated_value missing_value" ;
	byte POSITION_GPS_QC(TIME_GPS) ;
		POSITION_GPS_QC:long_name = "Quality flag" ;
		POSITION_GPS_QC:conventions = "EGO reference table 2" ;
		POSITION_GPS_QC:_FillValue = -128b ;
		POSITION_GPS_QC:valid_min = 0b ;
		POSITION_GPS_QC:valid_max = 9b ;
		POSITION_GPS_QC:flag_values = 0b, 1b, 2b, 3b, 4b, 5b, 8b, 9b ;
		POSITION_GPS_QC:flag_meanings = "no_qc_performed good_data probably_good_data bad_data_that_are_potentially_correctable bad_data value_changed interpolated_value missing_value" ;
	float PRES(TIME) ;
		PRES:standard_name = "sea_water_pressure" ;
		PRES:units = "decibar" ;
		PRES:_FillValue = 99999.f ;
		PRES:axis = "Z" ;
		PRES:positive = "down" ;
		PRES:long_name = "Sea water pressure, equals 0 at sea-level" ;
		PRES:valid_min = 0.f ;
		PRES:valid_max = 12000.f ;
		PRES:comment = "" ;
		PRES:ancillary_variable = "PRES_QC" ;
		PRES:sdn_parameter_urn = "SDN:P01::PRESPR01" ;
		PRES:sdn_uom_urn = "SDN:P061::UPDB" ;
		PRES:sdn_uom_name = "" ;
		PRES:glider_original_parameter_name = "sci_water_pressure" ;
		PRES:accuracy = "" ;
		PRES:precision = "" ;
		PRES:resolution = "" ;
		PRES:cell_methods = "" ;
		PRES:reference_scale = "" ;
		PRES:sensor_mount = "mounted_on_glider" ;
		PRES:sensor_orientation = "" ;
		PRES:sensor_name = "CTD" ;
		PRES:sensor_serial_number = "" ;
		PRES:DM_indicator = "" ;
		PRES:coordinates = "TIME LATITUDE LONGITUDE PRES" ;
	float TEMP(TIME) ;
		TEMP:standard_name = "sea_water_temperature" ;
		TEMP:units = "degree_Celsius" ;
		TEMP:_FillValue = 99999.f ;
		TEMP:long_name = "Sea temperature in-situ ITS-90 scale" ;
		TEMP:valid_min = -2.5f ;
		TEMP:valid_max = 40.f ;
		TEMP:comment = "" ;
		TEMP:ancillary_variable = "TEMP_QC" ;
		TEMP:sdn_parameter_urn = "SDN:P01::TEMPST01" ;
		TEMP:sdn_uom_urn = "SDN:P061::UPAA" ;
		TEMP:sdn_uom_name = "" ;
		TEMP:glider_original_parameter_name = "sci_water_temp" ;
		TEMP:accuracy = "" ;
		TEMP:precision = "" ;
		TEMP:resolution = "" ;
		TEMP:cell_methods = "" ;
		TEMP:reference_scale = "" ;
		TEMP:sensor_mount = "mounted_on_glider" ;
		TEMP:sensor_orientation = "" ;
		TEMP:sensor_name = "CTD" ;
		TEMP:sensor_serial_number = "" ;
		TEMP:DM_indicator = "" ;
		TEMP:coordinates = "TIME LATITUDE LONGITUDE PRES" ;
	float CNDC(TIME) ;
		CNDC:standard_name = "sea_water_electrical_conductivity" ;
		CNDC:units = "mhos/m" ;
		CNDC:_FillValue = 99999.f ;
		CNDC:long_name = "Electrical conductivity" ;
		CNDC:valid_min = 0.f ;
		CNDC:valid_max = 8.5f ;
		CNDC:comment = "" ;
		CNDC:ancillary_variable = "CNDC_QC" ;
		CNDC:sdn_parameter_urn = "SDN:P01::CNDCST01" ;
		CNDC:sdn_uom_urn = "SDN:P061::UECA" ;
		CNDC:sdn_uom_name = "" ;
		CNDC:glider_original_parameter_name = "sci_water_cond" ;
		CNDC:accuracy = "" ;
		CNDC:precision = "" ;
		CNDC:resolution = "" ;
		CNDC:cell_methods = "" ;
		CNDC:reference_scale = "" ;
		CNDC:sensor_mount = "mounted_on_glider" ;
		CNDC:sensor_orientation = "" ;
		CNDC:sensor_name = "CTD" ;
		CNDC:sensor_serial_number = "" ;
		CNDC:DM_indicator = "" ;
		CNDC:coordinates = "TIME LATITUDE LONGITUDE PRES" ;
	float PSAL(TIME) ;
		PSAL:standard_name = "sea_water_salinity" ;
		PSAL:units = "psu" ;
		PSAL:_FillValue = 99999.f ;
		PSAL:long_name = "Practical salinity" ;
		PSAL:valid_min = 2.f ;
		PSAL:valid_max = 41.f ;
		PSAL:comment = "" ;
		PSAL:ancillary_variable = "PSAL_QC" ;
		PSAL:sdn_parameter_urn = "SDN:P01::PSALST01" ;
		PSAL:sdn_uom_urn = "DN:P061::UUUU" ;
		PSAL:sdn_uom_name = "" ;
		PSAL:glider_original_parameter_name = "" ;
		PSAL:accuracy = "" ;
		PSAL:precision = "" ;
		PSAL:resolution = "" ;
		PSAL:cell_methods = "" ;
		PSAL:reference_scale = "" ;
		PSAL:sensor_mount = "mounted_on_glider" ;
		PSAL:sensor_orientation = "" ;
		PSAL:sensor_name = "CTD" ;
		PSAL:sensor_serial_number = "" ;
		PSAL:DM_indicator = "" ;
		PSAL:coordinates = "TIME LATITUDE LONGITUDE PRES" ;
	byte PRES_QC(TIME) ;
		PRES_QC:long_name = "Quality flag" ;
		PRES_QC:conventions = "EGO reference table 2" ;
		PRES_QC:_FillValue = -128b ;
		PRES_QC:valid_min = 0b ;
		PRES_QC:valid_max = 9b ;
		PRES_QC:flag_values = 0b, 1b, 2b, 3b, 4b, 5b, 8b, 9b ;
		PRES_QC:flag_meanings = "no_qc_performed good_data probably_good_data bad_data_that_are_potentially_correctable bad_data value_changed interpolated_value missing_value" ;
	byte TEMP_QC(TIME) ;
		TEMP_QC:long_name = "Quality flag" ;
		TEMP_QC:conventions = "EGO reference table 2" ;
		TEMP_QC:_FillValue = -128b ;
		TEMP_QC:valid_min = 0b ;
		TEMP_QC:valid_max = 9b ;
		TEMP_QC:flag_values = 0b, 1b, 2b, 3b, 4b, 5b, 8b, 9b ;
		TEMP_QC:flag_meanings = "no_qc_performed good_data probably_good_data bad_data_that_are_potentially_correctable bad_data value_changed interpolated_value missing_value" ;
	byte CNDC_QC(TIME) ;
		CNDC_QC:long_name = "Quality flag" ;
		CNDC_QC:conventions = "EGO reference table 2" ;
		CNDC_QC:_FillValue = -128b ;
		CNDC_QC:valid_min = 0b ;
		CNDC_QC:valid_max = 9b ;
		CNDC_QC:flag_values = 0b, 1b, 2b, 3b, 4b, 5b, 8b, 9b ;
		CNDC_QC:flag_meanings = "no_qc_performed good_data probably_good_data bad_data_that_are_potentially_correctable bad_data value_changed interpolated_value missing_value" ;
	byte PSAL_QC(TIME) ;
		PSAL_QC:long_name = "Quality flag" ;
		PSAL_QC:conventions = "EGO reference table 2" ;
		PSAL_QC:_FillValue = -128b ;
		PSAL_QC:valid_min = 0b ;
		PSAL_QC:valid_max = 9b ;
		PSAL_QC:flag_values = 0b, 1b, 2b, 3b, 4b, 5b, 8b, 9b ;
		PSAL_QC:flag_meanings = "no_qc_performed good_data probably_good_data bad_data_that_are_potentially_correctable bad_data value_changed interpolated_value missing_value" ;
	float PRES_UNCERTAINTY(TIME) ;
		PRES_UNCERTAINTY:long_name = "Uncertainty" ;
		PRES_UNCERTAINTY:_FillValue = 99999.f ;
		PRES_UNCERTAINTY:units = "decibar" ;
	float TEMP_UNCERTAINTY(TIME) ;
		TEMP_UNCERTAINTY:long_name = "Uncertainty" ;
		TEMP_UNCERTAINTY:_FillValue = 99999.f ;
		TEMP_UNCERTAINTY:units = "degree_Celsius" ;
	float CNDC_UNCERTAINTY(TIME) ;
		CNDC_UNCERTAINTY:long_name = "Uncertainty" ;
		CNDC_UNCERTAINTY:_FillValue = 99999.f ;
		CNDC_UNCERTAINTY:units = "mhos/m" ;
	float PSAL_UNCERTAINTY(TIME) ;
		PSAL_UNCERTAINTY:long_name = "Uncertainty" ;
		PSAL_UNCERTAINTY:_FillValue = 99999.f ;
		PSAL_UNCERTAINTY:units = "psu" ;
	float CHLA(TIME) ;
		CHLA:standard_name = "mass_concentration_of_chlorophyll_a_in_sea_water" ;
		CHLA:units = "mg/m3" ;
		CHLA:_FillValue = 99999.f ;
		CHLA:long_name = "Chlorophyll-A" ;
		CHLA:valid_min = "" ;
		CHLA:valid_max = "" ;
		CHLA:comment = "" ;
		CHLA:ancillary_variable = "CHLA_QC" ;
		CHLA:sdn_parameter_urn = "SDN:P01::CPHLPR01" ;
		CHLA:sdn_uom_urn = "SDN:P061::UMMC" ;
		CHLA:sdn_uom_name = "" ;
		CHLA:glider_original_parameter_name = "sci_flntu_chlor_units" ;
		CHLA:accuracy = "" ;
		CHLA:precision = "" ;
		CHLA:resolution = "" ;
		CHLA:cell_methods = "" ;
		CHLA:reference_scale = "" ;
		CHLA:sensor_mount = "" ;
		CHLA:sensor_orientation = "" ;
		CHLA:sensor_name = "Wetlabs flntu" ;
		CHLA:sensor_serial_number = "" ;
		CHLA:DM_indicator = "" ;
		CHLA:coordinates = "TIME LATITUDE LONGITUDE PRES" ;
	float TURBIDITY(TIME) ;
		TURBIDITY:standard_name = "sea_water_turbidity" ;
		TURBIDITY:units = "ntu" ;
		TURBIDITY:_FillValue = 99999.f ;
		TURBIDITY:long_name = "Sea water turbidity" ;
		TURBIDITY:valid_min = "" ;
		TURBIDITY:valid_max = "" ;
		TURBIDITY:comment = "" ;
		TURBIDITY:ancillary_variable = "TURBIDITY_QC" ;
		TURBIDITY:sdn_parameter_urn = "" ;
		TURBIDITY:sdn_uom_urn = "SDN:P061::USTU" ;
		TURBIDITY:sdn_uom_name = "" ;
		TURBIDITY:glider_original_parameter_name = "sci_flntu_turb_units" ;
		TURBIDITY:accuracy = "" ;
		TURBIDITY:precision = "" ;
		TURBIDITY:resolution = "" ;
		TURBIDITY:cell_methods = "" ;
		TURBIDITY:reference_scale = "" ;
		TURBIDITY:sensor_mount = "" ;
		TURBIDITY:sensor_orientation = "" ;
		TURBIDITY:sensor_name = "Wetlabs flntu" ;
		TURBIDITY:sensor_serial_number = "" ;
		TURBIDITY:DM_indicator = "" ;
		TURBIDITY:coordinates = "TIME LATITUDE LONGITUDE PRES" ;
	byte CHLA_QC(TIME) ;
		CHLA_QC:long_name = "Quality flag" ;
		CHLA_QC:conventions = "EGO reference table 2" ;
		CHLA_QC:_FillValue = -128b ;
		CHLA_QC:valid_min = 0b ;
		CHLA_QC:valid_max = 9b ;
		CHLA_QC:flag_values = 0b, 1b, 2b, 3b, 4b, 5b, 8b, 9b ;
		CHLA_QC:flag_meanings = "no_qc_performed good_data probably_good_data bad_data_that_are_potentially_correctable bad_data value_changed interpolated_value missing_value" ;
	byte TURBIDITY_QC(TIME) ;
		TURBIDITY_QC:long_name = "Quality flag" ;
		TURBIDITY_QC:conventions = "EGO reference table 2" ;
		TURBIDITY_QC:_FillValue = -128b ;
		TURBIDITY_QC:valid_min = 0b ;
		TURBIDITY_QC:valid_max = 9b ;
		TURBIDITY_QC:flag_values = 0b, 1b, 2b, 3b, 4b, 5b, 8b, 9b ;
		TURBIDITY_QC:flag_meanings = "no_qc_performed good_data probably_good_data bad_data_that_are_potentially_correctable bad_data value_changed interpolated_value missing_value" ;
	float CHLA_UNCERTAINTY(TIME) ;
		CHLA_UNCERTAINTY:long_name = "Uncertainty" ;
		CHLA_UNCERTAINTY:_FillValue = 99999.f ;
		CHLA_UNCERTAINTY:units = "mg/m3" ;
	float TURBIDITY_UNCERTAINTY(TIME) ;
		TURBIDITY_UNCERTAINTY:long_name = "Uncertainty" ;
		TURBIDITY_UNCERTAINTY:_FillValue = 99999.f ;
		TURBIDITY_UNCERTAINTY:units = "ntu" ;
	float MOLAR_DOXY(TIME) ;
		MOLAR_DOXY:standard_name = "mole_concentration_of_dissolved_molecular_oxygen_in_sea_water" ;
		MOLAR_DOXY:units = "micromole/l" ;
		MOLAR_DOXY:_FillValue = 99999.f ;
		MOLAR_DOXY:long_name = "Uncompensated (pressure and salinity) oxygen concentration reported by the oxygen sensor" ;
		MOLAR_DOXY:valid_min = 0.f ;
		MOLAR_DOXY:valid_max = 650.f ;
		MOLAR_DOXY:comment = "" ;
		MOLAR_DOXY:ancillary_variable = "MOLAR_DOXY_QC" ;
		MOLAR_DOXY:sdn_parameter_urn = "SDN:P01::DOXYMMOP" ;
		MOLAR_DOXY:sdn_uom_urn = "SDN:P061::MMPL" ;
		MOLAR_DOXY:sdn_uom_name = "" ;
		MOLAR_DOXY:glider_original_parameter_name = "sci_oxy3835_wphase_oxygen" ;
		MOLAR_DOXY:accuracy = "" ;
		MOLAR_DOXY:precision = "" ;
		MOLAR_DOXY:resolution = "" ;
		MOLAR_DOXY:cell_methods = "" ;
		MOLAR_DOXY:reference_scale = "" ;
		MOLAR_DOXY:sensor_mount = "" ;
		MOLAR_DOXY:sensor_orientation = "" ;
		MOLAR_DOXY:sensor_name = "Aanderaa Oxy" ;
		MOLAR_DOXY:sensor_serial_number = "" ;
		MOLAR_DOXY:DM_indicator = "" ;
		MOLAR_DOXY:coordinates = "TIME LATITUDE LONGITUDE PRES" ;
	byte MOLAR_DOXY_QC(TIME) ;
		MOLAR_DOXY_QC:long_name = "Quality flag" ;
		MOLAR_DOXY_QC:conventions = "EGO reference table 2" ;
		MOLAR_DOXY_QC:_FillValue = -128b ;
		MOLAR_DOXY_QC:valid_min = 0b ;
		MOLAR_DOXY_QC:valid_max = 9b ;
		MOLAR_DOXY_QC:flag_values = 0b, 1b, 2b, 3b, 4b, 5b, 8b, 9b ;
		MOLAR_DOXY_QC:flag_meanings = "no_qc_performed good_data probably_good_data bad_data_that_are_potentially_correctable bad_data value_changed interpolated_value missing_value" ;
	float MOLAR_DOXY_UNCERTAINTY(TIME) ;
		MOLAR_DOXY_UNCERTAINTY:long_name = "Uncertainty" ;
		MOLAR_DOXY_UNCERTAINTY:_FillValue = 99999.f ;
		MOLAR_DOXY_UNCERTAINTY:units = "micromole/l" ;
	byte PHASE(TIME) ;
		PHASE:long_name = "Glider trajectory phase code" ;
		PHASE:conventions = "EGO reference table 9" ;
		PHASE:_FillValue = -128b ;
		PHASE:flag_values = 0b, 1b, 2b, 3b, 4b, 5b, 6b ;
		PHASE:flag_meanings = "surface_drift descent subsurface_drift inflexion ascent grounded inconsistent" ;
	int PHASE_NUMBER(TIME) ;
		PHASE_NUMBER:long_name = "Glider trajectory phase number" ;
		PHASE_NUMBER:_FillValue = 99999 ;
	byte POSITIONING_METHOD(TIME) ;
		POSITIONING_METHOD:long_name = "Positioning method" ;
		POSITIONING_METHOD:conventions = "EGO reference table 10" ;
		POSITIONING_METHOD:_FillValue = -128b ;
		POSITIONING_METHOD:flag_values = 0b, 1b, 2b ;
		POSITIONING_METHOD:flag_meanings = "GPS Argos interpolated" ;
	char TRANS_SYSTEM(N_TRANS_SYSTEM, STRING16) ;
		TRANS_SYSTEM:long_name = "Telecommunication system used" ;
		TRANS_SYSTEM:_FillValue = " " ;
	char TRANS_SYSTEM_ID(N_TRANS_SYSTEM, STRING32) ;
		TRANS_SYSTEM_ID:long_name = "Program identifier used by the transmission system" ;
		TRANS_SYSTEM_ID:_FillValue = " " ;
	char TRANS_FREQUENCY(N_TRANS_SYSTEM, STRING16) ;
		TRANS_FREQUENCY:long_name = "Frequency of transmission from the glider" ;
		TRANS_FREQUENCY:units = "hertz" ;
		TRANS_FREQUENCY:_FillValue = " " ;
	char POSITIONING_SYSTEM(N_POSITIONING_SYSTEM, STRING8) ;
		POSITIONING_SYSTEM:long_name = "Positioning system" ;
		POSITIONING_SYSTEM:_FillValue = " " ;
	char PLATFORM_FAMILY(STRING256) ;
		PLATFORM_FAMILY:long_name = "Category of instrument" ;
		PLATFORM_FAMILY:conventions = "EGO reference table 22" ;
		PLATFORM_FAMILY:_FillValue = " " ;
	char PLATFORM_TYPE(STRING32) ;
		PLATFORM_TYPE:long_name = "Type of glider" ;
		PLATFORM_TYPE:conventions = "EGO reference table XX" ;
		PLATFORM_TYPE:_FillValue = " " ;
	char PLATFORM_MAKER(STRING256) ;
		PLATFORM_MAKER:long_name = "Name of the manufacturer" ;
		PLATFORM_MAKER:_FillValue = " " ;
	char FIRMWARE_VERSION_NAVIGATION(STRING16) ;
		FIRMWARE_VERSION_NAVIGATION:long_name = "Firmware version of the navigation controller board" ;
		FIRMWARE_VERSION_NAVIGATION:_FillValue = " " ;
	char FIRMWARE_VERSION_SCIENCE(STRING16) ;
		FIRMWARE_VERSION_SCIENCE:long_name = "Firmware version of the scientific sensors controller board" ;
		FIRMWARE_VERSION_SCIENCE:_FillValue = " " ;
	char MANUAL_VERSION(STRING16) ;
		MANUAL_VERSION:long_name = "Manual version of the glider" ;
		MANUAL_VERSION:_FillValue = " " ;
	char GLIDER_SERIAL_NO(STRING16) ;
		GLIDER_SERIAL_NO:long_name = "Serial number of the glider" ;
		GLIDER_SERIAL_NO:_FillValue = " " ;
	char STANDARD_FORMAT_ID(STRING16) ;
		STANDARD_FORMAT_ID:long_name = "Standard format number which describes the data format type for each glider" ;
		STANDARD_FORMAT_ID:_FillValue = " " ;
	char DAC_FORMAT_ID(STRING16) ;
		DAC_FORMAT_ID:long_name = "Format number used by the DAC to describe the data format type for each glider" ;
		DAC_FORMAT_ID:_FillValue = " " ;
	char WMO_INST_TYPE(STRING4) ;
		WMO_INST_TYPE:long_name = "Coded instrument type" ;
		WMO_INST_TYPE:conventions = "EGO reference table 8" ;
		WMO_INST_TYPE:_FillValue = " " ;
	char PROJECT_NAME(STRING64) ;
		PROJECT_NAME:long_name = "Program under which the glider was deployed" ;
		PROJECT_NAME:_FillValue = " " ;
	char DATA_CENTRE(STRING2) ;
		DATA_CENTRE:long_name = "Data centre in charge of glider real-time processing" ;
		DATA_CENTRE:conventions = "EGO reference table 4" ;
		DATA_CENTRE:_FillValue = " " ;
	char PI_NAME(STRING64) ;
		PI_NAME:long_name = "Name of the Principal Investigator" ;
		PI_NAME:_FillValue = " " ;
	char ANOMALY(STRING256) ;
		ANOMALY:long_name = "Describe any anomalies or problems the glider may have had" ;
		ANOMALY:_FillValue = " " ;
	char BATTERY_TYPE(STRING64) ;
		BATTERY_TYPE:long_name = "Type of battery packs in the glider" ;
		BATTERY_TYPE:_FillValue = " " ;
	char BATTERY_PACKS(STRING64) ;
		BATTERY_PACKS:long_name = "Configuration of battery packs in the glider" ;
		BATTERY_PACKS:_FillValue = " " ;
	char SPECIAL_FEATURES(STRING1024) ;
		SPECIAL_FEATURES:long_name = "Extra features of the glider (algorithms, compressee etc.)" ;
		SPECIAL_FEATURES:_FillValue = " " ;
	char GLIDER_OWNER(STRING64) ;
		GLIDER_OWNER:long_name = "Glider owner" ;
		GLIDER_OWNER:_FillValue = " " ;
	char OPERATING_INSTITUTION(STRING64) ;
		OPERATING_INSTITUTION:long_name = "Operating institution of the glider" ;
		OPERATING_INSTITUTION:_FillValue = " " ;
	char CUSTOMIZATION(STRING1024) ;
		CUSTOMIZATION:long_name = "Glider customization, i.e. (institutionand modifications)" ;
		CUSTOMIZATION:_FillValue = " " ;
	char DEPLOYMENT_START_DATE(DATE_TIME) ;
		DEPLOYMENT_START_DATE:long_name = "Date (UTC) of the deployment" ;
		DEPLOYMENT_START_DATE:conventions = "YYYYMMDDHHMISS" ;
		DEPLOYMENT_START_DATE:_FillValue = " " ;
	double DEPLOYMENT_START_LATITUDE ;
		DEPLOYMENT_START_LATITUDE:long_name = "Latitude of the glider when deployed" ;
		DEPLOYMENT_START_LATITUDE:units = "degree_north" ;
		DEPLOYMENT_START_LATITUDE:_FillValue = 99999. ;
		DEPLOYMENT_START_LATITUDE:valid_min = -90. ;
		DEPLOYMENT_START_LATITUDE:valid_max = 90. ;
	double DEPLOYMENT_START_LONGITUDE ;
		DEPLOYMENT_START_LONGITUDE:long_name = "Longitude of the glider when deployed" ;
		DEPLOYMENT_START_LONGITUDE:units = "degree_east" ;
		DEPLOYMENT_START_LONGITUDE:_FillValue = 99999. ;
		DEPLOYMENT_START_LONGITUDE:valid_min = -180. ;
		DEPLOYMENT_START_LONGITUDE:valid_max = 180. ;
	byte DEPLOYMENT_START_QC ;
		DEPLOYMENT_START_QC:long_name = "Quality on DEPLOYMENT_START date, time and location" ;
		DEPLOYMENT_START_QC:conventions = "EGO reference table 2" ;
		DEPLOYMENT_START_QC:_FillValue = -128b ;
		DEPLOYMENT_START_QC:flag_values = 0b, 1b, 2b, 3b, 4b, 5b, 8b, 9b ;
		DEPLOYMENT_START_QC:flag_meanings = "no_qc_performed good_data probably_good_data bad_data_that_are_potentially_correctable bad_data value_changed interpolated_value missing_value" ;
	char DEPLOYMENT_PLATFORM(STRING32) ;
		DEPLOYMENT_PLATFORM:long_name = "Identifier of the deployment platform" ;
		DEPLOYMENT_PLATFORM:_FillValue = " " ;
	char DEPLOYMENT_CRUISE_ID(STRING32) ;
		DEPLOYMENT_CRUISE_ID:long_name = "Identifier of the cruise that deployed the glider" ;
		DEPLOYMENT_CRUISE_ID:_FillValue = " " ;
	char DEPLOYMENT_REFERENCE_STATION_ID(STRING256) ;
		DEPLOYMENT_REFERENCE_STATION_ID:long_name = "Identifier of stations used to verify the parameter measurements" ;
		DEPLOYMENT_REFERENCE_STATION_ID:_FillValue = " " ;
	char DEPLOYMENT_END_DATE(DATE_TIME) ;
		DEPLOYMENT_END_DATE:long_name = "Date (UTC) of the glider recovery" ;
		DEPLOYMENT_END_DATE:conventions = "YYYYMMDDHHMISS" ;
		DEPLOYMENT_END_DATE:_FillValue = " " ;
	double DEPLOYMENT_END_LATITUDE ;
		DEPLOYMENT_END_LATITUDE:long_name = "Latitude of the glider recovery" ;
		DEPLOYMENT_END_LATITUDE:units = "degree_north" ;
		DEPLOYMENT_END_LATITUDE:_FillValue = 99999. ;
		DEPLOYMENT_END_LATITUDE:valid_min = -90. ;
		DEPLOYMENT_END_LATITUDE:valid_max = 90. ;
	double DEPLOYMENT_END_LONGITUDE ;
		DEPLOYMENT_END_LONGITUDE:long_name = "Longitude of the glider recovery" ;
		DEPLOYMENT_END_LONGITUDE:units = "degree_east" ;
		DEPLOYMENT_END_LONGITUDE:_FillValue = 99999. ;
		DEPLOYMENT_END_LONGITUDE:valid_min = -180. ;
		DEPLOYMENT_END_LONGITUDE:valid_max = 180. ;
	byte DEPLOYMENT_END_QC ;
		DEPLOYMENT_END_QC:long_name = "Quality on DEPLOYMENT_END date, time and location" ;
		DEPLOYMENT_END_QC:conventions = "EGO reference table 2" ;
		DEPLOYMENT_END_QC:_FillValue = -128b ;
		DEPLOYMENT_END_QC:flag_values = 0b, 1b, 2b, 3b, 4b, 5b, 8b, 9b ;
		DEPLOYMENT_END_QC:flag_meanings = "no_qc_performed good_data probably_good_data bad_data_that_are_potentially_correctable bad_data value_changed interpolated_value missing_value" ;
	char DEPLOYMENT_END_STATUS ;
		DEPLOYMENT_END_STATUS:long_name = "Status of the end of mission of the glider" ;
		DEPLOYMENT_END_STATUS:conventions = "R: retrieved, L: lost" ;
		DEPLOYMENT_END_STATUS:_FillValue = " " ;
	char DEPLOYMENT_OPERATOR(STRING256) ;
		DEPLOYMENT_OPERATOR:long_name = "Name of the person in charge of the glider deployment" ;
		DEPLOYMENT_OPERATOR:_FillValue = " " ;
	char SENSOR(N_PARAM, STRING64) ;
		SENSOR:long_name = "List of sensors on the glider" ;
		SENSOR:conventions = "EGO reference table 3" ;
		SENSOR:_FillValue = " " ;
	char SENSOR_MAKER(N_PARAM, STRING256) ;
		SENSOR_MAKER:long_name = "Name of the sensor manufacturer" ;
		SENSOR_MAKER:_FillValue = " " ;
	char SENSOR_MODEL(N_PARAM, STRING256) ;
		SENSOR_MODEL:long_name = "Model of the sensor" ;
		SENSOR_MODEL:_FillValue = " " ;
	char SENSOR_SERIAL_NO(N_PARAM, STRING16) ;
		SENSOR_SERIAL_NO:long_name = "Serial number of the sensor" ;
		SENSOR_SERIAL_NO:_FillValue = " " ;
	char SENSOR_UNITS(N_PARAM, STRING16) ;
		SENSOR_UNITS:long_name = "Units of the parameter measured by the sensor" ;
		SENSOR_UNITS:_FillValue = " " ;
	char SENSOR_ACCURACY(N_PARAM, STRING32) ;
		SENSOR_ACCURACY:long_name = "Accuracy of the parameter measured by the sensor" ;
		SENSOR_ACCURACY:_FillValue = " " ;
	char SENSOR_RESOLUTION(N_PARAM, STRING32) ;
		SENSOR_RESOLUTION:long_name = "Resolution of the parameter measured by the sensor" ;
		SENSOR_RESOLUTION:_FillValue = " " ;
	char DERIVATION_PARAMETER(N_DERIVATION, STRING64) ;
		DERIVATION_PARAMETER:long_name = "List of parameters with derivation or calibration information" ;
		DERIVATION_PARAMETER:conventions = "EGO reference table 3" ;
		DERIVATION_PARAMETER:_FillValue = " " ;
	char DERIVATION_EQUATION(N_DERIVATION, STRING256) ;
		DERIVATION_EQUATION:long_name = "Derivation or calibration equation for this parameter" ;
		DERIVATION_EQUATION:_FillValue = " " ;
	char DERIVATION_COEFFICIENT(N_DERIVATION, STRING512) ;
		DERIVATION_COEFFICIENT:long_name = "Derivation or calibration coeffcicients for this equation" ;
		DERIVATION_COEFFICIENT:_FillValue = " " ;
	char DERIVATION_COMMENT(N_DERIVATION, STRING256) ;
		DERIVATION_COMMENT:long_name = "Comment applying to this parameter derivation or calibration" ;
		DERIVATION_COMMENT:_FillValue = " " ;
	char DERIVATION_DATE(N_DERIVATION, DATE_TIME) ;
		DERIVATION_DATE:long_name = "Date (UTC) of derivation or calibration" ;
		DERIVATION_DATE:conventions = "YYYYMMDDHHMISS" ;
		DERIVATION_DATE:_FillValue = " " ;
	char HISTORY_INSTITUTION(N_HISTORY, STRING2) ;
		HISTORY_INSTITUTION:long_name = "Institution which performed action" ;
		HISTORY_INSTITUTION:conventions = "EGO reference table 4" ;
		HISTORY_INSTITUTION:_FillValue = " " ;
	char HISTORY_STEP(N_HISTORY, STRING4) ;
		HISTORY_STEP:long_name = "Step in data processing" ;
		HISTORY_STEP:conventions = "EGO reference table 12" ;
		HISTORY_STEP:_FillValue = " " ;

// global attributes:
		:data_type = "EGO glider time-series data" ;
		:format_version = "1.2" ;
		:platform_code = "ifm10" ;
		:date_update = "2018-11-23T21:27:34Z" ;
		:wmo_platform_code = "18953" ;
		:source = "Glider observation" ;
		:data_mode = "R" ;
		:quality_index = "unknown quality" ;
		:references = "http://www.ego-network.org/" ;
		:Conventions = "CF-1.4 EGO-1.2" ;
		:netcdf_version = "4.3.3.1" ;
		:title = "ifm10 glider data on depl02 deployment" ;
		:keywords = "Turbidity, Chlorophyll, Oxygen, Water Temperature, Conductivity, Salinity" ;
		:naming_authority = "EGO" ;
		:id = "ifm10_depl02_R" ;
		:cdm_data_type = "Trajectory" ;
		:area = "Atlantic Ocean - Gulf of Guinea area" ;
		:geospatial_lat_min = "0.0091983" ;
		:geospatial_lat_max = "0.10526" ;
		:geospatial_lon_min = "-0.18269" ;
		:geospatial_lon_max = "-0.062548" ;
		:geospatial_vertical_min = "-0.47" ;
		:geospatial_vertical_max = "767.8" ;
		:time_coverage_start = "2011-05-17T16:35:55Z" ;
		:time_coverage_end = "2011-05-18T19:58:32Z" ;
		:institution = "GEOMAR" ;
		:institution_references = "http://www.geomar.de" ;
		:sdn_edmo_code = "2947" ;
		:contact = "gkrahmann@geomar.de" ;
		:author = "Corentin Guyot" ;
		:data_assembly_center = "IF" ;
		:principal_investigator = "Gerd Krahmann" ;
		:principal_investigator_email = "gkrahmann@geomar.de" ;
		:deployment_code = "depl02" ;
		:deployment_label = "ifm10_depl02" ;
		:distribution_statement = "Follows CLIVAR (Climate Varibility and Predictability) standards, cf. http://www.clivar.org/data/data_policy.php. Data available free of charge. User assumes all risk for use of data. User must display citation in any publication or product using data. User must contact PI prior to any commercial use of data." ;
		:citation = "These data were collected and made freely available by the EGO project and the national programs that contribute to it." ;
		:update_interval = "daily" ;
		:qc_manual = "http://www.coriolis.eu.org/Data-Services-Products/Documentation/QC-documentations" ;
}

I think I have solved it, at least the main core of my problem.

I used Python vtk library to generate the container (Polyline):

# Create a VTK PolyData object
polydata = vtk.vtkPolyData()
points_vtk = vtk.vtkPoints()
for point in points:  #    <---- points read from netCDF file!
    points_vtk.InsertNextPoint(point)
polydata.SetPoints(points_vtk)

# Create a VTK PolyLine object
polyline = vtk.vtkPolyLine()
polyline.GetPointIds().SetNumberOfIds(num_points)
for i in range(num_points):
    polyline.GetPointIds().SetId(i, i)

# Add the polyline to the PolyData
cells = vtk.vtkCellArray()
cells.InsertNextCell(polyline)
polydata.SetLines(cells)

And then populate it with the Trajectory values, measured along the journey, I want to display

# Add scalar values to the points
scalars_vtk = vtk.vtkFloatArray()
scalars_vtk.SetNumberOfComponents(1)
scalars_vtk.SetName("Dissolved Oxigyen")
for scalar in scalars:
    scalars_vtk.InsertNextValue(scalar)
polydata.GetPointData().SetScalars(scalars_vtk)

The result is something like this:

The next step is working on the time animation:

My strategy is that for each timestep, I could create a new vtk file in python, with increasing number of points (x,y,z, scalar). I would then read it in as a bulk, an animate. This would nicely render the spatial evolution over time, with a nice trailing effect.

1 Like