[ncarg-talk] Easy File Input Output
Mary Haley
haley at ucar.edu
Mon Aug 22 09:45:57 MDT 2016
Dear Anthony,
In the future, please post your NCL questions to ncl-talk at ucar.edu:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
The ncarg-talk email list is for the older NCAR Graphics C/Fortran
interface, and is not very active.
Even though you are getting errors from opening the GRIB file, you might
still be able to access the variables in it.
However, you need to check the names because they may not be called
"HGT_6_SFC" or "NCPCP_6_SFC_acc", etc.
I suggest doing an ncl_filedump on the file first to see what the variables
look like. From a terminal window, type:
ncl_filedump gfs_3_20160814_0000_003.grb
Or you can insert a "print" command in your script after you open the file:
grib_file = addfile("gfs_3_20160814_0000_003.grb","r") ; Open GRIB file
to read
print(grib_file) ; this is similar to doing an "ncl_filedump"
You can also retrieve all the variable names on the file with:
var_names = getfilevarnames(grib_file)
print(var_names)
We would like to check the GRIB file to see if we can fix the warnings.
Can you tell me where I can download it from?
Thanks,
--Mary
On Sun, Aug 21, 2016 at 6:46 PM, Anthony Larosa <larosaant94 at gmail.com>
wrote:
> Good day all,
>
> Just downloaded an archived GFS data file from NOMADS.
>
> gfs_3_20160814_0000_003.grb
>
>
>
> Now I convert it to a NetCDF file by the following command:
>
> ~/nclDnS/datasets$ ncl_convert2nc gfs_3_20160814_0000_003.grb
>
> It does its thing and works, good now I want to practice with it.
> Therefore I use a script from the FAQ question section:
>
> begin
> grib_file = addfile("gfs_3_20160814_0000_003.grb","r") ; Open GRIB
> file to read
> ncfile_out = addfile("data.nc","c") ; Open NetCDF file to
> write
>
> ; Write some data to NetCDF file.
> ncfile_out->HGT = grib_file->HGT_6_SFC
> ncfile_out->A_PCP = grib_file->A_PCP_6_SFC_acc
> ncfile_out->NCPCP = grib_file->NCPCP_6_SFC_acc
> ncfile_out->ACPCP = grib_file->ACPCP_6_SFC_acc
> ncfile_out->CAPE = grib_file->CAPE_6_SFC
> end
>
> ERROR//
>
>
>
> Copyright (C) 1995-2015 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 6.3.0
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> warning:NclGRIB: Unrecognized parameter table (center 7, subcenter 0,
> table 255), defaulting to NCEP operational table: variable names and units
> may be incorrect
> warning:NclGRIB: Unknown grib parameter number detected (255, center 7,
> table version 255 grib record 3), using default variable name (VAR_255)
> warning:NclGRIB: Unknown grib parameter number detected (191, center 7,
> table version 133 grib record 308), using default variable name (VAR_191)
> fatal:["Execute.c":6332]:variable (HGT_6_SFC) is not in file (grib_file)
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 7 in
> file writegrib.ncl
>
>
>
> _______________________________________________
> ncarg-talk mailing list
> ncarg-talk at ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncarg-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncarg-talk/attachments/20160822/99615ae0/attachment.html
More information about the ncarg-talk
mailing list