diff --git a/Common/write_eddy.f90 b/Common/write_eddy.f90 index 22fa2ff7468aa182d1162b762d0a097a1468cbb1..aa4263a7698942138ceb02ebf19fd2a2e756863f 100644 --- a/Common/write_eddy.f90 +++ b/Common/write_eddy.f90 @@ -71,8 +71,7 @@ contains call dbf_write_attribute_03(hshp%outermost, ishape, hshp%out_ssh, & e%out_cont%ssh) call dbf_write_attribute_03(hshp%outermost, ishape, hshp%out_date, date) - call dbf_write_attribute_03(hshp%outermost, ishape, hshp%out_eddy_index, & - i) + call dbf_write_attribute_03(hshp%outermost, ishape, hshp%out_eddy_index, i) call dbf_write_attribute_03(hshp%outermost, ishape, hshp%out_radius4, & e%radius4) diff --git a/Convert_Matlab/Documentation_texfol/documentation.tex b/Convert_Matlab/Documentation_texfol/documentation.tex index 4cd6b63958e4c43f9fc1b64b93790f1f25526e40..c18f3f90803cd7de77f4f575fec2bbe8b198c35c 100644 --- a/Convert_Matlab/Documentation_texfol/documentation.tex +++ b/Convert_Matlab/Documentation_texfol/documentation.tex @@ -1,4 +1,4 @@ -\documentclass[a4paper,french]{article} +\documentclass[a4paper,english]{article} \usepackage[utf8]{inputenc} @@ -35,10 +35,12 @@ \section{Identification of instantaneous eddies} \label{sec:identification} -$e_\mathrm{max}(k)$ is stored in Matlab variables Nanti and Ncyclo. +For the definition of eddy index $e$, $e_\mathrm{max}$, $E$ and the +node index, see the documentation of the program \verb+inst_eddies+. -In the Matlab program, the node index $n'$ is different than in the -Fortran program: +In the Matlab program, $e_\mathrm{max}$ for each date is stored in +Matlab variables Nanti and Ncyclo. The node index $n'$ is different +than in the Fortran program: \begin{equation*} n' = k' E + e \end{equation*} @@ -49,22 +51,29 @@ dates. \begin{equation*} k' = \left \lfloor \frac{n' - 1}{E} \right \rfloor \end{equation*} -The suite of processed dates (in the Matlab date format) is stored in -the array \verb+date_num+. From $n'$ we can compute $k'$ and $e$, and -then the date $d$ from \verb+date_num[k']+, without any search. But -the reverse conversion needs a search: from $d$ and $e$, we need to -search \verb+date_num+ to get $k'$, then $n'$. - -Let $d_\mathrm{init}$ be the value of $d$ for the first date of the +The suite of processed dates is stored in the array \verb+date_num+ +(in the Matlab date format). From $n'$ we can compute $k'$ and $e$, +and then the date from \verb+date_num[k']+, without any search. But +the reverse conversion needs a search: from the date and $e$, we need +to search \verb+date_num+ to get $k'$, then $n'$. + +For a given date, let $d$ be the corresponding number of days since +1950-1-1. Let $d_\mathrm{init}$ be the value of $d$ for the first date of the dataset. To convert from $n'$ to the node index $n$ of the Fortran -convention, we note that: +convention, we compute: \begin{equation*} - k := d - d_\mathrm{init} = \mathtt{date\_num[k']} - \mathtt{date\_num[0]} + d = \mathtt{to\_days\_1950}(\mathtt{date\_num[k']}) \end{equation*} and we can choose: \begin{equation*} - n = n' + (k - k') E + n = n' + (d - k') E \end{equation*} +Equivalently, we can write: +\begin{align*} + d - k' & = d - d_\mathrm{init} + d_\mathrm{init} - k' \\ + & = \mathtt{date\_num[k']} - \mathtt{date\_num[0]} + d_\mathrm{init} - k' +\end{align*} +which avoids a call to \verb+to_days_1950+. \section{Instantaneous eddies} diff --git a/Convert_Matlab/inst_eddies_v6.py b/Convert_Matlab/inst_eddies_v6.py index ee5731035a891820ec76406d04a4f6dce34c0836..a85588cfce42a2fe4732b4c1bd3caa30511266ae 100755 --- a/Convert_Matlab/inst_eddies_v6.py +++ b/Convert_Matlab/inst_eddies_v6.py @@ -136,7 +136,7 @@ d = my_date - datetime.date(1950, 1, 1) d = d.days if len(sys.argv) == 3: - final_date = parser.parse(sys.argv[2], yearfirst=True, dayfirst = False)\ + final_date = parser.parse(sys.argv[2], yearfirst = True, dayfirst = False)\ .date() else: final_date = my_date diff --git a/Inst_eddies/Analysis/plot_eddy_contours.py b/Inst_eddies/Analysis/plot_eddy_contours.py index 5962b7bd4d45f8e3294d1c845cd3cdb9c955cf34..7be6ee576e38d8a93751c917754df23b0224552a 100755 --- a/Inst_eddies/Analysis/plot_eddy_contours.py +++ b/Inst_eddies/Analysis/plot_eddy_contours.py @@ -147,8 +147,7 @@ if __name__ == "__main__": import netCDF4 parser = argparse.ArgumentParser() - parser.add_argument("-d", "--date", type = int, - help = "date, as days since 1950-1-1") + parser.add_argument("-d", "--date", type = int, help = "date index") parser.add_argument("-g", "--grid", help = "plot grid", action = "store_true") parser.add_argument("-w", "--window", help = "choose a limited plot window", diff --git a/Inst_eddies/Documentation_texfol/documentation.tex b/Inst_eddies/Documentation_texfol/documentation.tex index fd0adb27c6c91f4fdc5aab77bdf977a7b1cef52f..7c38a40b5d2f83dfbebfab9c519949da72bf2b0a 100644 --- a/Inst_eddies/Documentation_texfol/documentation.tex +++ b/Inst_eddies/Documentation_texfol/documentation.tex @@ -229,7 +229,7 @@ read shapefiles: dbfinfo, shpinfo, dbfdump and shpdump (analogous to ncdump for NetCDF files). If you have a Linux Debian-type distribution (Ubuntu, LinuxMint etc.), you can install these tools with: \begin{verbatim} -sudo apt-get install shapelib +sudo apt install shapelib \end{verbatim} The tools are available on Ciclad. You can also access the shapefiles programmatically with a number of computer languages. From Python, one