[ncl-talk] creating daily files from hourly outputs

Karin Meier-Fleischer meier-fleischer at dkrz.de
Fri Jan 19 05:30:10 MST 2018


Hi Noelia,

NCL can't create a new file when it already exits. You have to make sure 
that the file doesn't exist or delete it before using addfile.

system("rm -rf "+file_out)
wrfpost = addfile(file_out,"c")

-Karin

Am 19.01.18 um 13:15 schrieb Noelia otero via ncl-talk:
> Hi all,
>
> I have hourly files from WRF and I wanted to create daily files (with 
> the hourly outputs, Time=24). I was using addfile(, "c")....I know the 
> error I got it is caused by "c", once the first file is created I 
> can´t opened again..(If I am not wrong, right?) Is there any way to do it?
>
> print(file_in)
> ; wrfout_d01_2010-01-01_00:00:00.nc <http://00.nc>
> wrfin = addfile(file_in,"r")
>
> ; I want the output: file_out=met_wrfout_d01_2010-01-01.nc 
> <http://met_wrfout_d01_2010-01-01.nc>
> wrfpost = addfile(file_out,"c")    ;create new netCDF file
>
> pres_pa = wrf_user_getvar(wrfin,"pres",-1)
> t_k = wrf_user_getvar(wrfin,"tk",-1)
>
> wrfpost->t_k= t_k
> wrfpost->pres_pa= pres_pa
>
> Time = wrf_user_getvar(wrfin,"Times",-1)
> lat = wrf_user_getvar(wrfin,"lat",-1)
> lon = wrf_user_getvar(wrfin,"lon",-1)
>
> wrfpost->time    = Time
> wrfpost->lat= lat
> wrfpost->lon= lon
>
>
> Thanks in advance,
> Best
> Noelia
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
Dipl. Geophys. Karin Meier-Fleischer
Visualization, NCL, CDO
Application Support

Deutsches Klimarechenzentrum GmbH (DKRZ)
Bundesstrasse 45a - D20146 Hamburg - Germany

Phone:    +49 (0)40 460094 126
Fax:      +49 (0)40 460094 270
E-Mail:   meier-fleischer at dkrz.de
URL:      www.dkrz.de

Geschäftsführer: Prof. Dr. Thomas Ludwig
Sitz der Gesellschaft: Hamburg
Amtsgericht Hamburg HRB 39784

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180119/cc736528/attachment.html>


More information about the ncl-talk mailing list