[Wrf-users] Extracting time series at a given geographical position

Peter Tuju peterenos at ymail.com
Mon May 30 08:14:56 MDT 2016


Dear Thierry,Thank you very much for your tireless guide, now let me start from the scratch you have given me and pass through the perl scripting language. I will give you the feedback.
Thank once million times!
 _____________
Peter  E. Tuju
Dar es Salaam
T A N Z A N I A
---------------------- 

    On Monday, May 30, 2016 5:09 PM, HEDDE Thierry 137147 <thierry.hedde at cea.fr> wrote:
 

 #yiv9532706321 #yiv9532706321 -- _filtered #yiv9532706321 {font-family:Helvetica;panose-1:2 11 6 4 2 2 2 2 2 4;} _filtered #yiv9532706321 {font-family:Helvetica;panose-1:2 11 6 4 2 2 2 2 2 4;} _filtered #yiv9532706321 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;} _filtered #yiv9532706321 {font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;} _filtered #yiv9532706321 {font-family:Verdana;panose-1:2 11 6 4 3 5 4 4 2 4;} _filtered #yiv9532706321 {font-family:Garamond;panose-1:2 2 4 4 3 3 1 1 8 3;}#yiv9532706321 #yiv9532706321 p.yiv9532706321MsoNormal, #yiv9532706321 li.yiv9532706321MsoNormal, #yiv9532706321 div.yiv9532706321MsoNormal {margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}#yiv9532706321 a:link, #yiv9532706321 span.yiv9532706321MsoHyperlink {color:blue;text-decoration:underline;}#yiv9532706321 a:visited, #yiv9532706321 span.yiv9532706321MsoHyperlinkFollowed {color:purple;text-decoration:underline;}#yiv9532706321 p.yiv9532706321MsoAcetate, #yiv9532706321 li.yiv9532706321MsoAcetate, #yiv9532706321 div.yiv9532706321MsoAcetate {margin:0cm;margin-bottom:.0001pt;font-size:8.0pt;}#yiv9532706321 span.yiv9532706321EmailStyle17 {color:#1F497D;}#yiv9532706321 span.yiv9532706321TextedebullesCar {}#yiv9532706321 .yiv9532706321MsoChpDefault {font-size:10.0pt;} _filtered #yiv9532706321 {margin:70.85pt 70.85pt 70.85pt 70.85pt;}#yiv9532706321 div.yiv9532706321WordSection1 {}#yiv9532706321 Hi peter,    You may encapsulate theread_wrf_nc call in a shell or perl script in a loop, so you’ll be able to call read_wrf_nc at the locations you want using shell or perl arguments or even reading a list of the location you want. I have no simple examples of this, just go and see perl tutorials for this for example.    I join an example of a perl call togetTimeSerie function and the function itself in perl. You may get some hints from that. Of course it’s not usable like that and if you don’t know perl langage you should follow some tutos before.    Cheers Thierry    Example of making a list of variables to read for a given location and call reading the function   # ----------------------------------------------   $list_var="U10 V10 T2 Q2 RAINNC PSFC SNOWH TSK";            # V3.10 2016-01-14 add TSK reading (surface T)   # ----------------------------------------------   $level = 1;   $fileout="${dirout_arg}/${locname}${infixe}_d${domain}_${latlonhgt}_ground.dat";   $tmpfile = &getTimeSerie($WRFOUT_ptr, $latitude, $longitude, $list_var, $level, $fileout);       The timeserie reading function callingread_wrf_nc #  Extaction d'une serie temporelle quelconque d'un wrfout    sub getTimeSerie{   push(@subindent,$indent);      my ($WRFOUT_ptr, $latitude, $longitude, $vars, $level, $fileout) = @_;   my $subname = (caller(0))[3];   ($debug) && print  "@subindent>$subname>vars=$vars\n";     #On détruit le vieux fichier tsfileout sinon read_wrf_nc ajoute les extractions à la fin du fichier  my $tsfileout="TIME_SERIES.out"; # compulsory name from read_wrf_nc prm   (-e $tsfileout) && (unlink($tsfileout) || die "$pf>@subindent>$subname>ERROR: Cant erase file:$tsfileout\n");     #arguments   #     my $filein = "";    # Fichier wrfout à lire   #     my $latitude  = 0;  # Latitude du point à extraire   #     my $longitude = 0;  # Longiitude du point à extraire   #     my $vars      = ""; # Liste des variables à extraire   #     my $level     = ""; # Indice du niveau vertical d'extraction  #     my $fileout   = ""; # Fichier de sortie         my $tmpfile=$fileout.".tmp";      foreach my $filein(@$WRFOUT_ptr) {    ( -e $filein) || die "$pf>@subindent>$subname>ERROR le fichier wrfout...:$filein est introuvable\n";     print "$pf>@subindent>$subname>Treat $filein.\n";     # Lecture/ecriture des séries depuis le wrfout    if ($level) {              # One level is aked for       @args = ("$READ_WRF_NC $filein -rot -ts ll $latitude $longitude $vars -lev $level 2> read_wrf_nc.err");     } else {                      # all levels       @args = ("$READ_WRF_NC $filein -rot -ts ll $latitude $longitude $vars 2> read_wrf_nc.err");    }        print  "$pf>@subindent>$subname>@args\n";    system(@args) == 0 or die "$pf>@subindent>$subname>ERROR: Can't execute system command @args\n";   } # foreach my $filein(      if (-e "$tsfileout" ) {     ($debug) && print  "mv $tsfileout $tmpfile\n";    `mv $tsfileout $tmpfile`;   } else {     die "$pf>@subindent>$subname>ERREUR: Le fichier $tsfileout n'a pas été créé.";  }      pop(@subindent);   return($tmpfile); } #    De : Peter Tuju [mailto:peterenos at ymail.com]
Envoyé : lundi 30 mai 2016 15:53
À : wrf-users at ucar.edu; HEDDE Thierry 137147
Objet : Re: Extracting time series at a given geographical position    Dear Thierry,    I was succeeded to compile the read_wrf_nc.f and to extract T2 using the code "./read_wrf_nc wrfout_d02_2015-03-01 -w T2" which gives me the ascii file T2.out at every grid point, but I want to extract T2 at different specific locations say lat1, lat2, etc and lon1, lon2, etc. So, how can I do to solve this??.

 

 Also I, tried to use the ncl scrips you sent to me but it just gives me the ts output  in graphic format but I want to have in ascii format say .csv or .txt. 

 Please guide me once more again!   _____________
Peter  E. Tuju
Dar es Salaam
T A N Z A N I A
----------------------    On Friday, May 27, 2016 7:21 AM, Peter Tuju <peterenos at ymail.com> wrote:      _____________
Peter  E. Tuju
Dar es Salaam
T A N Z A N I A
----------------------    On Thursday, May 26, 2016 12:53 PM, HEDDE Thierry 137147 <thierry.hedde at cea.fr> wrote:    Hi peter,

To do this job you may use this tool :
http://www2.mmm.ucar.edu/wrf/src/read_wrf_nc.f
it's easy to use. I don't use NCL for extracting this kind of variables which are directly available from the wrfout file.

But of course you may use one of the script given on NCL site as the one I joined which I used some time ago
Or use the scripts given here :
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/SPECIAL/meteograms.htm

Have fun!
Cheers
Thierry

-----Message d'origine-----
De : wrf-users-bounces at ucar.edu [mailto:wrf-users-bounces at ucar.edu] De la part dewrf-users-request at ucar.edu
Envoyé : mercredi 25 mai 2016 20:00
À : wrf-users at ucar.edu
Objet : Wrf-users Digest, Vol 141, Issue 15

Send Wrf-users mailing list submissions to
    wrf-users at ucar.edu

To subscribe or unsubscribe via the World Wide Web, visit
    http://mailman.ucar.edu/mailman/listinfo/wrf-users
or, via email, send a message with subject or body 'help' to
    wrf-users-request at ucar.edu

You can reach the person managing the list at
    wrf-users-owner at ucar.edu

When replying, please edit your Subject line so it is more specific than "Re: Contents of Wrf-users digest..."


Today's Topics:

  1. Re: NCL Script to extract ASCII data from wrfout (Peter Tuju)


----------------------------------------------------------------------

Message: 1
Date: Wed, 25 May 2016 04:37:40 +0000 (UTC)
From: Peter Tuju <peterenos at ymail.com>
Subject: Re: [Wrf-users] NCL Script to extract ASCII data from wrfout
To: "wrf-users-request at ucar.edu" <wrf-users-request at ucar.edu>,
    wrf-users at ucar.edu
Message-ID:
    <316471855.208077.1464151060245.JavaMail.yahoo at mail.yahoo.com>
Content-Type: text/plain; charset="utf-8"

blockquote, div.yahoo_quoted { margin-left: 0 !important; border-left:1px #715FFA solid !important; padding-left:1ex !important; background-color:white !important; } Dear wrf users,?Please help me with the ncl script to extract ascii parameters say RAINC, RAINNC, T2, RH, U_10m, V_10m etc from wrfout.nc at a specific point latitude and longitude ?and save the output in a . csv or . txt format. Please help, I'm totally bored now!!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/wrf-users/attachments/20160525/3c78d6bc/attachment-0001.html

------------------------------

_______________________________________________
Wrf-users mailing list
Wrf-users at ucar.edu
http://mailman.ucar.edu/mailman/listinfo/wrf-users


End of Wrf-users Digest, Vol 141, Issue 15
******************************************    

  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/wrf-users/attachments/20160530/418ccb17/attachment-0001.html 


More information about the Wrf-users mailing list