-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
select a (or a few of) tracer(s) that has specific x, y, and z coordinates #60
Comments
I figured out how to do it: data.x is a structure containing three fields: value, unit, and isdimensional. I need to extract the value: If I want to select tracers having x>0 and z>0, I need to do: I also found that if I only select the spatial range of the tracers (the line above), the resulted "ID" won't work with
That returns the all passive tracers of x>0, z>0 and phase ==1. Plotted the see that they are indeed correct: @boriskaus I hope this is how it should work. Julia language knowledge is needed (with help from Copilot!) |
yes this is how this should be done. Note that you can do this as well in Julia: ID = findall(data.x.val .> 0) Note the dot in front of ID = findall(data.x.val .> 0 .&& data.z.val .> 0) or ID = findall(data.x.val .> 0 .&& data.z.val .> 0 .&& data.fields.Phase .== 1) which is slightly more compact than what you wrote. |
Thanks! The method also works. Will be good if such an example can be included in the user guide: https://juliageodynamics.github.io/LaMEM.jl/dev/ in the future. |
Why don't you prepare the example and make a pull request? That would really help to improve the code. |
Will do! |
This issue can be closed with the pull request #61 . |
I ran the following example code without issues except the need to update some older syntax (see my last line of comment):
I am trying to select a (or a few of) tracer that has specific x, y, and z coordinates because the index (ID) of the tracer does not bear explicit spatial meanings. Given the CartData structure, I tried to select tracers, for example, x> 0, by doing:
data,time = read_LaMEM_timestep(model, 0, passive_tracers=true)
ID = findall(data.x .> 0)
Yet, the error says:
MethodError: no method matching is less(::Int64, ::Unitful.FreeUnits{(km,), 𝐋, nothing})
It seems more information is needed about the unit used.
I see a workaround that is to specify a small tracer area at the beginning of the code instead of having a wide distribution of tracers everywhere. But it will be nice to be able to select a tracer by designating the x,y,z range of interest.
BTW, some syntax in this example needs to be updated: Read_LaMEM_timestep -- > read_LaMEM_timestep and PassiveTracer_Time --> passivetracer_Time.
Originally posted by @wenrongcao in #35 (comment)
The text was updated successfully, but these errors were encountered: