gher-uliege / DIVAnd.jl

DIVAnd performs an n-dimensional variational analysis of arbitrarily located observations
GNU General Public License v2.0
70 stars 11 forks source link

Diva2d? #133

Closed ChrisC28 closed 9 months ago

ChrisC28 commented 1 year ago

Hi Diva team,

Firstly, thanks so much for making DIVAnd open and available, and for all the time you take to help users. It's an extremely valuable service to the community.

This "feature request" may more related to my mis-understanding of how DIVAndrun manages time as a dimension (I'm new to both DIVA and Julia). As such, any help would be appreciated.

My team and I are using DIVAnd to develop an ocean climatology around Australia. For a number of reasons, I'm constructing this climatology as a series of 2D slices at different depths. Up until now, I've followed the tutorial, which uses diva3d to performing the interpolation. However, I'm unsure how to adapt this for 2 dimensional (spatial) analysis, mostly because I'm unsure how to deal with time.

As far as I can tell, diva3d is a (sophisticated) wrapper to DIVAndrun. In the above tutorial, time, the time of the observations is a vector of DataTime, while the "interpolated" time is handled by a TimeSelectorYearListMonthList object.

Although I deleved into the code, I can't quite understand how diva3d converts TimeSelectorYearListMonthList into something that can be handled by DIVAndrun. Some of the questions I have are:

Put another way, how would one create a diva2d? Or how do I correctly include time a call to DIVAndrun? This is probably relatively straightforward, but I'm still struggling a bit conceptually.

Thanks for any help!

jmbeckers commented 1 year ago

Indeed, diva3d is a wrapper around DIVAndrun, designed for a specific project: The dealing with the time dimensions in diva3d has its origin in the way some EU projects had planned to create climatologies: Data for different periods where binned together and analyzed on a 3D grid (x,y,z). The regularity/correlation over time was then controlled by the time window sizes.

For your case, can you clarify what are the two dimensions you speak about? (x,y), or (s,z) where s is a position along a transect for example ?

ChrisC28 commented 1 year ago

Hi @jmbeckers , thanks for the very rapid response.

In my case, the two spatial dimensions are (x,y) (essentially on a slice of constant depth).

I actually appreciate TimeSelectorYearListMonthList infrastructure, as it makes it easy to choose how the climatology will be constructed temporally. I'm just not sure how that works with DIVAndrun.

I'm happy to create a PR for a diva2d-like wrapper if I can get some guidance on how to deal with time.

jmbeckers commented 1 year ago

If you want an (x,y) analysis at one or a few selected depth (without taking into account vertical correlations), I think you can use diva3d and just specify the layer depth you are interested in (or if you have several uncorrelated slices at different depth, force LZ=0 to have the same results as running several 2D analysis, as long as there is enough memory available). For the TimeSelectorYearListMonthList infrastructure, hopefully @ctroupin remembers if and where some detailed documentation can be found ...

ctroupin commented 1 year ago

Hi Chris, for more detailed explanations about TimeSelectorYearListMonthList

you can maybe check the notebook here: https://github.com/gher-uliege/Diva-Workshops/blob/master/notebooks/5-AdvancedTopics/18-defining-time-periods.ipynb

it gives a few examples. If I'm not wrong TimeSelectorYearListMonthList is used in diva3d but not in DIVAndrun.

jmbeckers commented 1 year ago

If I'm not wrong TimeSelectorYearListMonthList is used in diva3d but not in DIVAndrun

Indeed, DIVAndrun is agnostic about dimensions and units, whereas diva3d needs to be feeded with specific coordinates. So TimeSelectorYearListMonthList is used only in the diva3d wrapper around DIVAndrun.

ctroupin commented 1 year ago

Hello @ChrisC28, do you still need some help or documentation, or shall we close the issue?

Thanks!