miniufo / GeoApps

Geophysical applications based on Python (xarray and xgcm)
4 stars 2 forks source link

Reference to your repository #1

Open kuchaale opened 2 years ago

kuchaale commented 2 years ago

Do you plan to assign a DOI number using Zenodo or add a CITATION file to your amazing repository?

miniufo commented 2 years ago

Hi, thanks for your interests in this repo. Actually, this is a temporally repo and I am trying to separate some parts of the code into standalone packages. This relies on some basic tools (e.g., xarray, xmitgcm, xgcm, xgrads, xvortices...) that I am still working on.

Do you have any suggestion or which part of codes you would like to be a standalone package?

I haven't assigned DOI to any of my repo. Does this help in some way?

kuchaale commented 2 years ago

I am especially interested in the Contour analysis and effective diffusivity part.

miniufo commented 2 years ago

Well, that's my favourite part too. Actually, I am a huge fan of N. Nakamura who devised the theory for contour analysis. Maybe you are interested in my recent work that uses this theory for studying internal wave breaking and associated mixing enhancement in the ocean (here is an animation).

So I am making the contour analysis part code flexible so that it is applicable to the horizontal case (x-y 2D) and the vertical case (x-z 2D). Maybe a 3D case in the future. I think I can start building a standalone package named xcontour or xEffectiveDiffusivity (any suggestion?) and write some docs or notebooks. Maybe you can teach me how to assign a DOI after that.

kuchaale commented 2 years ago

I would be in favour of xEffectiveDiffusivity. xcontour may confuse in terms of plotting. How long would it take you to establish a standalone package? Please follow the links above to assign a DOI. It is not really difficult.

miniufo commented 2 years ago

I have made a standalone package at here. I chose the name xcontour because the whole package could do more calculations than Nakamura's effective diffusivity alone. Also, I get a DOI for that too. I will add more functionalities to xcontour if once I know how to do them.

Please have a try on xcontour if you are interested in. Thanks very much.

kuchaale commented 2 years ago

Nice work on xcontour. Can you point me to the DOI, please?

One comment though: do you know why there are different results compared to GeoApps.

Compare GeoApps image with xcontour image

Here is a gist documenting the differences. I also run into differences in the case of my input data. Thanks for your answer.

miniufo commented 2 years ago

Hi, the DOI is on the README page of xcontour.

I've refactored a lot of the internal of xcontour since GeoApps was created. Including implementations of both xarray's broadcast way (4D+contour dimensions, which is memory consuming) and xhistogram's binning (memory efficient but not multidimensional friendly). Also, how to deal with boundary condition in contour-space is a problem that I am not sure which is the best way (differences are obvious near the poles). So some schemes (possibly interpolation, finite difference at boundaries) may change slightly in xcontour compared to GeoApps.

I take a quick look at your gist. I think you forgot to interpolate the results from contour-space to equivalent-latitude space. You may see that there are differences between the two plots in this notebook.

kuchaale commented 2 years ago

Hi, the DOI is on the README page of xcontour.

Thanks.

I've refactored a lot of the internal of xcontour since GeoApps was created. Including implementations of both xarray's broadcast way (4D+contour dimensions, which is memory consuming) and xhistogram's binning (memory efficient but not multidimensional friendly). Also, how to deal with boundary condition in contour-space is a problem that I am not sure which is the best way (differences are obvious near the poles). So some schemes (possibly interpolation, finite difference at boundaries) may change slightly in xcontour compared to GeoApps.

I take a quick look at your gist. I think you forgot to interpolate the results from contour-space to equivalent-latitude space. You may see that there are differences between the two plots in this notebook.

I would say that the differences are not coming from the interpolation. That's why I shared the differences in the contour-space. The differences may stem from Leq2 (see below). image

miniufo commented 2 years ago

Well, I understand better now. I did not check into these details. But it looks a slightly shift in contour space. I guess it may caused by conditional integration within contour, differed by q>q or q>=q (or the less-than case). You may try lt = True or lt = False to see if this difference could be further reduced.

Do you think these differences affect your analysis? There are some inevitable uncertainties in this calculation. For example, the minimum tracer value does not correspond to minimum area (zero) but a single grid-box area. This also indicates that minimum tracer does not correspond exactly the pole. This slightly modification of boundary conditions would somehow lead to a overall shift of the signal.

miniufo commented 2 years ago

I also forgot to mention that Leq is areal integral of squared tracer gradient, which is also not well defined at the pole (centered finite difference fashion). I remember that I switch several BCs at the pole for squared tracer gradient.