uataq / stilt-tutorials

12 stars 2 forks source link

difficulty in using <simulation_id>_traj.rds outputs for plotting #3

Closed ankitpatel0698 closed 3 years ago

ankitpatel0698 commented 3 years ago

As you are familiar; after running the STILT we get two types of output.

  1. footprints in .nc (netcdf) format
  2. particles tracjectory in .rds format.

From the above outputs I am able to plot footprints using .nc files (e.g. average_footprint.png) but I have no idea how to use .rds outputs. I am trying to create figures like 'average_contribution.png'. It seems like particle trajectory .rds output are combined with footprints .nc outputs for such figures. I have gone through tutorial.r script which you have used for creating ''average_contribution.html'' but it becomes confusing as that code used "emission.rds" dataset/inventory that is already provided by you in the repository. But here in the output i am getting _traj.rds files in out/particles folder. Can you please help me for creating such plots using _traj.rds files. Or do you have any code for that? average_contribution average_footprint

benfasoli commented 3 years ago

A good place to start would be the example code that demonstrates how to load the <simulation_id>_traj.rds files in the output files documentation.

The trajectories are used internally by STILT to calculate the footprints but shouldn't be needed to reproduce the above figures. You can view the tutorial code here where the above field is generated as the product of the footprint grid and the emission grid.

The footprint grid gives the sensitivity to fluxes originating from each cell. To link observations with gridded emissions, you'll need to download an emission inventory and format it such that the emission matrix dimensions match the footprint matrix dimensions. The specific inventory depends on what species you're interested in and where in the world you are trying to model.

ankitpatel0698 commented 3 years ago

Thanks again dear benfasoli. 2 more doubts i have --> numpar (number of particles) in rstilt.r namelist; depends on what factors. i.e. how should i decide its value 100,200,500,1000 or more? ---> if i want to use tracer concentration (e.g. particle/m3) for a specie, which variable in the rstilt.r is to be edited? ---> where can i find more info and significance about each variables used in rstilt.r namelist?

benfasoli commented 3 years ago

You can find documentation for the model configuration parameters on the STILT website and the HYSPLIT User's Guide.

Choosing a higher value for numpar will improve simulation accuracy but at the cost of additional computing time (near linear increase in compute duration with increase in ensemble size). Lowering numpar will speed up simulations but may result in additional grid noise, especially in the far (>24 hour) field. I'd suggest starting with the default 1,000 particles and modifying if needed depending on your simulation results.

STILT outputs footprints (tracer concentration per unit flux) and not direct tracer concentrations. If you'd like to use the spatial density of the particle ensemble, you can calculate this from the trajectory files. However, directly gridding the spatial density of particles loses out on the benefits of using the footprint calculation algorithm.