Skip to main content

Posts

Showing posts from January, 2016

IDL programming: control variables in IDL across routines

IDL, unlike C++, has its own approach and principle when handling variables across routines. These features are often very different with the variable scope within C++.
I will try to answer several key questions and prove them using simple demos.
Question 1: Will the value of a variable be changed after it’s passed into a function and changed inside?
Demo:
;;.....................................................................................
PRO variable_change
a=1.0
b=2.0
PRINT,'Before the operation, a is ',a
c=plus(a,b)
PRINT,'After the operation, a is ',a
END
FUNCTION plus,a,b
a=a+b
RETURN,a
END
And the IDL Console output:
Before the operation, a is 1.00000
After the operation, a is 3.00000
;;.....................................................................................
Conclusion:
If the value of a variable has been changed inside a routine, it will remains changed outside. Question 2: What if this variable is not even passed into any routine, but the routine has a variable wh…

Integrated groundwater and surface water modeling: the appropriate way to prepare the best DEM

One the most important inputs for groundwater and surface water hydrology modeling is the Digital Elevation Model (DEM).

Though DEM can be obtained through many approaches, the final DEM varies significantly. Therefore, DEM can seldom  be directly used in most modeling work. Instead, we often need to adjust the DEM so that it can meet the requirements of the hydrology modeling.

The adjustment, however, often involves series of operations. These operations can be carried out using different approaches in different orders. The result could be quite different. The important part is that most of them are unusable. So the question is, what is most promising way to prepare the DEM?

Here I have provided an example work flow, which may be suitable for most tasks. Then I will explain in details the purpose of this step and what tools we can make use of. In the end I will discuss why it should be done in this order.
Download the DEM datasets of the same format for the study area;Mosaic these DEM…