Tuesday, August 28, 2018

Using XYZ tile servers in QGIS

In QGIS 3 and on, the old mapping plugins such as openlayers and its predecessors were replaced by XYZ tile servers. Below, I post a list of the XYZ tile servers I could find and a screencast explaining how to add a new server to your QGIS browser.
This list of XYZ servers was taken from the script linked here who will automatically add the hole list to your browser if you paste it to your python console.

Please, write to me if you find more servers out there. I think its important that we have a list of the servers.


List of available XYZ tile serves
Map Name
Provider
URL
Open map
Terrain map
https://tile.opentopomap.org/{z}/{x}/{y}.png
Map tiles by Stamen Design
http://tile.stamen.com/toner-lite/{z}/{x}/{y}.png
Stamen Watercolor
Map tiles by Stamen Design
http://tile.stamen.com/watercolor/{z}/{x}/{y}.jpg
Wikimedia Map
OpenStreetMap contributors
https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png
Wikimedia Hike Bike Map
OpenStreetMap contributors
http://tiles.wmflabs.org/hikebike/{z}/{x}/{y}.png
Esri Boundaries Places
Esri
https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{x}/{y}/{z}
Esri Gray (dark)
Esri
http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}
Esri Gray (light)
Esri
http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}
Esri National Geographic
Esri
http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}
Esri Ocean
Esri
https://services.arcgisonline.com/ArcGIS/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}
Esri Satellite
Esri
https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}
Esri Standard
Esri
https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}
Esri Terrain
Esri
https://server.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}
Esri Transportation
Esri
https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}
Esri Topo World
Esri
http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}
OpenStreetMap Standard
OpenStreetMap contributors
http://tile.openstreetmap.org/{z}/{x}/{y}.png
OpenStreetMap H.O.T.
OpenStreetMap contributors
http://tile.openstreetmap.fr/hot/{z}/{x}/{y}.png
OpenStreetMap Monochrome
OpenStreetMap contributors
http://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png
Strava All
OpenStreetMap contributors
https://heatmap-external-b.strava.com/tiles/all/bluered/{z}/{x}/{y}.png
Strava Run
OpenStreetMap contributors
https://heatmap-external-b.strava.com/tiles/run/bluered/{z}/{x}/{y}.png?v=19
Open Weather Map Temperature
Map tiles by OpenWeatherMap
http://tile.openweathermap.org/map/temp_new/{z}/{x}/{y}.png?APPID=1c3e4ef8e25596946ee1f3846b53218a
Open Weather Map Clouds
Map tiles by OpenWeatherMap
http://tile.openweathermap.org/map/clouds_new/{z}/{x}/{y}.png?APPID=ef3c5137f6c31db50c4c6f1ce4e7e9dd
Open Weather Map Wind Speed
Map tiles by OpenWeatherMap
http://tile.openweathermap.org/map/wind_new/{z}/{x}/{y}.png?APPID=f9d0069aa69438d52276ae25c1ee9893
CartoDb Dark Matter
Map tiles by CartoDB
http://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png
CartoDb Positron
Map tiles by CartoDB
http://basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png
Bing VirtualEarth
Microsoft
http://ecn.t3.tiles.virtualearth.net/tiles/a{q}.jpeg?g=1

Saturday, November 25, 2017

Google sheets are now officially better spreadsheet than Microsoft excel!

I was sitting with Pierre Loquett, coach of the Israeli women windsurfing team, also known as the madam sailing team to analyze data he obtained from the sailors during the last year. Since I knew I will probably have to debug what I do, I decided to try and do it using google spreadsheet instead of downloading the data and using Microsoft excel.

Being a Microsoft excel teacher, I thought I was going to have a hard time doing it, but I was in for a big surprise, some little things (and very big things) google sheets does makes life much easier than possible with excel!

Befor I start presenting what I saw, let me first say I am not a google fan (not anymore, at least) and like the average Joe, I am very much afraid of their control of human knowledge, but this is an awesome tool!

First a screencast showing what I did and the benefits google sheets present



Detailes:
Big things
The filter function: This function is one of many google sheets functions that do not exist in excel and probably cannot be implemented there. These functions are typed in one cell and changes the value of a range of cells.
For instance, you can create an SQL like query returning records in a specific date range from your bank report.

Little things
Graphs: Although graphs still have a long way to go and usually I will still recommend plotting in excel (Or other software if you really want high quality) in this case my graph data range was dynamic since its based on the filtered data. I don't know how this was implemented, but when the filtered range size was changed, the plotted range changed with it leaving no blank data on the graph.

Date selection: Mistakingly I double clicked on a cell containing a date value which set of a date picker for my surprise.

I guess that as much as I will keep working with sheets I will come across more little things  that will make me ask "How didn,t anyone do that before"

Bottom line is:
"Time to migrate"

Wednesday, May 11, 2016

Using Windguru archive and Microsoft excel to analyze weather patterns at future sailing event sites.

OK, who haven't been there, you get the list of events planned for next year only to find out that the most important event (world championships??) is scheduled somewhere you have no idea about. In this post I will show and demonstrate how to use windguru.com archive data to generate statistical analysis of the typical weather at the event site.

Bottom Line
You probably wonder how difficult this is going to be and what kind of insights am I going to get from this thing?
So here are the two simple answers (in screencasts) and if you have any problems (usually, if your event site does not exist in the windguru spot list) you will have to scroll down to find a solution.
you ill have to use one of the two excel templates
Analysis template with waves data
Analysis template without waves data

Recent edits:
This post uses the old version of wind guru website. To reach it use this short screencast:

How do I use it?

What do I get out of it?




Quick intro to the windguru website:
Windguru is a website that facilitates easy access to numerical weather forecast. The free version delivers the GFS 27Km data, but you can always pay for the pro version and have access to many more models. It has a predefined list of spots each of them linked to graphical representation of the latest weather forecast for that spot. The interface provides several ways to select your spot, it is specifically designed for sailors and provides access to varied data such as wind speed and direction, air temperature, wave height, cloud cover and more for the next 10 days. The forecast is usually very accurate. On regions that are highly affected by land such as closed bays or lakes the forecast quality is limited.
How to find the windguru spot closest to the event website:
If your event is scheduled somewhere you have no clue about you can do two things:
1. Subscribe to the windguru pro version which also allows you to add a new spot.

2. Find the windguru spot closest to your event site using the windguru spot map, and google earth as demonstrated at the following screencast.

The windguru data archive:
Windguru does not only provide forecasting, it also archives the latest forecast for a spot. I use the windguru archive as a database to generate statistics of weather patterns for an event site. It enables you to focus on season or month of interest as demonstrated in the following screencast.
Statistical analysis of the archived data using Microsoft excel:
To perform the analysis one can use one of two templates I prepared:
Analysis template with waves data
Analysis template without waves data

Specifically, how use the archived data to perform statistical analysis of the expected weather is demonstrated in the following screencast.

Please write to me with any question.
I would like to know weather a detailed explanation of the output is needed.

Thursday, March 31, 2016

Quick and dirty anti plagiarism tool

Hi all
For some time now, I was looking for a way to detect plagiarism in excel files.
Today I realized that in most cases, students that needs to submit an excel assignment (or for that matter, any other assignment) will be using a file already submitted by submitted by someone else in their group which they modify to some extent.
The students can only modify the file content, but they cannot modify are at least will not modify the file's creation date.
Thats the idea lying behind this "antiplagirism" tool.


1. grab the excel file from here
2. put it in the folder where the submitted files are located
3. run the macro by pressing CTRL+r
4. Sort the list of file that was created by the creation date (Column B)
5. Find the files with the same creation time

Do whatever it is you do.....

You can look at a demonstration here.


Sunday, October 25, 2015

Fluxes reservoirs and sinks - the one box model with labcasts

In this blog post I intend to display the one box model of fluxes and sinks using a series of lab casts.



First lets go through the mathematical terms we intend to use

$$ Reservoir - Q $$
$$Time - t $$


A reservoir is the "box" from the one box model, where the substances are accumulated. It is denoted by the letter Q which suggest that it is an expression of the quantity of substance in the reservoir.
Time denotes the times since the reservoir started filling and is denoted by the letter t
$$Flux - \nu $$


These terms are demonstrated in the following Lab-Cast




This model forecast

Reservoir size is equal to the time since the flux began doubled by the flux
$$ Q={\nu}*{t} $$ 
 The flux is equal to the size of the reservoir devided by the time since the flux began 
$$\nu = \frac{Q}{t}$$ 
The time since the flux began is equal to the reservoir size devided by the flux 
 $$t=\frac{Q}{\nu}$$ 
Naturlly, fluxes can come in many different shapes and can be combined or detached. For instance,  lets add another flux of dissolved tracer to our water flux.
Nothing changes in our mathematics the only thing we need to adjust is that we need for each tracer using the appropriate terms. The link between the water and the tracer flux is the Concentration in the flux and in the reservoir.
reservoir concentration - $C_r$ and flux concentration - $C_f$
So the terms used for tracer calculation (marked as tr):
$$Q_{tr}=t*\nu*C_f = C_r*Q$$
$$\nu_{tr}=\nu_{tr}*C_{f}$$
$$t=\frac{Q_{tr}}{\nu_{tr}}$$

The most important statement in this post is:

In the real world every flux has an opposing  flux (outflux), otherwize, Reservoir size (Q) will reach infinity.


So lets introduce a new term:
$$Removal - R$$

In the following lab cast an example of influx and removal is given:

And now for some math, this time using the two fluxes situation.
Let us try and calculate the change of tracer concentration $Q_{tr}$ per unit of time:
$$\frac{dQ_{tr}}{dt}= \Sigma sources - \Sigma sinks=f_{tr}-R_{tr}$$
In our simple example the only source is the particulate source through the tap and the only sink is the particles settling. The size of the sink is linearly related to the size of the tracer reservoir $Q_{tr}$. Let us define the linear relationas k.
$$\frac{dQ}{dt}=f_{tr}-kQ_{tr}$$ after doing some algebra: $$\frac{dQ}{f_{tr}-k*Q_{tr}}=dt$$ And by integrating both sides of the equation over time we are getting: $$\left(\frac{1}{k}\right) * ln \left(f_{tr}-k*Q_{tr}\right) \int_0^t= t \int_0^t $$ Which gives $$\left(\frac{1}{k}\right) * ln \left(\frac{f_{tr}-k*Q_{tr(t=t)}}{f_{tr}-k*Q_{tr(t=0)}}\right) = t $$ And again, Rearranging: $$Q_{tr(t=t)}=Q_{tr(t=0)}*e^{-kt}+\frac{f_{tr}}{k}*\left(1-e^{-kt}\right)$$


Bear in mind that the natural environment is usually a "pseudo steady state", the environmental properties change in time but are kept between thresholds. This means that the influx and outflux are equal and therefore can be calculated using the following formulas give us a good first order approximation of the fluxes. $$f_{tr}=R_{tr}$$ or $$\frac{d{tr}}{dt}=0$$ or $$\frac{dQ}{dT}=0$$

Wednesday, October 7, 2015

On relative sediment sinking rate and sediment composition

When I teach my chemical oceanography student about the factors determining sediment composition I found out that understanding the concept of relative flux rate is not trivial. Therefore, I present a simple experiment demonstrating those concepts.

First, let me ask you a question:
Why the most abundant type of sediment in deep water (>3.7Km) at the middle of the ocean is red clayes of continental origin?
To answer that we must first understand that sediment is formed by settling of particles from the sea surface or particles that are formed within the water column on the bottom of the ocean. The settled particles are defined as sediment. This is demonstrated in the following clip
As you can see, when only one type of sediment settles the sediment is composed of only that type of sediment. But what is the sediment composition when several types of sediments are settled together?


  Now we are getting closer to solving our question. When sedimentation of several types of sediments is simultaneous, the sediment composition will be determined by their relative flux (amount of sediment sinking in a unit of time) and their decomposition within the sediment.


Lets see if its clear

And now lets see if you can implement the concepts I introduced to help people in need

A group of arts wants to find meteorites to make jewels where would you suggest them to look fo

    At river outfalls
    At the Mediterranean
    Where red clays are found
    On continental ridge