POSTPROCESSING SCRIPTS & TIPS

300 views
Skip to first unread message

bexeross

unread,
Feb 2, 2018, 9:48:21 AM2/2/18
to connectivity-modeling-system-club
Hi All,

Instead of searching many threads, here is a thread to consolidate advice and scripts for post-processing CMS outputs

Please contribute! 

We want anything that will help people (and you!) with visualisation and analysis of CMS outputs.

NOTE: these are not necessarily scripts that are ready for use, they are here for you to use as a basis for something that you customise/write yourself (unless otherwise marked).

All the best,
Bex

P.S. if you have questions about any of these scripts and tips, please put them in separate threads and link to the relevant post. This will avoid clogging this thread up with conversations and keep the helpful information easily accessible.

Rebecca Ross

unread,
Feb 2, 2018, 10:00:40 AM2/2/18
to bexeross, connectivity-modeling-system-club

To start us off:

 

R scripts to process traj_files (in ASCII format)

 

These are not beautified and ready to go, but should be readily harvestable, for use as a start point if you want to do something similar…

 

Subsetting to a polygon source.

R_step1_trajfile_subset2DarwinOnly.R – I used this to consolidate from a lot of trajectory ascii files, all those particles that launched from a particular place (called the Darwin Mounds, release polygon 4) then output that subset into a csv.

 

Converting the subset traj_file (now in csv format) into line shapefiles.

R_step2_DarwinOnlyTraj_to_line.R – the csv from the last file (which is a subset of the traj_file) was then processed to produce trajectory line shapefiles for input into a GIS software.

 

All the best,

Bex

--
You received this message because you are subscribed to the Google Groups "connectivity-modeling-system-club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to connectivity-modeling-...@googlegroups.com.
To post to this group, send email to connectivity-mod...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.




This email and any files with it are confidential and intended solely for the use of the recipient to whom it is addressed. If you are not the intended recipient then copying, distribution or other use of the information contained is strictly prohibited and you should not rely on it. If you have received this email in error please let the sender know immediately and delete it from your system(s). Internet emails are not necessarily secure. While we take every care, Plymouth University accepts no responsibility for viruses and it is your responsibility to scan emails and their attachments. Plymouth University does not accept responsibility for any changes made after it was sent. Nothing in this email or its attachments constitutes an order for goods or services unless accompanied by an official order form.
R_Step1_trajfile_subset2DarwinOnly.R
R_Step2_DarwinOnlyTraj_to_line.R

Rebecca Ross

unread,
Feb 2, 2018, 10:11:04 AM2/2/18
to Rebecca Ross, bexeross, connectivity-modeling-system-club

Duplicated from thread “Interpreting results from CMS”

 

Grouping connectivity matrix into larger regions

 

Here is a link to Sally’s original post… https://groups.google.com/d/msg/connectivity-modeling-system-club/OJZqroDfqjA/xGw3GUBrBQAJ

 

Hi,

in case anyone else is interested, I have attached a script which takes the raw connectivity matrix and groups individual cells into larger, user-defined regions (such as individual reefs or management areas). Say your original matrix is n x n, and you have m number of 'sum regions', you input a file (excel or text) listing all the settlement cells (n, column 1) and which sum region (m, column 2) they belong to. The resulting matrix is an m x m matrix with the values for all cells n in each region m summed. 

 

I have simplified the script to make it as generic as possible.

 

Dianne, I hope that is what you meant. Let me know if not, I have a range of other Matlab scripts for manipulating and analysing the output of CMS in different ways.

 

Sally

Image removed by sender.



This email and any files with it are confidential and intended solely for the use of the recipient to whom it is addressed. If you are not the intended recipient then copying, distribution or other use of the information contained is strictly prohibited and you should not rely on it. If you have received this email in error please let the sender know immediately and delete it from your system(s). Internet emails are not necessarily secure. While we take every care, Plymouth University accepts no responsibility for viruses and it is your responsibility to scan emails and their attachments. Plymouth University does not accept responsibility for any changes made after it was sent. Nothing in this email or its attachments constitutes an order for goods or services unless accompanied by an official order form.

--
You received this message because you are subscribed to the Google Groups "connectivity-modeling-system-club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to connectivity-modeling-...@googlegroups.com.
To post to this group, send email to connectivity-mod...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

group_matrix.m

Bharti D.K

unread,
Mar 14, 2018, 2:01:37 AM3/14/18
to connectivity-modeling-system-club
Hi all,

I've written some R code to plot trajectories, particle density distributions and connectivity matrix using netCDF output in CMS. This was written specifically for my work, but parts of it should be adaptable for use by others. Like Bex says - this would serve as a guideline to someone who wants to use it but might not be directly usable in its current form.
Some initial parts of it is transliteration of the MATLAB code provided in CMS into the R programming language.

Regards,
Bharti
traj_pdd_matrix_CMS_Bharti.r
Message has been deleted

bexeross

unread,
Oct 29, 2018, 5:50:43 AM10/29/18
to connectivity-modeling-system-club
Hi everyone,

Here is a matlab script, care of Dr Nataliya Stashchuk, an oceanographer at the University of Plymouth, UK. 

Technically a pre-processing script, she made this to help me add w-velocity to Hycom files, derived from the conitnuity equation. Nataliya has given me permission to share this with you all, in case you want to do that too (please do acknowledge her if you use this for a publication).

I can't promise it is in working order for the nest files you have, but it will definitely speed up the process for anyone faced with trying to do this from scratch. Good luck.

N.B. it is in a zip file as it is dependent upon a smoothing script (smooth2a) obtained from the mathworks file exchange but included here for completeness.

All the best
Bex
WvelWriteToFile.zip

Elisabet Cruz

unread,
May 22, 2020, 12:38:05 PM5/22/20
to connectivity-modeling-system-club
Hi everyone!

Here is a code that i made to create symbolic links for a period of time from the same oceanographic input file.

A little explanation about the code:
Inside the code you can change the initial date in "start_date" and the number of days "num_days" that are inside your file, "file" is the file from the one that you want to create the symbolic link, "echo" will print the name of the symbolic links that you are creating and in this line "ln -s $file ./expt/expt_example/nests/nest_1_${date}000000.nc" you can set the folder where you want to create the symbolic links  and the name of it with different hours

I hope that it will be helpful for someone!!
All the best,
Elisabet R. Cruz
syli2h.bash

Claire Paris

unread,
May 22, 2020, 6:31:50 PM5/22/20
to Bharti D.K, connectivity-modeling-system-club, Ana Vaz
Dear Bharti,

Thank you vey much for this R-code. It will be uploaded on GitHub with the CMS package.
This is exactly what we expect form the users, giving back to the CMS Community

Best Regards,
Claire


> On Mar 14, 2018, at 2:01 AM, Bharti D.K <bhart...@gmail.com> wrote:
>
> <traj_pdd_matrix_CMS_Bharti.r>

Claire Paris

unread,
May 22, 2020, 6:37:52 PM5/22/20
to Gilbert Nightray, connectivity-modeling-system-club
Hello Gilbert

The output for the particles arriving in a polygons is in the CON (connectivity) files - each line is a particles that survived and settled in a polygon; i.e. the number oiliness in the file gives the number of survivors.
 
The output of status of the particle (e.g. mortality, depth) is archived at each time step in the TRAJ file  

You should find the information in the user’s guide. 

Hope this helps. 
Claire


On Mar 26, 2018, at 2:57 PM, Gilbert Nightray <gilbni...@gmail.com> wrote:

Excuse me... all the information of the poligons, mortality and vertical migration are in the output file of trajectories?? 
Reply all
Reply to author
Forward
0 new messages