You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 22, 2021. It is now read-only.
Hey All,
I have started working on a save(or export) as surfer ascii grid file function. I am fairly new to python and fatiando, so any suggestions are greatly appreciated. Jeremy
importnumpydefsave_surfer(fname,data):
#set header variables, note all variables are switched to x horizontal and y vertical to fit with surfer terminology#also z values are set to a max of 5 decimal places to save on space in ascii format#this was chosen because this is just slightly above most field equipment's level of precision#required inputs are a file name (fname) which should end in ".asc" and the data (data) to be exported #also need data shape and area which should already be created from fatiandoncols=int(shape[1])
nrows=int(shape[0])
xmin=area[2]
xmax=area[3]
ymin=area[0]
ymax=area[1]
datamin=round(numpy.amin(data), 5)
datamax=round(numpy.amax(data), 5)
header= ('DSAA'+'\n'+' '+str(ncols)+' '+str(nrows)+'\n'+' '+str(xmin)+' '+str(xmax)
+'\n'+' '+str(ymin)+' '+str(ymax)+'\n'+' '+str(datamin)+' '+str(datamax))
#make 2d arraytmp=numpy.array(tf).reshape(ncols,nrows)
numpy.savetxt(fname,tmp, fmt='%.5f', delimiter=' ', header=(header), comments='')
The text was updated successfully, but these errors were encountered:
I added some markup to your issue text to format the code properly. Github has a Markdown guide if you want to see what is possible.
Have you ever used git? This is what we use to manage code contributions and collaborate on Fatiando.
A contribution here is called a Pull Request. We have services in place that automatically test the code and check if everything is well. We can also review the code and make suggestions. See this recent one by @santis19 for an example: #411
If you want to give it a try, checkout these great guides:
It's a very useful skill to have and I guarantee that it will not be time wasted.
I use this for everything, including writing papers: https://github.com/pinga-lab
Of course, we're very happy to help with whatever you need.
If you don't want (or have time) to get into git, we can always comment here and we'll add the code ourselves.
This is my first time using git, I am interested in learning more about it and how to properly contribute as there are some other things I will need to develop for some of my research which are probably well suited to add to fatiando. However, I may be a little slow getting to this at least until the semester is over, but if there is no rush I would be happy to go through the steps to add the save_surfer function.
@jgmenzer there is no rush. Take your time and please ask as much as you need. Either here on this issue, on the mailing list, or on our Gitter chatroom. I'm really bad at keeping up to date with all the notifications and emails (there a few sitting in my inbox needing a reply), so no pressure.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hey All,
I have started working on a save(or export) as surfer ascii grid file function. I am fairly new to python and fatiando, so any suggestions are greatly appreciated. Jeremy
The text was updated successfully, but these errors were encountered: