Open saeedsltm opened 6 years ago
Well.. you should just replace the function such that it converts from the coordinates you use in NonLinLoc (this is assuming that in NonLinLoc you use TRANS NONE
, I think) to WGS84. If you have a coordinate system that has an EPSG code you can do it pretty much the same as in the original gk2lonlat
function.
Thanks, OK but when we use something like this "TRANS LAMBERT WGS-84 35.50 50.50 32.0 38.0 0.0" which is already WGS, then what would be gk2lonlat? In this case our reference is WGS84!
OK, so currently, I guess you should just put
def gk2lonlat(x, y):
return x, y
I did it but here is the result! please find attachement
On 1/12/18, Tobias Megies notifications@github.com wrote:
OK, so currently, I guess you should just put
def gk2lonlat(x, y): return x, y
-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/megies/obspyck/issues/72#issuecomment-357200265
-- Dear
Regards
Saeed Soltani Moghadam. PhD student of Earthquake Seismology @ IIEES, Tehran, Iran. Tel: (+98) 917 709 7029
Attachments to email replies are not retained by Github..
sorry, by the way it did not work. i think the problem is i need to convert x/y from Cartesian coordinate system (source and station relative to map center in TRANS line of NLL control file) to lon/lat. So the output coordinate system is WGS-84 but i dont have any idea about the input coordinate system.
Finally i found a solution and here is the change list:
1- write new gk2lonlat function in util.py like:
def gk2lonlat(lon0,lat0,x,y): lon0*=ones_like(x) lat0*=ones_like(y) wgs84_geod = Geod(ellps='WGS84') new_lon, new_lat, _ = wgs84_geod.fwd(lon0,lat0,rad2deg(arctan2(y,x)),sqrt(x**2+y**2)*1e3) return new_lon, new_lat
2- and change the following line:
data[0], data[1] = gk2lonlat(data[0], data[1])
to:
data[0], data[1] = gk2lonlat(lon0, lat0, data[0], data[1])
3- add the following lines to obspyk.py's line 2191:
# read reference coordinate with open(files['summary']) as f: for l in f: if "TRANSFORM" in l: lat0 = float(l.split()[5]) lon0 = float(l.split()[7])
4- and change the following lines:
4-1) line:
lon, lat = gk2lonlat(x,y)
to:
lon, lat = gk2lonlat(lon0,lat0,x,y)
4-2) line:
data = readNLLocScatter(PROGRAMS['nlloc']['files']['scatter'], self.widgets.qPlainTextEdit_stderr)
to:
data = readNLLocScatter(lon0, lat0, PROGRAMS['nlloc']['files']['scatter'], self.widgets.qPlainTextEdit_stderr)
Thanks.
Ah, I think I understand what the problem is now.. basically in your case we need to parse the GEOGRAPHIC
line in the nonlinloc hypocenter-phase output file, instead of the HYPOCENTER
line that I usually use because I have to convert coordinates manually after the nonlinloc run (all of our models are in local XYZ coordinate systems).
Compare two flavors of the hypocenter output file:
I'll try to come up with a simple switch for the configuration file, so that this can be done without hacking the source code in the future.. maybe even later today or this week
Yes, actually i made a change to use GEOGRAPHIC but it didn't resolve my problem because stations are also needed to change their positions. About the repos, they may need some minor changes i think ;).
but it didn't resolve my problem because stations are also needed to change their positions.
Hmm.. I don't understand, can you clarify? I don't see how station coordinates are ever handled in something else than lon/lat..
Yes you right. Only source and scatter points are using gk2lonlat function.
On 1/15/18, Tobias Megies notifications@github.com wrote:
but it didn't resolve my problem because stations are also needed to change their positions.
Hmm.. I don't understand, can you clarify? I don't see how station coordinates are ever handled in something else than lon/lat..
-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/megies/obspyck/issues/72#issuecomment-357682965
-- Dear
Regards
Saeed Soltani Moghadam. PhD student of Earthquake Seismology @ IIEES, Tehran, Iran. Tel: (+98) 917 709 7029
Ok, so what I would do is add a config option for nlloc that can either be..
None
which means that no transform will be done and GEOGRAPHIC
line will be used (can you please confirm that the scatter is also in lat/lon in your case?)int
, in which case this will be used as an EPSG code (with an additional option for a scaling factor to apply -- I usually have kilometers in nlloc even though I use a meter-based EPSG coordinate system)str
, in which case this will be interpreted as a function that is imported and used for coordinate conversionThe latter two cases would then use HYPOCENTER
line and the first option the GEOGRAPHIC
line.
scatters are in x,y relative to geographical center in introduced in TRANS line. So they need to be converted according to reference coordinate system.
Hi, Could you please help me how to set gk2lonlat function correctly when using our own coordinate system in NLLOC?
Regards