[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #YGN-366139]: quesiton on interpolation of asynchronous temporal sensor data



Hi Paul,

> forgive me for the dumb question, but I am pretty new to NetCDF / NCO
> and I am banging my head trying to make this work 'out of the box'.  I
> have a lot of marine sensor data to process, which is all in netcdf v3
> format (CF 1.6 convention), but the essence of my question is below.
> 
> I have 2 sensors, a GPS and a Gyro:
> 
> *The GPS data is in a 'position.nc' file and has 1 Hz data,
> *The Gyro data is in a 'azimuth.nc' file and has 2Hz data, but the
> timestamps are not necessarily the same as the GPS (ie they are
> asynchronous), ie Ta, Tb, Tc
> 
> My question is "How can I compute the azimuth from the azimuth.nc file
> for the timestamps in the position.nc file and drop them into a new
> variable in the position.nc file?"
> 
> a sample azimuth file...
> netcdf AzimuthTrue {
> dimensions:
> time = UNLIMITED ; // (10 currently)
> variables:
> double time(time) ;
> time:units = "seconds since 1970-01-01 00:00:00" ;
> time:standard_name = "time" ;
> double azimuth(time) ;
> azimuth:units = "degrees" ;
> azimuth:long_name = "azimuth" ;
> data:
> time = 1.1, 1.6, 2.1, 2.6, 3.1, 3.6, 4.1, 4.6, 5.1, 5.6, 6.1, 6.6, 7.1, 7.6, 
> 8.1, 8.6, 9.1, 9.6, 10.1, 10.6;
> azimuth = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 
> 20;
> }
> 
> and a corresponding position file...
> 
> netcdf Position {
> dimensions:
> time = UNLIMITED ; // (5 currently)
> variables:
> double time(time) ;
> time:units = "seconds since 1970-01-01 00:00:00" ;
> time:standard_name = "time" ;
> double latitude(time) ;
> latitude:units = "degrees" ;
> latitude:long_name = "latitude" ;
> double longitude(time) ;
> longitude:units = "degrees" ;
> longitude:long_name = "longitude" ;
> data:
> time = 1, 2, 3, 4, 5;
> latitude = -31, -32, -33, -34, -35;
> longitude = 114, 115, 116, 117, 118;
> }
> 
> As you can see, both have a record variable of time, but they are
> asynchronous.  This is due to the hardware outputting raw data at
> different rates.  Unfortunately, this cannot be changed, so I was hoping
> to align all the data once it is in NetCDF file format.
> 
> In this simple example, I would hope to merge the azimuth into the
> position.nc file, and compute a valid azimuth for time== 1,2,3...
> 
> Is this feasible with existing tools, or do I need to write some
> software to index, then lookup a given variable (azimuth in this case)
> and with something like
> 
> double valueAt(time, variablename)
> {
> //interpolate across the requested vector to compute a value for the specific 
> time
> }

There are third-party freely available software packages that provide 
interpolation
of netCDF data.  If you search for "interp" in "Software for Manipulating or 
Displaying NetCDF Data" at

  http://www.unidata.ucar.edu/netcdf/software.html

you'll find descriptions and links to packages such as CDO, Fimex, NCL, and NCO 
that
each support this capability.  The netCDF library just does I/O, without 
providing 
any built-in interpolation or other analysis capabilities ...

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: YGN-366139
Department: Support netCDF
Priority: Normal
Status: Closed