geoscience-community-codes / tephra2

Tephra2 is a tephra dispersion simulation tool, used to estimate the mass of tephra that will accumulate at a site or over a region, given explosive eruption conditions.
https://gscommunitycodes.usf.edu/geoscicommunitycodes/public/tephra2/tephra2.php
GNU General Public License v3.0
14 stars 11 forks source link

add script to extract wind data #5

Closed mhagdorn closed 2 years ago

mhagdorn commented 2 years ago

I have written a python3 script that uses xarray to load the reanalysis data from a set of netCDF files and produces the input file required by tephra2. A location and date is specified on the command line.

ljc-geo commented 2 years ago

Great! I am checking the script out now. Could you provide a list of dependencies needed to run the script? Thanks! --Laura

mhagdorn commented 2 years ago

other than standard python3 library it needs xarray and numpy

ljc-geo commented 2 years ago

You mention the purpose of the script is to" load the reanalysis data from a set of netCDF files", which netCDF files are you using or referring to? Sorry, I am just trying to understand your workflow. Thanks!

mhagdorn commented 2 years ago

xarray can handle any number of files to create a single dataset. The files need to contain uwnd vwnd and hgt. The location is specified on the command line using the -l option (either a float or in the format 1d2'3"N). The date is specified as yyyy-mm-dd. if there are multiple time slices with that date an average is formed. so I ran the script using

python3 extract_reanalysis_data.py *.nc -l 1°12\'60.00\"N 77°21\'59.99\"W -d 1997-1-1

where I have netCDF files hgt_1997.nc, uwnd_1997.nc and vwnd_1997.nc

hope this helps

ljc-geo commented 2 years ago

Hi Magnus,

Are working with Julia? This script is a nice addition especially if someone is not familiar with perl. I will give it a try, again, and figure out what I need to do to merge it with the geoscience community codes version of tephra 2. Thank you!

Laura Connor School of Geosciences​ University of South Florida Tampa, Florida 33620


From: Magnus Hagdorn @.> Sent: Tuesday, March 15, 2022 2:10 PM To: geoscience-community-codes/tephra2 @.> Cc: Laura Connor @.>; Comment @.> Subject: Re: [geoscience-community-codes/tephra2] add script to extract wind data (PR #5)

xarray can handle any number of files to create a single dataset. The files need to contain uwnd vwnd and hgt. The location is specified on the command line using the -l option (either a float or in the format 1d2'3"N). The date is specified as yyyy-mm-dd. if there are multiple time slices with that date an average is formed. so I ran the script using

python3 extract_reanalysis_data.py *.nc -l 1°12\'60.00\"N 77°21\'59.99\"W -d 1997-1-1

where I have netCDF files hgt_1997.nc, uwnd_1997.nc and vwnd_1997.nc

hope this helps

— Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgeoscience-community-codes%2Ftephra2%2Fpull%2F5%23issuecomment-1068301353&data=04%7C01%7Clconnor%40usf.edu%7C817a8d3da75c46ccf4d808da06af10bd%7C741bf7dee2e546df8d6782607df9deaa%7C0%7C0%7C637829646210064513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=%2BzgWRJ4%2BQ6vqB59ObzBMx4Z%2BegvyQfw%2Fi82qSNMKSBU%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABF6GGFV47FJ4QGQHNEIJ53VADHAVANCNFSM5QVL2DSA&data=04%7C01%7Clconnor%40usf.edu%7C817a8d3da75c46ccf4d808da06af10bd%7C741bf7dee2e546df8d6782607df9deaa%7C0%7C0%7C637829646210064513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=y6sTugCYOEIxrCpfACZZlsMdpsupWKROU03f%2BgrSuj4%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Clconnor%40usf.edu%7C817a8d3da75c46ccf4d808da06af10bd%7C741bf7dee2e546df8d6782607df9deaa%7C0%7C0%7C637829646210064513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=IHVAjVeLQRXlqlEKk%2B3hruHNMp%2FlF9Ip%2FJ6hNIeXKWE%3D&reserved=0 or Androidhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Clconnor%40usf.edu%7C817a8d3da75c46ccf4d808da06af10bd%7C741bf7dee2e546df8d6782607df9deaa%7C0%7C0%7C637829646210064513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=JIgfF%2FADpxTLJ57yBBgVTrATQRk4%2FA3k4Dn6hYUirC8%3D&reserved=0. You are receiving this because you commented.Message ID: @.***>

[EXTERNAL EMAIL] DO NOT CLICK links or attachments unless you recognize the sender and know the content is safe.