Field-Robotics-Lab / glider_hybrid_whoi

(Hybrid-) AUG Simulator
8 stars 9 forks source link

Stratified ocean current with Kolumbo data #17

Closed woensug-choi closed 3 years ago

woensug-choi commented 3 years ago

Todo

greg-burgess commented 3 years ago

My goal right now is to produce the following data for each kolumbo dive respectively. Let me know what you think and if any additions would be helpful.

Time, X position in LMC, Y position in LMC, z (depth in meters), Ocean Current Vector Experienced by vehicle at that instant in the NED (global) frame.

woensug-choi commented 3 years ago

Good :)

Database input file format example: https://github.com/Field-Robotics-Lab/dave/blob/master/uuv_dave/worlds/transientOceanCurrentDatabase.csv

woensug-choi commented 3 years ago

@greg-burgess Any updates? Maybe you have uploaded it on Dropbox already.

greg-burgess commented 3 years ago

Just uploaded full ocean current data sets as well as time-averaged ocean current data sets for four respective dives from the Kolumbo expedition. Dives are labeled dive a, dive e, dive f, dive g respectively.

The location in the dropbox is EPIC-DAUG-->data-->kolumbo_data-->ocean_currents There is a README file in the folder that should explain the datasets in more detail. Please let me know if you have any questions or think we need anything else.

Some of data may need linear interpolation between depth bins, etc. since it is for the most part raw data. Should not be too much trouble though.

woensug-choi commented 3 years ago

Thank you! I will include the data into the simulator right after its update. The next update of the Dave simulator will change how to designate file paths of the ocean current data. Hopefully before the next meeting.

woensug-choi commented 3 years ago

I Will work on it right after the merge of https://github.com/Field-Robotics-Lab/dave/pull/95

woensug-choi commented 3 years ago

@greg-burgess I see some empty rows in the CSV file. Is this correct? The simulator will interpolate for missing data. It wouldn't be a problem. Looking at the data it fluctuates a lot. Would it be appropriate to generate a trendline using the mean average as an input for the simulator and give noise to it (The ocean current plugin can add noise using the Gauss-Markov model; Model definition, and Example )? Could you consult Rich on this subject? If so, could you generate a trendline and make a dataset with something like a 5 m depth increment?

woensug-choi commented 3 years ago

I've added a Matlab script to calculate the moving average. It's at EPIC-DAUG-->data-->kolumbo_data-->movingAverage.m

image

woensug-choi commented 3 years ago

@greg-burgess Sorry that I gave you a tough task. I was going to design a template plugin to apply tidal oscillations. On the way, I had to have some sense of the input variables we are going to put in. I tried some simple approximations with various methods (sine, summations of sine waves, multiplications of sine waves, etc.) and I realized it's very difficult to model with a simple sine wave as I assumed. I tried using the codes Rich has shared, but without any success (Mainly due to limited understanding of the characteristics of tidal currents and difficulties to understand the codes). I felt bad asking you to provide me inputs as if it's a tedious task. Which is not.

On the way, I've found a way to do this somehow. Using the annual prediction data from NOAA website (https://tidesandcurrents.noaa.gov/noaacurrents/Annual?id=ACT1951_1), the Matlab spline fitting function gave me satisfactory results. image Left: Annual, Right, close-up

After seeing the possibility at the Matlab, I've tried to do the same thing in the dave environment and got the following results. image Left: 3 years, Middle: 2nd year close up, Right: more close-up The last results are obtained using the generic interpolation function of the boost 1.65 library which is included in the gazebo. For the input database, the interpolating performance is only good in the middle. I had to stack the database of the previous and next year to obtain satisfactory results for the target year. I think this will do for now. It does not require any inputs, it only requires stacked annual data downloaded (CSV, cm/sec, 24-hour units format).

I shall now move on to design the plugin...

woensug-choi commented 3 years ago

@greg-burgess I am about 80% through developing a plugin. Currently, it's going to use two input database files.

1. Single-dimension stratified ocean current (depth vs velocity) to express amplitude ratio image

2. NOAA Annual prediction data (Previous comment)

It would work like this.

  1. Give a simulator a starting wall clock time.
  2. Simulator will interpolate NOAA data and figure out tidal ocean current velocity and direction
    • Direction is defined with two constant variables; Mean ebb direction, Mean flood direction.
  3. Apply stratified current using depth vs velocity ratio to tidal ocean current velocity using the vehicle depth

A problem in that procedure is that the NOAA data doesn't tell which depth the data is from. I will write the code as if it's the surface current for now.

Any thoughts?

greg-burgess commented 3 years ago

Woensug,

Sorry for the delayed response, with classes back in swing, this week has been very busy. I agree, it was a more challenging than I thought to model the tidal variation in a simple fashion.

However, Rich showed me a great resource that really helped me understand how to model tidal height and subsequently tidal currents in an oceanographic sense (I recommend checking gout the intro section as well as Section 3 specifically pg 92-95). https://tidesandcurrents.noaa.gov/publications/Tidal_Analysis_and_Predictions.pdf

Our thought was to use only one input database file formatted as such z-----u [m/s]-----v[m/s] z1----u[m/s]-----v[m/s]...etc z2---

This would serve as the "initialization."

Tidal Height variation can be calculated using the harmonic constituents based on the NOAA location (see below) image https://tidesandcurrents.noaa.gov/harcon.html?unit=0&timezone=0&id=8447685&name=Chappaquoit+Point&state=MA

To approximate current, we can assume that current is 90 deg out of phase with tidal height. I agree that direction should be defined with the two constant variables(Mean ebb direction and Mean flood Direction)

I'll email you separately a jupyter notebook file in python that demonstrates the harmonic constituent modeling I was mentioning.

I think the best solution is somewhere in between our two proposed methods. I think estimating the tidal ocean currents via harmonic constituent equations might be more accurate than the fitting techniques available in Gazebo. I do like the idea of the Single-dimension stratified ocean current (depth vs velocity) to express amplitude ratio I think that's a good way to model variation across depth.

Thanks for all the work you've been putting in. Please let me know what you're thinking/where you're at.

woensug-choi commented 3 years ago

@greg-burgess Thank you for the deep thoughts and scripts (mail received). I was preparing with a more straightforward way than interpolation for the first commit; a table lookup. I will wrap up the plugin with the table lookup first and adopt the harmonic constituents as another option to define the ocean currents. I will try it first thing next week. By the way, do you know the due dates for the progress reports?

woensug-choi commented 3 years ago

@greg-burgess The figure below is the plot comparing with the NOAA Annual data (black circles). The X-axis is in GMT time format. The harmonic model does predict the shifts well (red lines) with the first three constituents. However, its amplitudes of the wave envelope do not match. The table lookup (black line) does what it does.

Any ideas to improve the accuracy of the harmonic model? Should I have added some x-intercepts at the GMT timeframe to shift the x-axis for the model? I see that you were working on a comparison at the end of the notebook. You may try mine at the MATLAB window left open at the workstation to generate this figure. image

woensug-choi commented 3 years ago

Closing this issue, since our first agreements on the modeling are included in the PR. Please bring another issue if needed for enhancements.