## 2011-11-29

### long term monthly mean over 100 years

MS Excel is one of the most popular spreadsheet programs in the world. It is possible to write nice macros in VBA, it is handy and mostly meet a usual user needs. For me it is very convenient data storage type - but when it comes to work with large data I prefer writing macros or using external modifying. And here comes Python, again. Ok, the problem:
I have an excel document with data in one sheet, ~19 columns and daily measurements for 100 year period ~34000 rows. The A column contains date, other 19 columns counting from B - values/measurements. And I need to calculate firstly the long term monthly mean normal values for each column (resulting 12 values for each month) and secondly - percentiles over these 19 columns.
The reading from excel is done using XLRD package and percentile calculating - using scipy stats . These two libraries should be installed additionally to run my class.
The created class is so-so complete with a lot of space for possible improvements; currently it met my needs and I`m ok with that.
The feeling of satisfaction after doing such work manually in excel or creating script is completely different, and in the latter case it`s more positive.
This class is free to use, but if you are using this class, please, make the reference to me and let me know about the project where it has been used.

## 2011-11-25

### for loop differences in vb and python

Where is the difference between this and this code? The function should be the same. But the difference is inside the loop region. In the VB code the loop is written as

For I = 1 To 15

but in python -

for i in range(0, 15):

## 2011-11-24

### Find the treasure

My girlfriend is making  treasure lists all the time in the etsy.com, art shop. I made a treasure hunting game... in the Python, as the third step learning it.
The aim is to get the treasure with no going on the same cells second time. There are three intuitive parts how this game is structured. The first part is - to generate the 2D grid and put the player and the treasure somewhere on it. And here comes the first "but" - as the placements are generated randomly, it is possible, that as game starts, it ends because of possibility that the start locations of the treasure and the player are identical. To avoid it, the coordinates has to be checked, and if they are identical, the player placement is regenerated and again checked in while loop.
The next part is - moves. As the grid is discrete with it`s borders, the player generated moves has to be verified - are they allowed. There are four possible movements - wasd - and each are verified.
And the last part is to verify does the player get the treasure or - are the coordinates not used before.

Check the source code here

### second steps programming in python

The key to the success is the idea. And the key to the knowledge is to practice.
Firstly, I started with objects in PHP, then tried to do some work in VB2010 (i hope soon, till the end of the year there will be the result - groundwater and runoff modelling software METQ-UL aka MetCool) and today I tried to refresh my Py-mories... All day long tried to transfer VB code into the Python, but it seems that I`ve some small problems somewhere.
Another thing about Python - I didn`t find a way how to change values inside in method... as example if I have a method in class which does something, like

def f(self,a,b)
a=a**2
b=b**b
return a

and in the same time i need to return value b, I have to make a list or dictionary, like
def f(self,a,b)
a=a**2
b=b**b
D=dict(a=a,b=b)
return D

In such case it is much more unhandy as it was in VB or Fortran, like

Sub f(ByRef dim a as integer, ByRef dim b as integer)
..
End sub

The difference is when such sub (function/subroutine) has to be called, the syntax is simple in the VB/Fortran

a=2
b=3
call f(a,b)
print.debug a,b
//returns 4 and 27

without neccesity to "extract" the modified value from function
unlike the other languages, where it has to be some object or variable which will have the modified values..
in the case of python -

//example when function are inside and are called from the class
a=2
b=3
dictionary = self.f(a,b)
print a,b //return 2,3
a=dictionary['a']
b=dictionary['b']
print a,b //return 4, 27

### python lists and dictionaries

This one is specially for those, who mostly are programming in such languages, where the term "associative array" (like PHP) is used.
Python list, as I now understand, is a 1 dimensional unassociative array where each element has its own key mostly with ascending integer.
And the python dictionary is a 1 dimensional associative array where the key for each element can be ... string.

## 2011-11-16

### 2012 image

Are you ready for twenty twelve?

## 2011-11-10

### How to get raster values under the vector points in GRASS GIS

Short video tutorial how to update vector points with raster values which underlies where the given vector are.

### Importing XYZ points in the GRASS GIS

Short video tutorial how to create vector point file in the GRASS GIS if you have only x,y and any additional value.

### Presentation of Baltic arthesian basin version V1

Today I had an opportunity to present my research results in this presentation. And additionally the local television company LNT took an interview. Of course, emotions are wide enough, as it was my first time to speak on such high class auditory. (After the presentation I loose my focus and... here comes the TV...).

The aim of this project is to develop the human resources which would be able to solve fundamental and practical scientific problems related to groundwater characteristics and resources.

The main result is the integrated mathematical model system which allows quantitatively and qualitatively modelling groundwater

Additionally the impact of climate change on groundwaters has been studied allowing to estimate and predict possible danger of climate change.
And this last topic is where I am personally interested in and working with.
Currently the observations has been summarized and one freely chosen climate model projection used to characterize the future period.