Thursday, November 22, 2012
Tuesday, July 17, 2012
Drawing in Latex
Here are some pictures I have created using LaTex and TikZ.
The code TEX used for generation of the images is shown below:
Figure 1 |
Figure 2 |
The code TEX used for generation of the images is shown below:
Sunday, July 15, 2012
Gradient of scalar product or divergence of a tensor.
When you read a scientific work with equations there could be surprises and confusion
even in the notation. Here I want to speak about the one I encountered recently, when
looking at the Navier-Stokes equation.
First I thought, the result of the operation should be a vector since it appears as a
term in a vectorial equation so it was natural for me to consider it as a gradient of a
scalar product of two vectors. Then I started remembering the formula for the gradient
of a scalar product.
Here the star represents the vector on which the nabla operator acts. Those could
be expressed as follows( (*,*) - scalar product, [*,*] - vector product ):
and swapping a and b we also get
Then combining the last 3 equations we get:
Which differs from the first equation.
Then It came to me that the term
is a flux of a momentum, that is a flux of a
vector quantity. This means that each coordinate of the quantity should be multiplied
by each coordinate of the velocity, which gives us the following tensor:
Then each component of the divergence D of the flux will have the following form
which is equivalent to
Which, I suppose, is exactly what the author had in mind.
Friday, January 6, 2012
Summation along a dimension
Suppose you have a netcdf file with temporal data of say evaporation (in meters).
And you want to know how much water evaporates during a year. And also you do not want to loose
time writing a program for this. Fortunately we have NCO.
I did the procedure for the ERA-Interim reanalysis file downloaded from the ECMWF site. I picked the year 1985.
The header of the file looks like this:
Here is the description of the procedure that I used:
Here is the description of the procedure that I used:
-
Calculate the mean of the variable along the specified dimension (time in my case).
~# ncra -d time,0,729 -v e evap-1985.nc mean_evap_1985.nc
Here I was not sure whether I should take care of the scale_factor and add_offset. The answer is no, because nco takes care of it for you. -
Then, since sum = mean * ntimes, I use the mean to get the sum. Minus is because of the model convention, they consider
the flux negative if it is upwards.
~# ncap -O -s "e=-730*e" mean_evap_1985.nc sum_evap_1985.nc
- So we have our resulting field in the file sum_evap_1985.nc, which can be viewed using ncview.
The field looks as shown below. I do not know how to save the legend in ncview, so the figure is not very informative.
The result corresponds to the means given by ECMWF: E-P and P.
Wednesday, January 4, 2012
ECMWF variables description
The table of variable names and units in the ECMWF files:
http://www.ecmwf.int/publications/manuals/d/gribapi/param/
Subscribe to:
Posts (Atom)