Friday, February 25, 2011

ArcGIS tip-- joins and relates

Joins and relates are a way for you to add data to an already existing feature class file. For example, you might have a polygon that you want to assign the value of 100 to... or you might have points that represent the location of birds, and you want to give the number of birds.

How to do this?
First you are going to want to put the information you want to assign into an Excel file as a column vector.
Next to that vector, you want to replicate at least one vector from your pre-existing Feature class file:

See the column I wanted to add (above) is "prod" and one line of information from my feature class (already on the map) is "OBJECTID_1".  It's crucial you title this column EXACTLY THE SAME as the column in your data. It makes it easier. Sometimes it will work if different, but this helps me stay organized.

Now in Arc, right click on your feature and you'll get a pop up window for "joins and relates"

You can either use a join or a relate. Joins are more permenant; relates sometimes go away. But joins are more taxing on the computer and relates are not. So my advise is-- use relates to figure out what you want, and then join.

So in the first blank (not the drop down, but the number 1) you will choose your pre-existing feature class on your map.  In the second one, navigate to your excel file.
REMEMBER 2 things: Arc hates finding things that it is not "connected to"- connect to that drive, at least, using ArcCatalog. Arc likes Excel files more than CSV's or TXT. Titles make Arc happy! So .xlsx WITH TITLES is the way to go.

In the third blank, choose the OBJECT ID or other column that you named the same as the column in the map. OK will light up.

Now wait and pray.


OKAY! There's your data, imported, maybe labeled if you want. That's the end!

Saturday, February 19, 2011

Model Results kinda

Well, so I made some major tweaks to the model. The boss had some good ideas that I implemented, and as it turns out, she was mostly right.

I omitted a good bit of tree competition stuff and focused more on using the slope gradient to drive the biomass. Actually it came out nicely.
I realized a big flaw with the model is that I have no way of deleting dead trees once they have turned back into soil. I may leave this flaw in the model because I think it is curious; it may be able to be used in some way to back out atmospheric deposition (since carbon is entering the system with each time step). Maybe not. I'm not sure. But it would be cool to think about it, and at least I can ask the prof or show that I noticed this myself!

Here's a nice picture from some of the results

I know you are probably thinking--- your fits suck! But actually, KS test says otherwise. Oh, statistical slam my friends! Now it isn't a GREAT fit, but it is a fit. 0.08.... barely above that I don't fit line. Imagine what would happen if I got rid of that tail. I should work on that...but not now. Too many things to do.
Tomorrow I must go to HJ. Should be fun. Tonight I must go relax, print articles, maybe walk, rent a film, etc. oh no. :)

Friday, February 18, 2011

As I promised

Well,so I've heard bad things about this status change but
Today my manuscript went from Awaiting AE Decision to Awaiting EIC Decision

I guess it would need to await that decision either way.

But let's recap the time frame.

It's now Feb 18th.
The manuscript was submitted on Dec 27.
This was the second submission following an initial round of reviews that took approximately 4 months.
We originally submitted sometime last August.

Please keep these timelines in your head if you are submitting; this is probably a good WCS for temporal scale.

Tuesday, February 15, 2011

my silly penman-monteith code

Warning! NONE OF THESE PARAMETERS ARE EVEN CLOSE TO REALISTIC! YOU NEED TO GO FIND THEM!

I need to learn Penman-Monteith if I want to be a wind person.
About what I knew prior to this silly exercise was "it calculates net ET!" how? where? to what extent?
There was only one solution... write a MatLab code to try it out. So, without understanding exactly what half of the parameters meant, I made a little PM toy. I want to put it here not because it's a great example of code, but maybe because I missed something, or maybe because someone else might want to not type all of PM into a code.
Source of the PM equation I used was the FAO website (http://www.fao.org/docrep/x0490e/x0490e06.htm#penman monteith equation

I used their examples,too:

%------------------------------------------BEGIN!

%penman.m

% calculates net ET using PM equation

%parameters and surrogate functions

%----------------grass set--------------------
%d = 2/3;                          % zero plane displacement height
%zm = 2;                           % height of wind measurements in m
%zom = 0.123;                      % roughness length govern momentum transfer
%zh = 2;                           % height of humidity measures
%zoh = 0.1*zom;                    % roughness length hv if not given
%uz = 1;                           % wind speed at height
%h =0.12;                          % crop height
%k = 0.41;
%rl= 70;                           % single grass leaf stomatal resistance

% note that the FAO grass reference has h = 0.12, rl=70,and albedo =0.23.
%-----------------------------------------

%----------------- test set---------------------------

Rn = 2000;                        % net radiation (MJ/M2/d)
G = 500;                          % soil heat flux (MJ/M2/day)
rhoA = 2;                         % mean air density
cP = 4;                           % specific heat air
es = 10;
ea = 7;                           % es-ea vpd of air
%ra = 5;                          % aerdyn resistance
d = 2/3;                          % zero plane displacement height
zm = 2;                           % height of wind measurements in m
zom = 0.123;                      % roughness length govern momentum transfer
zh = 2;                           % height of humidity measures
%zoh = 3;                         % roughness length governing trans of heat/vap
zoh = 0.1*zom;                    % roughness length hv if not given
k = 0.41;                         % vonkarmans constant
uz = 1;                           % wind speed at height
h =0.12;                          % crop height

ra = (log((zm-d)*h/zom*h)*log((zh-d)*h/zoh*h))/k^2*uz;

gradient = 2;                       % slope of the saturation vp/t relate
gamma = 7;                          % psychrometric constant

% note: the bulk surface resistance describes the resistence of the vapour
% flow through the transpiring crop and soil evaporation. when veg does not
% cover the soil completely, the resistence factor should include the
% effects of evap from the soil surface.if the crop is not transpiring at
% its potential rate then teh resistence depends on the water status of the
% veg. we can do an approximation

%rs = 2;                             % bulk surface resistance, if applied in full
rl= 100;                             % bulk stomatal resist of illuminated leaf
%LAIa = 3;                            % active (lit) LAI

%----------------------LAI curve---------------------------------
t = 1:180;                      % length growing season for crop (age for tree)
LAImax = 7;                     % max feasible LAI
r = 0.05;                       % dampening coefficient for LAI curve
Lai(t) = LAImax./(1+exp(-r*t)); % generate LAI curve

% plot Lai if you want.
% plot(t, Lai(:));
% xlabel('time')
% ylabel('LAI');
% title ('Leaf Area Index with respect to time')

z = 100;                        % use z to specify your LAI from curve
LAIa = 0.5*(Lai(z));

% alternate route for grasses
% LAIa =12*h;
% rs approximation
rs = rl/LAIa;

%-------------------------end test set--------------------------
%penman equation for lambdaET
lambdaET= (gradient*(Rn-G)+rhoA*cP*(es-ea)/ra)/(gradient+gamma*(rs/ra));

% ------------------further useful substitutions--------------
% from the grass example I am working this from
% ra = 208/u;                     % aerdyn resistance
% rs = 70;                        % bulk surface resistance
% u = rs/(0.34*ra);

R = 0.287;                        % specific gas constant Kj/kg/K
% Tkelv = 1.01(T+273);            % temp in kelv
% rhoA = P/(Tkelv*R);             % mean air density
epsi =0.622;                      % molecular weight of watervap
P = 1000;                         % atmospheric pressure

lambda = 2.45;                    % latent heat of vaporization
cp = (gamma*epsi*lambda)/P;

% we can approximate Cp this way
%---------------------penman ET0------------------------------
delta = 5;                          % slope vapor press curve kPa/C
Rn = 1000;                          % net rads at surve MJ/m2/d

% note that if mean is used daily estimate of ET will be underest.
T = 5;                              % mean daily temp at 2m h


u = 0.5;                            % wind speed at 2 m height

ET0= (0.408*delta*(Rn-G)+gamma*(900/T+273)*u*(es-ea))/(delta+gamma*(1+0.34*u));



%---------------------------------------------END!!!!


I hope this is helpful for someone. FEEL FREE TO TELL ME IF I MISSED SOMETHING IN THE EQUATION. Ultimately, MatLab "toys" like to grow into bigger things, I feel like, so lest I mess up... come help!

In case you want to know more about PM ET function:
Wiki
UF Extension-- go extension!
UCD more complicated

colored glasses!

Okay, this may not look particularly impressive to you, but I think it's a really fun little tool in ArcGIS that can be used to put "colored glasses" on an area of interest. Here's how it's done.
1. import your map 
2. make sure you have enabled your spatial analyst tool, or get someone to help you enable it, or borrow someone else's ArcSuite (!)
3. Under Spatial Analyst in the toolbox, select Extraction Tools, then "Extract by Rectangle"
4. On your map, move your cursor over the top, right, left, and bottom bounds you want. You should maybe write these on paper. I.E. make a list like:
   - Top: 485961
   - Bottom: 47981
  - Left: 559987
  - Right: 560843

Then select the raster you will want to make your box from. Run the tool. It will take a bit if your computer is slow like mine.
4. Okay, now for your new rectangle, choose a color palette of R -->B, with "Invert" checked
5. Turn your original raster *pull it in if you have to and slide it to the bottom* to black and white
6. You can export it and make a legend in powerpoint if you want, like I did. I don't like the ArcLegends much because no one knows what "RasterT_Extrac1_slopeLess50" is.

Monday, February 14, 2011

maybe i should get moving on that python

Arc takes too long to run.
Whitebox needs improved operability.
TauDEM just doesn't like my computers.

So maybe I should learn Python.

Found a lovely tutorial to get my on my feet: One Day of IDLE Toying

This is a really nice one, since it actually takes time to explain things that -gasp- non-programmers! need to know, like "where do the >>> from the command prompt go in a script?" I mean, now I know that, and this was slightly below my level (WOW!) but major applause to someone for doing a beginner tutorial right.

No surprise, it's out of Berkeley. Many good things come out of Berkeley. It is my goal to work there, so I guess I hope some day I go INTO Berkeley!

Sunday, February 13, 2011

Wow, in case anyone was curious


I'm working up a budget proposal for something right now and I'd really like this software, ENVI. But wow, it's expensive!

Friday, February 11, 2011

00 no, the dreaded e00 file!

I was going to start this with "does it ever happen to you that you want to get a map from the web, and some [nice, kind, other, annoying, frustering, explicative] person saves that file in .e00 format?" and you're thinking, what the nuggets is an e00?

Then I realized that this has a specific audience.If you're here to read my random programs, this is time to tune out.

But if you've been confused by ArcForum online telling you to import a kernel (my popcorn has kernels!) or write a Python script (Pythons? Can't those things kill you?) then welcome home friend.

Okay! To begin!

First let's say you want to get one of these files, so you click on it, and look at the data...




 If you open the file using a text editor what you are going to see is this
Minus the huh? That's just you thinking out loud.


Okay so step by step here's how it's done.
1. you want to write click and "save file as" and make sure it's in an .e00 format. It's also nice to have it already somewhere that's connected to your ArcSuite
2. Now, open ArcCatalog, and check out your toolbars-- do you have the Conversion toolbar?
If not, go to Toolbars and ArcGis 8..... toolbars, and select the Conversion toolbar. It should now pop up.
<<as a side note, you should also do this in ArcMap with Geospatial analyst. I spent way too long wondering why I couldn't create a geostatistical layer until I realized that the Geospatial analyst in the toolbox and the geospatial analyst on the ToolBar are really different>>
3. Okay now you want to go to the Conversion tool and select "Import from an Interchange File."
4. A little pop up will appear. In the top folder, you will put in your new .e00 file. In the bottom folder, you want to name your own output set. Note that this output set you don't have to make before hand...

<< if you say "huh?" to that, there are some cases, involving feature classes, where I think it's easier to make a feature class before hand and specify your projection. This is not one of them.>>
5. You may (I do sometimes) get a popup asking about what projection your data is in. IMHO, it's easier to tell it to put it in the projection of the files you already have IF YOU KNOW THAT THEY ARE ALL IN ONE PROJECTION AND YOU ARE PRETTY SURE THIS FILE IS ALSO IN THAT PROJECTION BUT YOU DON'T REMEMBER IF IT'S SOME SLIGHTLY DIFFERENT NAD.
If not, you can import it without a projection and fill it in later. That's more annoying, but it can be done.

Okay, now you should have a new file! Go to your ArcCatalog and check it out!

\end{you learned!}

Wednesday, February 2, 2011

Let's talk about submitting manuscripts online...

This is not so easy to do.

How does it work?
First, "gather your materials." I am a big advocate of chronologically referencing my desktops on computers. I think it's hard to do subject reference because it gets subjective; should a paper about photosynthesis, for example, go under "biochemistry" or "radiation"? But you will remember, for example, oh, that great paper about photosynthesis that I read around Christmas time last year, and you can find it by searching in your December2010 file.


Here's my hard drive, for example. Computer has the "name" "starsurge" (to differentiate it from my other computers) and then I've got files ready for each time period. Also I've got files for MatLab and R where I copy scripts I want to use in those programs, that way the program doesn't have to search through a lot of junk. Inside those you would see another set of chrono files.

So you will need:
1. your manuscipt, probably in Word format
2. your manuscript, in PDF format
3. the images from your manuscript, preferably in PNG format, but PDF is okay, too. JPG will not look good when you submit because the images do not compress/expand easily...
4. your personal information-- just get all of it. SSN, mom's maiden name, you name it.. I've got a special file (not on my computer) where I keep this stuff near the computer so if I need to know something obscure (drivers license number, for example, for car stuff), it's right there.
5. sticky paper to write a password on-- you can combine steps 4 and 5 and just keep a password notebook or file.

Now there are many places to submit and I'm not going to get into that, but just find one and submit to see how it goes. I submitted a paper on my own when I first got to grad school (with an "English degree" and no research of course it got rejected-- but I didn't know what I was getting into, and it was a good experience to see what writing was about).

Okay, so there will be some instructions for your journal you submit to, and unfortunately you will want to just follow those.

Now one thing to be aware of is the difference between a first author and a corresponding author. A first author is the person who wrote most of the darn thing. A corresponding author is the person to whom complaints and responses will be submitted. They will be the first to find out if it's published.
GRAD STUDENTS: This is usually not you. This is usually your PI. Make sure they are okay with it first. They will be much better at responding to a lot of stuff since THEY ARE VERY EXPERIENCED. Never doubt the power of a PI.
Now on a lot of sites, like Scholar one, you can also put yourself as a co-author (which you are) which allows you to interact with the document online and check its status.

I've been following one for a bit here so I'll tell you what it looks like
So here you see the main page. You've got your manuscripts in every type of way-- unsubmitted (uploaded), drafts submitted, revised, decisions, etc. On the right you see your special "letter" about submission. This is nice to have if anyone ever asks proof that you have a manuscript in review.

If you click on Manuscripts I have Co-Authored, on the left, you will see a page that tells you about your manuscript and it's status
I have followed mine and generally it goes through a few phases:

1. It's submitted but nothing has happened
2. It is awaiting reviewers
3. It is awaiting AE recommendation (that's associate editor)
4. It is either rejected or accepted.

For an idea of time, this manuscript was submitted once previously and returned for revision (submitted around August 2010, I guess). I revised it in November and after a few iterations it was re-submitted around December 27, 2010. Since that point, it is now (Feb. 2., 2011) in stage 3-- awaiting AE recommendation. So with one revision, to progress to this point takes roughly six months. The editor part, then, appears to take about four months.

Keep that in mind as you are "pushing pubs" out the door.

Now, there are "back doors" for publishing, just like for anything-- some people just know the right folks, and get through with alacrity. But for us humans out there, it's a long journey. I hope this is a decent guidebook-- I'll keep you updated as the manuscript moves.