[Met_help] [rt.rap.ucar.edu #94280] History for Question to read NetCDF file

John Halley Gotway via RT met_help at ucar.edu
Wed Apr 1 11:04:37 MDT 2020


----------------------------------------------------------------
  Initial Request
----------------------------------------------------------------

Hi,


I'm Yuqi Zhang, a graduate student in University of Kansas. I was trying to use MET to process the data. I have WRF daily data which are aggregated and written in a netCDF file via python. I tried to change the netCDF file to look like similar as pcp_combine output (I don't have the original wrf out to use UPP and pcp_combine). I add all the attributes of the variables and also in global attributes, and it looks the same as the file from pcp_combine if I use 'ncdump -h file' to check the header information. However, the MET can't read the variable when I try to plot the data using plot_data_plane. Below are the error I met:

    ERROR  :
    ERROR  : yyerror() -> syntax error in file "config_111497_0_.temp"
    ERROR  :
    ERROR  :    line   = 2
    ERROR  :
    ERROR  :    column = 1
    ERROR  :
    ERROR  :    text   = "(nul)"
    ERROR  :
    ERROR  :
    ERROR  : (nul)
    ERROR  : (nul)
    ERROR  :


Below are the error in the log file (config_111497?_0_.temp?):

    name="APCP_01"; level="A1"


It looks like it's not be able to recognize the variable field although I've add the 'name' and 'level' attributes to my netCDF data. The attributes I dump from my file are shown below:

    netcdf wrf_daily_2002-06-01 {
    dimensions:
        lat = 936 ;
        lon = 1986 ;
    variables:
        float APCP_01(lat, lon) ;
        APCP_01:_FillValue = -9999.f ;
        APCP_01:name = "APCP_01" ;
        APCP_01:long_name = "Total Precipitation" ;
        APCP_01:level = "A1" ;
        APCP_01:units = "kg/m^2" ;
        APCP_01:init_time = "19991101_000000" ;
        APCP_01:init_time_ut = "1022889600" ;
        APCP_01:valid_time = "20020602_000000" ;
        APCP_01:valid_time_ut = "1022976000" ;
        APCP_01:accum_time = "240000" ;
        APCP_01:accum_time_sec = "86400" ;
        float lat(lat, lon) ;
        lat:long_name = "latitude" ;
        lat:units = "degrees_north" ;
        lat:standard_name = "latitude" ;
        float lon(lat, lon) ;
        lon:long_name = "longitude" ;
        lon:units = "degrees_east" ;
        lon:standard_name = "longitude" ;

    // global attributes:
        :Description = "NASA Downscaling NU-WRF 4km N600 output aggregate to daily precipitation" ;
        :Projection = "Lambert Conformal" ;
        :scale_lat1 = "15.000000" ;
        :scale_lat2 = "15.000000" ;
        :lon_orient = "-93.000000" ;
        :d_km = "4.000000" ;
        :r_km = "6371.200000" ;
        :nx = "1986" ;
        :ny = "936 grid_points" ;


I don't know why the MET can't read the file. Could you help to answer my question? Is there anything else I need to do except adding the variable attributes to a netCDF file so that it can be read by MET?


Thanks


Yuqi


----------------------------------------------------------------
  Complete Ticket History
----------------------------------------------------------------

Subject: Question to read NetCDF file
From: John Halley Gotway
Time: Mon Feb 24 22:28:40 2020

Yuqi,

This type of "syntax" error you're seeing indicates a problem in the
configuration string you're using.  This is an easy fix.  You're just
missing a trailing semicolon:

*name="APCP_01"; level="A1";*

Each configuration entry should be terminated by a semicolon.

Thanks,
John Halley Gotway

On Fri, Feb 21, 2020 at 6:38 PM Zhang, Yuqi via RT <met_help at ucar.edu>
wrote:

>
> Fri Feb 21 16:38:54 2020: Request 94280 was acted upon.
> Transaction: Ticket created by yqzhang at ku.edu
>        Queue: met_help
>      Subject: Question to read NetCDF file
>        Owner: Nobody
>   Requestors: yqzhang at ku.edu
>       Status: new
>  Ticket <URL:
https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=94280 >
>
>
> Hi,
>
>
> I'm Yuqi Zhang, a graduate student in University of Kansas. I was
trying
> to use MET to process the data. I have WRF daily data which are
aggregated
> and written in a netCDF file via python. I tried to change the
netCDF file
> to look like similar as pcp_combine output (I don't have the
original wrf
> out to use UPP and pcp_combine). I add all the attributes of the
variables
> and also in global attributes, and it looks the same as the file
from
> pcp_combine if I use 'ncdump -h file' to check the header
information.
> However, the MET can't read the variable when I try to plot the data
using
> plot_data_plane. Below are the error I met:
>
>     ERROR  :
>     ERROR  : yyerror() -> syntax error in file
"config_111497_0_.temp"
>     ERROR  :
>     ERROR  :    line   = 2
>     ERROR  :
>     ERROR  :    column = 1
>     ERROR  :
>     ERROR  :    text   = "(nul)"
>     ERROR  :
>     ERROR  :
>     ERROR  : (nul)
>     ERROR  : (nul)
>     ERROR  :
>
>
> Below are the error in the log file (config_111497?_0_.temp?):
>
>     name="APCP_01"; level="A1"
>
>
> It looks like it's not be able to recognize the variable field
although
> I've add the 'name' and 'level' attributes to my netCDF data. The
> attributes I dump from my file are shown below:
>
>     netcdf wrf_daily_2002-06-01 {
>     dimensions:
>         lat = 936 ;
>         lon = 1986 ;
>     variables:
>         float APCP_01(lat, lon) ;
>         APCP_01:_FillValue = -9999.f ;
>         APCP_01:name = "APCP_01" ;
>         APCP_01:long_name = "Total Precipitation" ;
>         APCP_01:level = "A1" ;
>         APCP_01:units = "kg/m^2" ;
>         APCP_01:init_time = "19991101_000000" ;
>         APCP_01:init_time_ut = "1022889600" ;
>         APCP_01:valid_time = "20020602_000000" ;
>         APCP_01:valid_time_ut = "1022976000" ;
>         APCP_01:accum_time = "240000" ;
>         APCP_01:accum_time_sec = "86400" ;
>         float lat(lat, lon) ;
>         lat:long_name = "latitude" ;
>         lat:units = "degrees_north" ;
>         lat:standard_name = "latitude" ;
>         float lon(lat, lon) ;
>         lon:long_name = "longitude" ;
>         lon:units = "degrees_east" ;
>         lon:standard_name = "longitude" ;
>
>     // global attributes:
>         :Description = "NASA Downscaling NU-WRF 4km N600 output
aggregate
> to daily precipitation" ;
>         :Projection = "Lambert Conformal" ;
>         :scale_lat1 = "15.000000" ;
>         :scale_lat2 = "15.000000" ;
>         :lon_orient = "-93.000000" ;
>         :d_km = "4.000000" ;
>         :r_km = "6371.200000" ;
>         :nx = "1986" ;
>         :ny = "936 grid_points" ;
>
>
> I don't know why the MET can't read the file. Could you help to
answer my
> question? Is there anything else I need to do except adding the
variable
> attributes to a netCDF file so that it can be read by MET?
>
>
> Thanks
>
>
> Yuqi
>
>

------------------------------------------------
Subject: Re: [rt.rap.ucar.edu #94280] Question to read NetCDF file
From: Zhang, Yuqi
Time: Wed Feb 26 14:51:55 2020

Hi,

Thanks for your information. Now I met with another problem that it
says the accum_time_sec in global attributes should be an integer. I
was using netcdf package in python to write the header. It
automatically transform the header information to string even I assign
the number as an integer to the attribute. I'm wondering if you know
how I can make the header information to be an integer.

Thank you.

Yuqi
________________________________________
From: John Halley Gotway via RT <met_help at ucar.edu>
Sent: Monday, February 24, 2020 11:28 PM
To: Zhang, Yuqi
Subject: Re: [rt.rap.ucar.edu #94280] Question to read NetCDF file

Yuqi,

This type of "syntax" error you're seeing indicates a problem in the
configuration string you're using.  This is an easy fix.  You're just
missing a trailing semicolon:

*name="APCP_01"; level="A1";*

Each configuration entry should be terminated by a semicolon.

Thanks,
John Halley Gotway

On Fri, Feb 21, 2020 at 6:38 PM Zhang, Yuqi via RT <met_help at ucar.edu>
wrote:

>
> Fri Feb 21 16:38:54 2020: Request 94280 was acted upon.
> Transaction: Ticket created by yqzhang at ku.edu
>        Queue: met_help
>      Subject: Question to read NetCDF file
>        Owner: Nobody
>   Requestors: yqzhang at ku.edu
>       Status: new
>  Ticket <URL:
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Frt.rap.ucar.edu%2Frt%2FTicket%2FDisplay.html%3Fid%3D94280&data=02%7C01%7Cyqzhang%40ku.edu%7C9c7d31971b5b4e90d82e08d7b9b393c1%7C3c176536afe643f5b96636feabbe3c1a%7C0%7C0%7C637182053259076513&sdata=9OPxqDsIt2b%2BS40zTPNAIG5xaducAADyosxXSLLcezo%3D&reserved=0
>
>
>
> Hi,
>
>
> I'm Yuqi Zhang, a graduate student in University of Kansas. I was
trying
> to use MET to process the data. I have WRF daily data which are
aggregated
> and written in a netCDF file via python. I tried to change the
netCDF file
> to look like similar as pcp_combine output (I don't have the
original wrf
> out to use UPP and pcp_combine). I add all the attributes of the
variables
> and also in global attributes, and it looks the same as the file
from
> pcp_combine if I use 'ncdump -h file' to check the header
information.
> However, the MET can't read the variable when I try to plot the data
using
> plot_data_plane. Below are the error I met:
>
>     ERROR  :
>     ERROR  : yyerror() -> syntax error in file
"config_111497_0_.temp"
>     ERROR  :
>     ERROR  :    line   = 2
>     ERROR  :
>     ERROR  :    column = 1
>     ERROR  :
>     ERROR  :    text   = "(nul)"
>     ERROR  :
>     ERROR  :
>     ERROR  : (nul)
>     ERROR  : (nul)
>     ERROR  :
>
>
> Below are the error in the log file (config_111497?_0_.temp?):
>
>     name="APCP_01"; level="A1"
>
>
> It looks like it's not be able to recognize the variable field
although
> I've add the 'name' and 'level' attributes to my netCDF data. The
> attributes I dump from my file are shown below:
>
>     netcdf wrf_daily_2002-06-01 {
>     dimensions:
>         lat = 936 ;
>         lon = 1986 ;
>     variables:
>         float APCP_01(lat, lon) ;
>         APCP_01:_FillValue = -9999.f ;
>         APCP_01:name = "APCP_01" ;
>         APCP_01:long_name = "Total Precipitation" ;
>         APCP_01:level = "A1" ;
>         APCP_01:units = "kg/m^2" ;
>         APCP_01:init_time = "19991101_000000" ;
>         APCP_01:init_time_ut = "1022889600" ;
>         APCP_01:valid_time = "20020602_000000" ;
>         APCP_01:valid_time_ut = "1022976000" ;
>         APCP_01:accum_time = "240000" ;
>         APCP_01:accum_time_sec = "86400" ;
>         float lat(lat, lon) ;
>         lat:long_name = "latitude" ;
>         lat:units = "degrees_north" ;
>         lat:standard_name = "latitude" ;
>         float lon(lat, lon) ;
>         lon:long_name = "longitude" ;
>         lon:units = "degrees_east" ;
>         lon:standard_name = "longitude" ;
>
>     // global attributes:
>         :Description = "NASA Downscaling NU-WRF 4km N600 output
aggregate
> to daily precipitation" ;
>         :Projection = "Lambert Conformal" ;
>         :scale_lat1 = "15.000000" ;
>         :scale_lat2 = "15.000000" ;
>         :lon_orient = "-93.000000" ;
>         :d_km = "4.000000" ;
>         :r_km = "6371.200000" ;
>         :nx = "1986" ;
>         :ny = "936 grid_points" ;
>
>
> I don't know why the MET can't read the file. Could you help to
answer my
> question? Is there anything else I need to do except adding the
variable
> attributes to a netCDF file so that it can be read by MET?
>
>
> Thanks
>
>
> Yuqi
>
>



------------------------------------------------
Subject: Question to read NetCDF file
From: John Halley Gotway
Time: Wed Feb 26 15:25:17 2020

Yuqi,

I don't know what your python code looks like, but you should just be
able
to wrap it with "int()" to convert the string to an integer:

[johnhg at number5]% python
Python 2.7.13 (default, Sep 26 2018, 18:42:22)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a="123"
>>> a
'123'
>>> int(a)
123

On Wed, Feb 26, 2020 at 2:52 PM Zhang, Yuqi via RT <met_help at ucar.edu>
wrote:

>
> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=94280 >
>
> Hi,
>
> Thanks for your information. Now I met with another problem that it
says
> the accum_time_sec in global attributes should be an integer. I was
using
> netcdf package in python to write the header. It automatically
transform
> the header information to string even I assign the number as an
integer to
> the attribute. I'm wondering if you know how I can make the header
> information to be an integer.
>
> Thank you.
>
> Yuqi
> ________________________________________
> From: John Halley Gotway via RT <met_help at ucar.edu>
> Sent: Monday, February 24, 2020 11:28 PM
> To: Zhang, Yuqi
> Subject: Re: [rt.rap.ucar.edu #94280] Question to read NetCDF file
>
> Yuqi,
>
> This type of "syntax" error you're seeing indicates a problem in the
> configuration string you're using.  This is an easy fix.  You're
just
> missing a trailing semicolon:
>
> *name="APCP_01"; level="A1";*
>
> Each configuration entry should be terminated by a semicolon.
>
> Thanks,
> John Halley Gotway
>
> On Fri, Feb 21, 2020 at 6:38 PM Zhang, Yuqi via RT
<met_help at ucar.edu>
> wrote:
>
> >
> > Fri Feb 21 16:38:54 2020: Request 94280 was acted upon.
> > Transaction: Ticket created by yqzhang at ku.edu
> >        Queue: met_help
> >      Subject: Question to read NetCDF file
> >        Owner: Nobody
> >   Requestors: yqzhang at ku.edu
> >       Status: new
> >  Ticket <URL:
>
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Frt.rap.ucar.edu%2Frt%2FTicket%2FDisplay.html%3Fid%3D94280&data=02%7C01%7Cyqzhang%40ku.edu%7C9c7d31971b5b4e90d82e08d7b9b393c1%7C3c176536afe643f5b96636feabbe3c1a%7C0%7C0%7C637182053259076513&sdata=9OPxqDsIt2b%2BS40zTPNAIG5xaducAADyosxXSLLcezo%3D&reserved=0
> >
> >
> >
> > Hi,
> >
> >
> > I'm Yuqi Zhang, a graduate student in University of Kansas. I was
trying
> > to use MET to process the data. I have WRF daily data which are
> aggregated
> > and written in a netCDF file via python. I tried to change the
netCDF
> file
> > to look like similar as pcp_combine output (I don't have the
original wrf
> > out to use UPP and pcp_combine). I add all the attributes of the
> variables
> > and also in global attributes, and it looks the same as the file
from
> > pcp_combine if I use 'ncdump -h file' to check the header
information.
> > However, the MET can't read the variable when I try to plot the
data
> using
> > plot_data_plane. Below are the error I met:
> >
> >     ERROR  :
> >     ERROR  : yyerror() -> syntax error in file
"config_111497_0_.temp"
> >     ERROR  :
> >     ERROR  :    line   = 2
> >     ERROR  :
> >     ERROR  :    column = 1
> >     ERROR  :
> >     ERROR  :    text   = "(nul)"
> >     ERROR  :
> >     ERROR  :
> >     ERROR  : (nul)
> >     ERROR  : (nul)
> >     ERROR  :
> >
> >
> > Below are the error in the log file (config_111497?_0_.temp?):
> >
> >     name="APCP_01"; level="A1"
> >
> >
> > It looks like it's not be able to recognize the variable field
although
> > I've add the 'name' and 'level' attributes to my netCDF data. The
> > attributes I dump from my file are shown below:
> >
> >     netcdf wrf_daily_2002-06-01 {
> >     dimensions:
> >         lat = 936 ;
> >         lon = 1986 ;
> >     variables:
> >         float APCP_01(lat, lon) ;
> >         APCP_01:_FillValue = -9999.f ;
> >         APCP_01:name = "APCP_01" ;
> >         APCP_01:long_name = "Total Precipitation" ;
> >         APCP_01:level = "A1" ;
> >         APCP_01:units = "kg/m^2" ;
> >         APCP_01:init_time = "19991101_000000" ;
> >         APCP_01:init_time_ut = "1022889600" ;
> >         APCP_01:valid_time = "20020602_000000" ;
> >         APCP_01:valid_time_ut = "1022976000" ;
> >         APCP_01:accum_time = "240000" ;
> >         APCP_01:accum_time_sec = "86400" ;
> >         float lat(lat, lon) ;
> >         lat:long_name = "latitude" ;
> >         lat:units = "degrees_north" ;
> >         lat:standard_name = "latitude" ;
> >         float lon(lat, lon) ;
> >         lon:long_name = "longitude" ;
> >         lon:units = "degrees_east" ;
> >         lon:standard_name = "longitude" ;
> >
> >     // global attributes:
> >         :Description = "NASA Downscaling NU-WRF 4km N600 output
aggregate
> > to daily precipitation" ;
> >         :Projection = "Lambert Conformal" ;
> >         :scale_lat1 = "15.000000" ;
> >         :scale_lat2 = "15.000000" ;
> >         :lon_orient = "-93.000000" ;
> >         :d_km = "4.000000" ;
> >         :r_km = "6371.200000" ;
> >         :nx = "1986" ;
> >         :ny = "936 grid_points" ;
> >
> >
> > I don't know why the MET can't read the file. Could you help to
answer my
> > question? Is there anything else I need to do except adding the
variable
> > attributes to a netCDF file so that it can be read by MET?
> >
> >
> > Thanks
> >
> >
> > Yuqi
> >
> >
>
>
>
>

------------------------------------------------
Subject: Re: [rt.rap.ucar.edu #94280] Question to read NetCDF file
From: Zhang, Yuqi
Time: Wed Feb 26 15:55:22 2020

Hi,

I did the same thing. Here's part of my code:
        pcp.init_time = sdtime+'_000000'
        pcp.init_time_ut = tstamp0
        pcp.valid_time = vdtime+'_000000'
        pcp.valid_time_ut = vtstamp
        pcp.accum_time = '240000'
        pcp.accum_time_sec = int(86400)

However, when I dump the header of nc file, it looks like this:
	float APCP_01(lat, lon) ;
		APCP_01:_FillValue = -9999.f ;
		APCP_01:name = "APCP_01" ;
		APCP_01:long_name = "Total Precipitation" ;
		APCP_01:level = "A1" ;
		APCP_01:units = "kg/m^2" ;
		APCP_01:init_time = "19991101_000000" ;
		APCP_01:init_time_ut = "1022889600" ;
		APCP_01:valid_time = "20020602_000000" ;
		APCP_01:valid_time_ut = "1022976000" ;
		APCP_01:accum_time = "240000" ;
		APCP_01:accum_time_sec = 86400LL ;

There're two extra letter "LL" after the integer. Therefore, to plot
it using MET cause error below:
DEBUG 1: Opening data file: /panfs/pfs.local/work/water/y341z564/nu-
wrf/MET/output/wrf_daily_2002-06-01.nc
ERROR  :
ERROR  : get_att_int(const NcVarInfo &, const ConcatString &, int &)
-> attribute "accum_time_sec" should be an integer.
ERROR  :

I don't know why it automatically changed in the header and how to
solve this.

Yuqi

________________________________________
From: John Halley Gotway via RT <met_help at ucar.edu>
Sent: Wednesday, February 26, 2020 4:25 PM
To: Zhang, Yuqi
Subject: Re: [rt.rap.ucar.edu #94280] Question to read NetCDF file

Yuqi,

I don't know what your python code looks like, but you should just be
able
to wrap it with "int()" to convert the string to an integer:

[johnhg at number5]% python
Python 2.7.13 (default, Sep 26 2018, 18:42:22)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a="123"
>>> a
'123'
>>> int(a)
123

On Wed, Feb 26, 2020 at 2:52 PM Zhang, Yuqi via RT <met_help at ucar.edu>
wrote:

>
> <URL:
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Frt.rap.ucar.edu%2Frt%2FTicket%2FDisplay.html%3Fid%3D94280&data=02%7C01%7Cyqzhang%40ku.edu%7Ca6e49c02087645850c7208d7bb0ac3c7%7C3c176536afe643f5b96636feabbe3c1a%7C0%7C0%7C637183527232048899&sdata=zGHlgkikIaETyoCYWKETigOigoKhIbhM%2FwkIkA6BQfs%3D&reserved=0
>
>
> Hi,
>
> Thanks for your information. Now I met with another problem that it
says
> the accum_time_sec in global attributes should be an integer. I was
using
> netcdf package in python to write the header. It automatically
transform
> the header information to string even I assign the number as an
integer to
> the attribute. I'm wondering if you know how I can make the header
> information to be an integer.
>
> Thank you.
>
> Yuqi
> ________________________________________
> From: John Halley Gotway via RT <met_help at ucar.edu>
> Sent: Monday, February 24, 2020 11:28 PM
> To: Zhang, Yuqi
> Subject: Re: [rt.rap.ucar.edu #94280] Question to read NetCDF file
>
> Yuqi,
>
> This type of "syntax" error you're seeing indicates a problem in the
> configuration string you're using.  This is an easy fix.  You're
just
> missing a trailing semicolon:
>
> *name="APCP_01"; level="A1";*
>
> Each configuration entry should be terminated by a semicolon.
>
> Thanks,
> John Halley Gotway
>
> On Fri, Feb 21, 2020 at 6:38 PM Zhang, Yuqi via RT
<met_help at ucar.edu>
> wrote:
>
> >
> > Fri Feb 21 16:38:54 2020: Request 94280 was acted upon.
> > Transaction: Ticket created by yqzhang at ku.edu
> >        Queue: met_help
> >      Subject: Question to read NetCDF file
> >        Owner: Nobody
> >   Requestors: yqzhang at ku.edu
> >       Status: new
> >  Ticket <URL:
>
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Frt.rap.ucar.edu%2Frt%2FTicket%2FDisplay.html%3Fid%3D94280&data=02%7C01%7Cyqzhang%40ku.edu%7Ca6e49c02087645850c7208d7bb0ac3c7%7C3c176536afe643f5b96636feabbe3c1a%7C0%7C0%7C637183527232048899&sdata=zGHlgkikIaETyoCYWKETigOigoKhIbhM%2FwkIkA6BQfs%3D&reserved=0
> >
> >
> >
> > Hi,
> >
> >
> > I'm Yuqi Zhang, a graduate student in University of Kansas. I was
trying
> > to use MET to process the data. I have WRF daily data which are
> aggregated
> > and written in a netCDF file via python. I tried to change the
netCDF
> file
> > to look like similar as pcp_combine output (I don't have the
original wrf
> > out to use UPP and pcp_combine). I add all the attributes of the
> variables
> > and also in global attributes, and it looks the same as the file
from
> > pcp_combine if I use 'ncdump -h file' to check the header
information.
> > However, the MET can't read the variable when I try to plot the
data
> using
> > plot_data_plane. Below are the error I met:
> >
> >     ERROR  :
> >     ERROR  : yyerror() -> syntax error in file
"config_111497_0_.temp"
> >     ERROR  :
> >     ERROR  :    line   = 2
> >     ERROR  :
> >     ERROR  :    column = 1
> >     ERROR  :
> >     ERROR  :    text   = "(nul)"
> >     ERROR  :
> >     ERROR  :
> >     ERROR  : (nul)
> >     ERROR  : (nul)
> >     ERROR  :
> >
> >
> > Below are the error in the log file (config_111497?_0_.temp?):
> >
> >     name="APCP_01"; level="A1"
> >
> >
> > It looks like it's not be able to recognize the variable field
although
> > I've add the 'name' and 'level' attributes to my netCDF data. The
> > attributes I dump from my file are shown below:
> >
> >     netcdf wrf_daily_2002-06-01 {
> >     dimensions:
> >         lat = 936 ;
> >         lon = 1986 ;
> >     variables:
> >         float APCP_01(lat, lon) ;
> >         APCP_01:_FillValue = -9999.f ;
> >         APCP_01:name = "APCP_01" ;
> >         APCP_01:long_name = "Total Precipitation" ;
> >         APCP_01:level = "A1" ;
> >         APCP_01:units = "kg/m^2" ;
> >         APCP_01:init_time = "19991101_000000" ;
> >         APCP_01:init_time_ut = "1022889600" ;
> >         APCP_01:valid_time = "20020602_000000" ;
> >         APCP_01:valid_time_ut = "1022976000" ;
> >         APCP_01:accum_time = "240000" ;
> >         APCP_01:accum_time_sec = "86400" ;
> >         float lat(lat, lon) ;
> >         lat:long_name = "latitude" ;
> >         lat:units = "degrees_north" ;
> >         lat:standard_name = "latitude" ;
> >         float lon(lat, lon) ;
> >         lon:long_name = "longitude" ;
> >         lon:units = "degrees_east" ;
> >         lon:standard_name = "longitude" ;
> >
> >     // global attributes:
> >         :Description = "NASA Downscaling NU-WRF 4km N600 output
aggregate
> > to daily precipitation" ;
> >         :Projection = "Lambert Conformal" ;
> >         :scale_lat1 = "15.000000" ;
> >         :scale_lat2 = "15.000000" ;
> >         :lon_orient = "-93.000000" ;
> >         :d_km = "4.000000" ;
> >         :r_km = "6371.200000" ;
> >         :nx = "1986" ;
> >         :ny = "936 grid_points" ;
> >
> >
> > I don't know why the MET can't read the file. Could you help to
answer my
> > question? Is there anything else I need to do except adding the
variable
> > attributes to a netCDF file so that it can be read by MET?
> >
> >
> > Thanks
> >
> >
> > Yuqi
> >
> >
>
>
>
>



------------------------------------------------
Subject: Question to read NetCDF file
From: John Halley Gotway
Time: Wed Feb 26 16:51:05 2020

Yuqi,

OK, I was able to reproduce the situation you're in, and I see what's
happening.

Please try using:
   import numpy as np
   pcp.accum_time_sec = np.int32(86400)

Hopefully that'll have the desired effect.  Obviously, it'd be better
if
the MET code would handle either variant.

Thanks,
John

On Wed, Feb 26, 2020 at 3:55 PM Zhang, Yuqi via RT <met_help at ucar.edu>
wrote:

>
> <URL: https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=94280 >
>
> Hi,
>
> I did the same thing. Here's part of my code:
>         pcp.init_time = sdtime+'_000000'
>         pcp.init_time_ut = tstamp0
>         pcp.valid_time = vdtime+'_000000'
>         pcp.valid_time_ut = vtstamp
>         pcp.accum_time = '240000'
>         pcp.accum_time_sec = int(86400)
>
> However, when I dump the header of nc file, it looks like this:
>         float APCP_01(lat, lon) ;
>                 APCP_01:_FillValue = -9999.f ;
>                 APCP_01:name = "APCP_01" ;
>                 APCP_01:long_name = "Total Precipitation" ;
>                 APCP_01:level = "A1" ;
>                 APCP_01:units = "kg/m^2" ;
>                 APCP_01:init_time = "19991101_000000" ;
>                 APCP_01:init_time_ut = "1022889600" ;
>                 APCP_01:valid_time = "20020602_000000" ;
>                 APCP_01:valid_time_ut = "1022976000" ;
>                 APCP_01:accum_time = "240000" ;
>                 APCP_01:accum_time_sec = 86400LL ;
>
> There're two extra letter "LL" after the integer. Therefore, to plot
it
> using MET cause error below:
> DEBUG 1: Opening data file:
> /panfs/pfs.local/work/water/y341z564/nu-wrf/MET/output/
> wrf_daily_2002-06-01.nc
> ERROR  :
> ERROR  : get_att_int(const NcVarInfo &, const ConcatString &, int &)
->
> attribute "accum_time_sec" should be an integer.
> ERROR  :
>
> I don't know why it automatically changed in the header and how to
solve
> this.
>
> Yuqi
>
> ________________________________________
> From: John Halley Gotway via RT <met_help at ucar.edu>
> Sent: Wednesday, February 26, 2020 4:25 PM
> To: Zhang, Yuqi
> Subject: Re: [rt.rap.ucar.edu #94280] Question to read NetCDF file
>
> Yuqi,
>
> I don't know what your python code looks like, but you should just
be able
> to wrap it with "int()" to convert the string to an integer:
>
> [johnhg at number5]% python
> Python 2.7.13 (default, Sep 26 2018, 18:42:22)
> [GCC 6.3.0 20170516] on linux2
> Type "help", "copyright", "credits" or "license" for more
information.
> >>> a="123"
> >>> a
> '123'
> >>> int(a)
> 123
>
> On Wed, Feb 26, 2020 at 2:52 PM Zhang, Yuqi via RT
<met_help at ucar.edu>
> wrote:
>
> >
> > <URL:
>
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Frt.rap.ucar.edu%2Frt%2FTicket%2FDisplay.html%3Fid%3D94280&data=02%7C01%7Cyqzhang%40ku.edu%7Ca6e49c02087645850c7208d7bb0ac3c7%7C3c176536afe643f5b96636feabbe3c1a%7C0%7C0%7C637183527232048899&sdata=zGHlgkikIaETyoCYWKETigOigoKhIbhM%2FwkIkA6BQfs%3D&reserved=0
> >
> >
> > Hi,
> >
> > Thanks for your information. Now I met with another problem that
it says
> > the accum_time_sec in global attributes should be an integer. I
was using
> > netcdf package in python to write the header. It automatically
transform
> > the header information to string even I assign the number as an
integer
> to
> > the attribute. I'm wondering if you know how I can make the header
> > information to be an integer.
> >
> > Thank you.
> >
> > Yuqi
> > ________________________________________
> > From: John Halley Gotway via RT <met_help at ucar.edu>
> > Sent: Monday, February 24, 2020 11:28 PM
> > To: Zhang, Yuqi
> > Subject: Re: [rt.rap.ucar.edu #94280] Question to read NetCDF file
> >
> > Yuqi,
> >
> > This type of "syntax" error you're seeing indicates a problem in
the
> > configuration string you're using.  This is an easy fix.  You're
just
> > missing a trailing semicolon:
> >
> > *name="APCP_01"; level="A1";*
> >
> > Each configuration entry should be terminated by a semicolon.
> >
> > Thanks,
> > John Halley Gotway
> >
> > On Fri, Feb 21, 2020 at 6:38 PM Zhang, Yuqi via RT
<met_help at ucar.edu>
> > wrote:
> >
> > >
> > > Fri Feb 21 16:38:54 2020: Request 94280 was acted upon.
> > > Transaction: Ticket created by yqzhang at ku.edu
> > >        Queue: met_help
> > >      Subject: Question to read NetCDF file
> > >        Owner: Nobody
> > >   Requestors: yqzhang at ku.edu
> > >       Status: new
> > >  Ticket <URL:
> >
>
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Frt.rap.ucar.edu%2Frt%2FTicket%2FDisplay.html%3Fid%3D94280&data=02%7C01%7Cyqzhang%40ku.edu%7Ca6e49c02087645850c7208d7bb0ac3c7%7C3c176536afe643f5b96636feabbe3c1a%7C0%7C0%7C637183527232048899&sdata=zGHlgkikIaETyoCYWKETigOigoKhIbhM%2FwkIkA6BQfs%3D&reserved=0
> > >
> > >
> > >
> > > Hi,
> > >
> > >
> > > I'm Yuqi Zhang, a graduate student in University of Kansas. I
was
> trying
> > > to use MET to process the data. I have WRF daily data which are
> > aggregated
> > > and written in a netCDF file via python. I tried to change the
netCDF
> > file
> > > to look like similar as pcp_combine output (I don't have the
original
> wrf
> > > out to use UPP and pcp_combine). I add all the attributes of the
> > variables
> > > and also in global attributes, and it looks the same as the file
from
> > > pcp_combine if I use 'ncdump -h file' to check the header
information.
> > > However, the MET can't read the variable when I try to plot the
data
> > using
> > > plot_data_plane. Below are the error I met:
> > >
> > >     ERROR  :
> > >     ERROR  : yyerror() -> syntax error in file
"config_111497_0_.temp"
> > >     ERROR  :
> > >     ERROR  :    line   = 2
> > >     ERROR  :
> > >     ERROR  :    column = 1
> > >     ERROR  :
> > >     ERROR  :    text   = "(nul)"
> > >     ERROR  :
> > >     ERROR  :
> > >     ERROR  : (nul)
> > >     ERROR  : (nul)
> > >     ERROR  :
> > >
> > >
> > > Below are the error in the log file (config_111497?_0_.temp?):
> > >
> > >     name="APCP_01"; level="A1"
> > >
> > >
> > > It looks like it's not be able to recognize the variable field
although
> > > I've add the 'name' and 'level' attributes to my netCDF data.
The
> > > attributes I dump from my file are shown below:
> > >
> > >     netcdf wrf_daily_2002-06-01 {
> > >     dimensions:
> > >         lat = 936 ;
> > >         lon = 1986 ;
> > >     variables:
> > >         float APCP_01(lat, lon) ;
> > >         APCP_01:_FillValue = -9999.f ;
> > >         APCP_01:name = "APCP_01" ;
> > >         APCP_01:long_name = "Total Precipitation" ;
> > >         APCP_01:level = "A1" ;
> > >         APCP_01:units = "kg/m^2" ;
> > >         APCP_01:init_time = "19991101_000000" ;
> > >         APCP_01:init_time_ut = "1022889600" ;
> > >         APCP_01:valid_time = "20020602_000000" ;
> > >         APCP_01:valid_time_ut = "1022976000" ;
> > >         APCP_01:accum_time = "240000" ;
> > >         APCP_01:accum_time_sec = "86400" ;
> > >         float lat(lat, lon) ;
> > >         lat:long_name = "latitude" ;
> > >         lat:units = "degrees_north" ;
> > >         lat:standard_name = "latitude" ;
> > >         float lon(lat, lon) ;
> > >         lon:long_name = "longitude" ;
> > >         lon:units = "degrees_east" ;
> > >         lon:standard_name = "longitude" ;
> > >
> > >     // global attributes:
> > >         :Description = "NASA Downscaling NU-WRF 4km N600 output
> aggregate
> > > to daily precipitation" ;
> > >         :Projection = "Lambert Conformal" ;
> > >         :scale_lat1 = "15.000000" ;
> > >         :scale_lat2 = "15.000000" ;
> > >         :lon_orient = "-93.000000" ;
> > >         :d_km = "4.000000" ;
> > >         :r_km = "6371.200000" ;
> > >         :nx = "1986" ;
> > >         :ny = "936 grid_points" ;
> > >
> > >
> > > I don't know why the MET can't read the file. Could you help to
answer
> my
> > > question? Is there anything else I need to do except adding the
> variable
> > > attributes to a netCDF file so that it can be read by MET?
> > >
> > >
> > > Thanks
> > >
> > >
> > > Yuqi
> > >
> > >
> >
> >
> >
> >
>
>
>
>

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


More information about the Met_help mailing list