Hi Peter,
Thank you. I understand now, much appreciated. I will run your script on my file in the morning and achieve the desired outcome I'm after. Perfect!
I did try and use your suggested 'update column', which worked, and populated the calc'ed value into the table. Perfect!!
Mapinfo + discover have some pretty cool stuff!! Was exploring the Discover | surface | kriging tool yesterday, but ran into an issue with MIP, which assigns a 0 to nulls in the file (eg in my Au ppb field). I usually log the Au ppb before kriging. I got around the issue in MIP, using a query to select Au ppb > 0 before log, and Datamine | surface | kriging
I originally compared the output without excluding the nulls = 0, in Discover (as I forgot MIP assigns 0's to nulls), and a bunch of anomalies disappeared. Didn't agree with the log Au / Z_Au ioGAS image (ioGAS ignores Null's).
Do you know if there is any way of preventing MIP to assign a zero to Null values? Would save a couple steps.
Cheers, Mike
Sent from Mike W iPhone
Original Message:
Sent: 10/1/2021 10:07:00 AM
From: Peter Horsbøll Møller
Subject: RE: Calculating Log
I assume this can be helpful (from the MapBasic help):
You can calculate logarithmic values in other bases (for example, base 10) using the natural logarithm. To obtain the base-10 logarithm of the number n, divide the natural log of n ( Log( n ) ) by the natural logarithm of 10 ( Log( 10 ) ).
I guess this means you can do your calculation using this expression: Log(Au_ppb)/Log(10)
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
------------------------------
Original Message:
Sent: 10-01-2021 05:24
From: Mike Woodbury
Subject: Calculating Log
Hi Peter,
The results don't look correct? These look to be LN, not log 10 (x). I checked a couple on my calculator and the results in MIP are not Log 10 (x)
Results I'm getting are different to what I'm expecting Peter. My mistake if I didn't specify Log 10 (x) = Log
Cheers, Mike
Original Message:
Sent: 10/1/2021 2:17:00 AM
From: Peter Horsbøll Møller
Subject: RE: Calculating Log
Hi Mike
You can add a new column anywhere through the Table Structure dialog (right-click on a table in the Table List or find it on the Table tab).
Then use the Update Column dialog to update the new column with your Log expression.
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
Original Message:
Sent: 10-01-2021 02:06
From: Mike Woodbury
Subject: Calculating Log
Hi Peter,
Perfect, it worked. Thank you Peter
Is there a way to write the LogAu, back to the original table, placing the Log(Au_ppb) at the end of the original table?
I take it you could also apply logs to all e.g. elements in the table, in 1 step?
Cheers, Mike
Original Message:
Sent: 10/1/2021 1:40:00 AM
From: Peter Horsbøll Møller
Subject: RE: Calculating Log
Hi Mike
Move your Log expression up and replace the * with the expression:
Select Au_ppb, Log(Au_ppb)
From MYTABLE
Into Selection
You can add additional columns in the projection list to get these returned with the query too.
Or write MYTABLE.*, Log(Au_ppb)
to get all the columns and the log value.
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
Original Message:
Sent: 10-01-2021 00:23
From: Mike Woodbury
Subject: Calculating Log
Hi,
Can anyone please help with Log calc in MIP (Or Discover) from Native/X file
I have looked under Table | SQL; Table | Update Column and Home | Tool Manger | SQL, plus a quick search on the internet
I did try Home | Tool Manger | SQL however, was unable to sort out scripting. I did find the Log function however, I didn't structure the script correct (attached)
In the end, I have to work out side of MIP, and calc in ioGAS, SPSS, Excel or R (prefer to keep inside MIP if at all possible).
Cheers, Mike
------------------------------
Mike Woodbury
Knowledge Community Shared Account
------------------------------