Arrgg.
Before Paul’s update to g.proj today, it turns out that g.proj would actually accept the argument “datum” as equivalent of the argument “datatrans”, even though this is not in the manual. I don’t know if that was intentional or an accident. So g.proj datumtrans=1 could also be expressed as g.proj datum=1.
core.create_location is a python wrapper for g.proj in the GRASS python scripting library. So even though create_location incorrectly gave the data transform argument as “datum” instead of the correct “datatrans”, it still worked when the datum argument was actually the data transform number (an integer). My guess is that this was an error but happened to work due to a lucky accident. However, it is actually documented in the programmers manual for core.create_location as: “datum datum transformation parameters (used for epsg and proj4)”
Now that g.proj has an ‘official’ argument of “datum” that takes the GRASS datum code, create_location works differently than it did before. In fact, it works ‘correctly’ as it relates to g.proj in that the “datum” argument now actually takes a datum code. However, it no longer has a way to set the datum transform. So we need to add a new argument of “datumtrans” to create_location. This change will be a big improvement to g.proj and the core.create_location wrapper for g.proj.
Hopefully this is understandable to those who are working with g.proj.
Note that this change in create_location, even though correcting an error, will break a script that uses core.create_location and assumes that the “datum” argument refers to the “datumtrans” value. It does not break a script that uses g.proj according to the manual.
Suggestions on how to proceed?
If create_location is fixed, I can fix the location wizard. In fact, I’ve already done it locally but can’t commit it until create_location is changed too.
Michael
C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu
On Oct 1, 2012, at 10:59 PM, Michael Barton <michael.barton@asu.edu>
wrote:
Yes. This is indeed what needs to be done with core.create_location.
I’m not even sure if it was working correctly before anyway. I don’t see how it could. Any problem with me updating it like this?
Michael
C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu
On Oct 1, 2012, at 9:37 PM, Michael Barton <michael.barton@asu.edu> wrote:
In the GRASS python library, core.create_location needs to be updated to use the new datum argument in g.proj.
I think I know how to update it, but it looks like there may be an error in the create_location code. It is using “datum” to refer to the “datumtrans” argument of g.proj.
Currently, the code looks like this
def create_location(dbase, location,
epsg = None, proj4 = None, filename = None, wkt = None,
datum = None, desc = None):
…
kwargs = dict()
if datum:
kwargs[‘datum’] = datum
I think it probably should be:
def create_location(dbase, location,
epsg = None, proj4 = None, filename = None, wkt = None,
datum = None, datumtrans=None, desc = None):
…
kwargs = dict()
if datum:
kwargs[‘datum’] = datum
if datumtrans:
kwargs[‘datumtrans’] = datumtrans
The programmers manual would need to be updated to reflect this change. This means a change in the arguments for create_location. But it is currently sending the wrong argument to g.proj anyway. So this is also a bug fix to create_location.
Michael
C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu