Skip to content
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

Anim14 #5019

Merged
merged 19 commits into from
Apr 30, 2021
Merged

Anim14 #5019

merged 19 commits into from
Apr 30, 2021

Conversation

Esteban82
Copy link
Member

I share with you my idea for animation 14 to show the ability to make a movie with meca and coupe. There are many details that can be improve in the script but now I would like to know your general opinion before I go on improving the scripts and the animation.

About the data: I used the Global CMT web page and I add a column with the time.

Here I shared a link of the movie.

I share with you my idea for animation 14 to show the ability to make a movie with meca and coupe. There are many details that can be improve in the script but now I would like to know your general opinion about the figure before I go on improving the scripts and the animation.

About the data: I used the Global CMT web page and I add a column with the time.
@maxrjones
Copy link
Member

Really nice animation - this will be a great addition! Is the red NW-SE line related to the distance coordinates in the lower panel?

I think that it could look smoother to iterate by the month number rather than month name in the upper right corner (i.e. 03-2013 rather than March-2013). What do you think?

Did you add the time column using GMT? If so, I think it would be nice to include that step in the script. In the WIP: explain section it would also be helpful I think to eventually include the query info for the GMT Catalog Search.

@Esteban82
Copy link
Member Author

Is the red NW-SE line related to the distance coordinates in the lower panel?

The red line in the location of the profile of the lower panel. so the distance would be the same. Maybe I could use the -Ab sintaxis (for coupe -Ablon1/lat1/strike/p_length/dip/p_width/dmin/dmax) so I could use p_length to set the axis label directly.

I think that it could look smoother to iterate by the month number rather than month name in the upper right corner (i.e. 03-2013 rather than March-2013). What do you think?

Yes, here I show one frame per month but in the final animation it would one per week or per day (so the movie would be around 1 minute).

Did you add the time column using GMT? If so, I think it would be nice to include that step in the script.

No, I did it on excel. But it should be possible to do it with a unix tool. The date is in the name of the event (YYYYOODDHHMM) 200501061335A. And I only use data from 2005 onwards. For older events the names are different.

In the WIP: explain section it would also be helpful I think to eventually include the query info for the GMT Catalog Search.

Yes, good idea.

@PaulWessel
Copy link
Member

Nice job, @Esteban82! I also have a couple of suggestions beyond what @meghanrjones listed:

  1. You have DEM="/home/federico/E:/Facultad/Datos_Geofisicos/Batimetria/SRTM15+v21/SRTM15+V2.1.nc" but for the final version it should probably just use @earth_relief_15s instead.
  2. I very recently updated the coupe -A syntax to use modifiers instead of those endless slashes - please see if you can get that to work.
  3. The final version should probably combine the several gmt set calls into one. Fewer total script lines the better.
  4. Eventually translate to english comments - we can help with cleaning that up.

@Esteban82
Copy link
Member Author

Thanks @PaulWessel. I will see it.

@PaulWessel
Copy link
Member

Is the red NW-SE line related to the distance coordinates in the lower panel?
Did you add the time column using GMT? If so, I think it would be nice to include that step in the script.

No, I did it on excel. But it should be possible to do it with a unix tool. The date is in the name of the event (YYYYOODDHHMM) 200501061335A. And I only use data from 2005 onwards. For older events the names are different.

I am sure @seisman can pull out a clever sed command for this... FYI, I have contacted the CMT people and they are willing to at least look into allowing their web tools to have an option to select time in ISO format as an extra column, but did not have time at the moment ...

@seisman
Copy link
Member

seisman commented Mar 25, 2021

Is the red NW-SE line related to the distance coordinates in the lower panel?
Did you add the time column using GMT? If so, I think it would be nice to include that step in the script.

No, I did it on excel. But it should be possible to do it with a unix tool. The date is in the name of the event (YYYYOODDHHMM) 200501061335A. And I only use data from 2005 onwards. For older events the names are different.

I am sure @seisman can pull out a clever sed command for this... FYI, I have contacted the CMT people and they are willing to at least look into allowing their web tools to have an option to select time in ISO format as an extra column, but did not have time at the moment ...

It's possible to use awk, but the command will be very long. Will see if there is a short command for this.

@PaulWessel
Copy link
Member

Perhaps GMT can sniff around in the trailing text somehow and get this time. But not sure how to tell coupe/meca that.

@Esteban82
Copy link
Member Author

For the data there is also the option to use the ndk files. Then with ndk2meca can be converted for GMT (which should be modified to include the time data).

@PaulWessel
Copy link
Member

The ndk2meca script is miles long. Ekstrom may or may not find time to add the time-out feature to his website (code is pretty old I think). So, options:

Time is not needed in meca or coupe; it is entirely something just needed by events in animating those features. Given that time is actually present by default in the CMT output, perhaps another solution than to have to insert a time column is to just read it from the trailing text as needed? If events cannot make sense of that time-stamp then we must expect a time column instead? I.e., if first record has timestamp in trailing test then use tralling text for all time records, else expect the extra time column? What do you think, @Esteban82 and @seisman ? I can then cancel the request with Ekstrom and all will work well, and we would not have to worry about introducing yet another "meca" file format just for the rare case of animation.

@PaulWessel
Copy link
Member

PaulWessel commented Mar 26, 2021

Just looking at your data file, first record. Has time as 200501081845A. is it normal that there are no seconds on the time? Or is this variable and other records might have ss at the end? Does the nkd format preserve quake seconds?

@Esteban82
Copy link
Member Author

Esteban82 commented Mar 26, 2021

Right @PaulWessel. The names of the focal mechanism after 2005 have that format without seconds. The events from 1976-2005 have this format: 111304G, which correspond to MMDDYY. In the NDK file there is information of the seconds.
Later I will answer your first question.

@PaulWessel
Copy link
Member

Thanks @Esteban82. I imagine there will be times when seismologist really want/need to know the rupture time down to the second, hence we must preserve the ability to read a time-column. However, for lots of animations like yours, clearly nearest second is more than enough. So I think the ability to get the time from the current record would avoid the gymnastics you had to do in Excel to get time into that column.

@Esteban82
Copy link
Member Author

Esteban82 commented Mar 27, 2021

I found an old command to convert the ndk to gmt and I modified to include the date and time to the output:

gawk '/^PDE/ {Date=$2; Time=$3; Lat=$4; Long=$5; Depth=$6; getline; Name=$1; getline; getline; getline; strike1=$12; dip1=$13; rake1=$14; strike2=$15; dip2=$16; rake2=$17; print Long, Lat, Depth, strike1, dip1, rake1, strike2, dip2, rake2, Date "T" Time, Name}' jan76_dec17.ndk > jan76_dec17.gmt

The output now has the date and the time with SS.X.
91.01 38.15 27.0 322 37 127 98 61 65 1977/01/01T21:39:41.3 B010177B

I plotted with coupe and it works. I will try with events.

@PaulWessel
Copy link
Member

OK let me know. Coupe by itself does not use tiem so events is the test. I suspect you need to replace those slashes with hyphens, i.e., 1977-01-01T21:39:41.3 for a fully ISO format. But, we could possibly handle that internally in events if it comes to that.

@Esteban82
Copy link
Member Author

I had to add the exponent to the data so the command that works is (the field of Name could be remove). It would be good if you check that the format is ok.

gawk '/^PDE/ {Date=$2; Time=$3; Lat=$4; Long=$5; Depth=$6; getline; Name=$1; getline; getline; Exp=$1; getline; strike1=$12; dip1=$13; rake1=$14; strike2=$15; dip2=$16; rake2=$17; print Long, Lat, Depth, strike1, dip1, rake1, strike2, dip2, rake2, Exp, Date "T" Time, Name}' jan76_dec17.ndk > jan76_dec17.gmt

So now I can plot all the events from 1976-2017 in all the world:

Movie

anim14_2

@seisman
Copy link
Member

seisman commented Mar 27, 2021

So I think the ability to get the time from the current record would avoid the gymnastics you had to do in Excel to get time into that column.

I don't think events should do any special operations adding a time column. Please note that both meca and coupe can accept focal mechanisms in many different formats. Even for the CMT format, people may still get the focal mechanisms from other agencies. So there is no guarantee that the last column is a string like "YYMMDDhhmmA".

@Esteban82
Copy link
Member Author

I forgot to mention that I replaced the / for - in the date.

@PaulWessel
Copy link
Member

OK, I listen to seismologists. No gymnastics, we expect users to add time column. The documentation can give some hints for how that could be done, and maybe Ekstrom will help us down the road to make it an optional format.

@Esteban82
Copy link
Member Author

Esteban82 commented Mar 29, 2021

I managed to get correct output format from all the ndk files with this:

gawk '/^PDE/ {Date=$2; Time=$3; Lat=$4; Long=$5; Depth=$6; getline; Name=$1; getline; getline; Exp=$1; getline; strike1=$12; dip1=$13; rake1=$14; strike2=$15; dip2=$16; rake2=$17; print Long, Lat, Depth, strike1, dip1, rake1, strike2, dip2, rake2, Exp, Date "T" Time, Name}' 0_Data/*.ndk |	sed -i 's/\//-/g' meca.gmt
gmt convert "meca.gmt" -N10+a > "out.txt"

The output look like this:
91.01 38.15 27 322 37 127 98 61 65 25 1977-01-01T21:39:41.3 B010177B

However I noticed that if I joint the 2 commands like this:

gawk '/^PDE/ {Date=$2; Time=$3; Lat=$4; Long=$5; Depth=$6; getline; Name=$1; getline; getline; Exp=$1; getline; strike1=$12; dip1=$13; rake1=$14; strike2=$15; dip2=$16; rake2=$17; print Long, Lat, Depth, strike1, dip1, rake1, strike2, dip2, rake2, Exp, Date "T" Time, Name}' 0_Data/*.ndk | sed 's/\//-/g' | gmt convert -N10+a > "out.txt"

I get an error in the last column. If this a bug in gmt convert?

91.01 38.15 27 322 37 127 98 61 65 25 1977-01-01T21:39:41.3 C200807270118A

Also, when I use sort the output was ok
gawk '/^PDE/ {Date=$2; Time=$3; Lat=$4; Long=$5; Depth=$6; getline; Name=$1; getline; getline; Exp=$1; getline; strike1=$12; dip1=$13; rake1=$14; strike2=$15; dip2=$16; rake2=$17; print Long, Lat, Depth, strike1, dip1, rake1, strike2, dip2, rake2, Exp, Date "T" Time, Name}' 0_Data/*.ndk | sed 's/\//-/g' | sort -k11 -o"out.txt"

@Esteban82
Copy link
Member Author

I would like to know your opinion. For the map of the animation I was thinking to show all the focal mechanism in black/gray and to plot in color only the ones that are shown in the profile (see figure). What do you think? Also I think it would be better NOT to show the seismic events.

EJ21 2_Mapa_Sismicidad_II

@PaulWessel
Copy link
Member

I agree the coloring/gray-shade is a great way to convey what events are being shown in the cross-section. And by seismic events you mean the non-CMT small circles, right? Yes, maybe cleaner without them.

@PaulWessel
Copy link
Member

I cannot test the gmtconvert issue above since the ndk files are not in this branch. Maybe add them for now - we can always remove and finalize before merging the official version.

@PaulWessel
Copy link
Member

@hi @Esteban82, this single command works for me (I assume you were using gmtconvert to get tabs?):

gawk '/^PDE/ {Date=$2; Time=$3; Lat=$4; Long=$5; Depth=$6; getline; Name=$1; getline; getline; Exp=$1; getline; strike1=$12; dip1=$13; rake1=$14; strike2=$15; dip2=$16; rake2=$17; print Long, Lat, Depth, strike1, dip1, rake1, strike2, dip2, rake2, Exp, Date "T" Time, Name}' jan76_dec17.ndk | sed -e 's///-/g' -e 's/ /\t/g' > meca.gmt

@Esteban82
Copy link
Member Author

Right, sorry @PaulWessel.The problem is that I downloaded all the ndk files available (the one I uploaded and then 35 more files, one per each month from 2018 to 2020). Here is the link with the 2018 year. So, when I use gawk with *.ndk (instead of jan76_dec17.ndk) the records in the output were mixed (due to name of the ndk file) and I have to order them by date.

Maybe for the animation, i could use the jan76_dec17.ndk only. But it seems that there is an issue with gmt convert.

@PaulWessel
Copy link
Member

Can you tell me what the gmt convert error you see is? It runs for me on that single file. I took a few records from that file and changed the order then ran gmt convert -N and it sorted them.

@maxrjones
Copy link
Member

I would like to know your opinion. For the map of the animation I was thinking to show all the focal mechanism in black/gray and to plot in color only the ones that are shown in the profile (see figure). What do you think? Also I think it would be better NOT to show the seismic events.

Yes, I agree it looks good to only color ones shown in the profile and it would be better with only the beach balls shown. I would prefer a colormap like 'inferno', 'hot',' or 'magma' for the depth coloring.

@PaulWessel
Copy link
Member

yes, those are true. Also, need to remove superfluous quotes around filenames with no variables or spaces, e.g. "meca.gmt", etc.

Change to @meca.gmt, remove quotes and add -Fmp4
@Esteban82
Copy link
Member Author

Esteban82 commented Apr 30, 2021

Done @meghanrjones. I am afraid I don't know how to change the permission to a+x.

@PaulWessel
Copy link
Member

PaulWessel commented Apr 30, 2021

I just merged master into this branch so we are getting very close to merging this final branch back to master.

@Esteban82
Copy link
Member Author

Also fix some spellings and  link in anim14 with other animations
@PaulWessel
Copy link
Member

I don't think so (yet). Note, I just added some updates (fix a few spellings etc) and added the anim14.rst file and where it is called in animations.rst. @Esteban82, could you please git pull and make any changes you would like to see in the anim14.rst file? @meghanrjones can run the animation and

  1. Update the timing information in the script
  2. Upload the animation to our YouTube Channel
  3. Update the URL in the anim14.sh, anim14.rst files

THen I think we can remove the WIP from the title, run all tests etc, and be ready to merge, no?

@Esteban82
Copy link
Member Author

I just revised the rst file (fix a typo). Remember that the timing of the animation can be reduced after #5142. But It can be updated later.

@PaulWessel
Copy link
Member

Thanks. Yep, I will look for an implementation of that, or at least explain a workaround, but this wont be done for 6.2.0.

@PaulWessel
Copy link
Member

Took 1 hour 35 minutes on my Mac Pro...

@maxrjones maxrjones changed the title WIP Anim14 Anim14 Apr 30, 2021
Copy link
Member

@maxrjones maxrjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, @Esteban82!

Copy link
Member

@PaulWessel PaulWessel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go. Thanks @Esteban82 for a very nice demonstration of new events capabilities!

@Esteban82
Copy link
Member Author

You are welcome. Should I Squash and merge?

@PaulWessel
Copy link
Member

yes, please have the honor since it is your branch.

@Esteban82 Esteban82 merged commit c67a7f0 into master Apr 30, 2021
@Esteban82 Esteban82 deleted the WIP-Anim14 branch April 30, 2021 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants