Re: Creating .nc files

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon, 16 Jul 2007 15:16:30 -0600 (MDT)

Hi Rosa,

Perhaps the files being written do are not being closed properly.
Right before the very last "end do", try adding the line:

     delete(ncdf)

Deleting the variable may force the file to close properly (Dave or
Rick, let me know if I'm wrong on this). I can't imagine what
else may be wrong.

Also, you have some places in your script that you can clean up a
little. It's not necessary to use ":" type syntax if you are using
the whole variable. It is more expensive to use this syntax as well.

Thus, lines like:

    latitude = f->lat(:)
    lon = f->lon(:)
    level=f->lev(:)

Should be changed to:

    latitude = f->lat
    lon = f->lon
    level=f->lev

Also:

    Q_sat(:,:,:,:) = 0.622*(sat_vap_pressure(:,:,:,:)/(pressure(:,:,:,:)-0.378*s\
at_vap_pressure(:,:,:,:)))

    RH(:,:,:,:) = (spec_hum(:,:,:,:)/Q_sat(:,:,:,:))*100.0

should be changed to:

    Q_sat = 0.622*(sat_vap_pressure/(pressure-0.378*sat_vap_pressure))

    RH = (spec_hum/Q_sat)*100.0

Finally, the code:

    do j = 0, dimsizes(level)-1
         pressure(:,j,:,:) = level(j)
    end do

can be rewritten using "conform":

         pressure = conform(pressure,level,1)

Cheers,

--Mary

On Mon, 16 Jul 2007, Rosa Maria Nascimento dos Santos wrote:

>
> Hi,
>
> I'm still having problems creating .nc files with NCL! I've created the
> file variables using "filevardef","filedimdef", and
> "filevarattdef". The problem is that NCL is creating the file that I want
> but it isn't writing the variables into the file. That's weird! I'm
> sending the script attached, if anyone could take a look at it?!
>
> Thanks,
>
> Rosa
>
> --
> Rosa Maria Nascimento dos Santos
> Doutora em Meteorologia
> LBA/INPA
> Tel: +55 92 36433623
> e-mail: rosasto_at_inpa.gov.br
> rosa_sto_at_yahoo.com
>
>
>
>
>
> --
> Rosa Maria Nascimento dos Santos
> Doutora em Meteorologia
> LBA/INPA
> Tel: +55 92 36433623
> e-mail: rosasto_at_inpa.gov.br
> rosa_sto_at_yahoo.com
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jul 16 2007 - 15:16:30 MDT

This archive was generated by hypermail 2.2.0 : Tue Jul 17 2007 - 06:52:01 MDT