so-wise / weddell_gyre_clusters

Unsupervised classification of Weddell Gyre profiles
MIT License
2 stars 1 forks source link

Code up way to estimate temporal variability of means using profile data #56

Closed DaniJonesOcean closed 2 years ago

DaniJonesOcean commented 2 years ago

Despite the non-uniform spatial and temporal coverage, we would like a way to see how the mean properties of the classes, as estimated by the profiles, change over time. It would be nice to have a method for this, as well as a way to estimate the error associated with the lack of coverage. I'm guessing that someone, somewhere has cleverly worked this out for Argo?

DaniJonesOcean commented 2 years ago

Let's consider this in more detail. We have an xarray Dataset with the following structure:

<xarray.Dataset>
Dimensions:        (profile: 28397, depth: 21, depth_highz: 50, sig0_levs: 100, CLASS: 4)
Coordinates:
  * profile        (profile) int64 13 14 15 16 ... 142282 142301 142320 142330
    lon            (profile) float64 -26.44 -22.37 -17.38 ... 53.09 53.33 53.76
    lat            (profile) float64 -55.98 -56.81 -57.51 ... -58.46 -58.59
  * depth          (depth) float64 20.0 40.0 60.0 80.0 ... 820.0 910.0 1e+03
    time           (profile) datetime64[ns] 1973-01-11T12:00:00 ... 2020-10-1...
    year           (profile) int64 1973 1973 1973 1973 ... 2020 2020 2020 2020
    month          (profile) int64 1 1 1 1 1 1 1 1 1 1 ... 8 8 8 9 9 9 9 9 10 10
  * depth_highz    (depth_highz) float64 20.0 40.0 60.0 ... 960.0 980.0 1e+03
  * sig0_levs      (sig0_levs) float64 22.66 22.72 22.77 ... 27.86 27.91 27.97
  * CLASS          (CLASS) int64 0 1 2 3
Data variables: (12/15)
    prof_date      (profile) float64 7.206e+05 7.206e+05 ... 7.381e+05 7.381e+05
    prof_YYYYMMDD  (profile) float64 1.973e+07 1.973e+07 ... 2.02e+07 2.02e+07
    prof_HHMMSS    (profile) float64 1.2e+05 1.2e+05 ... 4.45e+04 5.19e+04
    prof_T         (profile, depth) float64 -0.1995 -0.878 ... 1.536 1.466
    prof_S         (profile, depth) float64 33.42 33.66 34.03 ... 34.73 34.73
    sig0           (profile, depth) float64 26.84 27.07 27.39 ... 27.8 27.8
    ...             ...
    sa_on_highz    (profile, depth_highz) float64 ...
    sig0_on_highz  (profile, depth_highz) float64 ...
    ct_on_sig0     (profile, sig0_levs) float64 ...
    sa_on_sig0     (profile, sig0_levs) float64 ...
    label          (profile) int64 3 2 0 2 2 1 3 1 3 2 2 ... 0 0 0 0 0 0 0 0 0 0
    posteriors     (profile, CLASS) float64 4.692e-27 6.154e-26 ... 7.129e-10

Now, we would like to estimate the statistics (not just the mean value) for each depth level, grouped by year and class label. That should be relatively straightforward using xarray. Next, we have to decide how to plot/display that variability. First, I'd just like to look at the statistics of each year, so let's get plotting.

DaniJonesOcean commented 2 years ago

Okay! I've coded up some functions and scripts to generate animated GIFs from my profile plots grouped by year and label/class. Here's one for example:

weddell_gyre_CT copy

These are all of the profiles that have been grouped into the "central Weddell Gyre" class (top 1000 m).

DaniJonesOcean commented 2 years ago

A couple things to note:

What is it that we want to track with time? What are we looking for? The depth of the temperature minimum? The value of the temperature minimum? We could estimate that over time as a reasonable time series. Should we:

Lots of lovely statistical fun to be had...

DaniJonesOcean commented 2 years ago

weddell_gyre_SA

DaniJonesOcean commented 2 years ago

weddell_gyre_sig0

DaniJonesOcean commented 2 years ago

weddell_gyre_CTsig

DaniJonesOcean commented 2 years ago

weddell_gyre_SAsig

DaniJonesOcean commented 2 years ago

Okay! This part is done. Will continue to use time-varying information, but in other issues.