[ncl-talk] some issue with netCDF writing
Guido Cioni
guidocioni at gmail.com
Thu Aug 31 06:50:14 MDT 2017
I don't know whether it helps or not, but here is a ncdump -h of one of my file with a rotated grid that I was able to read both in Panoply and plot in NCL.
netcdf complete {
dimensions:
rlon = 706 ;
rlat = 434 ;
lev = 20 ;
time = UNLIMITED ; // (73 currently)
variables:
double rlon(rlon) ;
rlon:long_name = "longitude in rotated pole grid" ;
rlon:units = "degrees" ;
rlon:standard_name = "grid_longitude" ;
rlon:axis = "X" ;
double rlat(rlat) ;
rlat:long_name = "latitude in rotated pole grid" ;
rlat:units = "degrees" ;
rlat:standard_name = "grid_latitude" ;
rlat:axis = "Y" ;
char rotated_pole ;
rotated_pole:grid_mapping_name = "rotated_latitude_longitude" ;
rotated_pole:grid_north_pole_latitude = 44.999996 ;
rotated_pole:grid_north_pole_longitude = 144. ;
double lev(lev) ;
lev:long_name = "pressure" ;
lev:units = "Pa" ;
lev:axis = "Z" ;
double time(time) ;
time:units = "hours since 2014-01-17 00:00:00" ;
time:calendar = "proleptic_gregorian" ;
float gh(time, lev, rlat, rlon) ;
gh:long_name = "Geopotential Height" ;
gh:units = "gpm" ;
gh:code = 5 ;
gh:grid_mapping = "rotated_pole" ;
float t(time, lev, rlat, rlon) ;
t:long_name = "Temperature" ;
t:units = "K" ;
t:grid_mapping = "rotated_pole" ;
float u(time, lev, rlat, rlon) ;
u:long_name = "U velocity" ;
u:units = "m s**-1" ;
u:code = 2 ;
u:grid_mapping = "rotated_pole" ;
float v(time, lev, rlat, rlon) ;
v:long_name = "V velocity" ;
v:units = "m s**-1" ;
v:code = 3 ;
v:grid_mapping = "rotated_pole" ;
float w(time, lev, rlat, rlon) ;
w:long_name = "Vertical velocity" ;
w:units = "Pa s**-1" ;
w:code = 8 ;
w:grid_mapping = "rotated_pole" ;
float pv(time, lev, rlat, rlon) ;
pv:long_name = "Potential vorticity" ;
pv:units = "K m**2 kg**-1 s**-1" ;
pv:code = 14 ;
pv:grid_mapping = "rotated_pole" ;
float mterh(time, rlat, rlon) ;
mterh:long_name = "Model terrain height" ;
mterh:units = "m" ;
mterh:code = 7 ;
mterh:grid_mapping = "rotated_pole" ;
// global attributes:
:CDI = "Climate Data Interface version 1.4.7 (http://code.zmaw.de/projects/cdi)" ;
:Conventions = "CF-1.0" ;
:history = "Fri Nov 27 13:33:35 2015: cdo -f nc copy 2014011700_000.grib2 2014011700_001.grib2 2014011700_002.grib2 2014011700_003.grib2 2014011700_004.grib2 2014011700_005.grib2 2014011700_006.grib2 2014011700_007.grib2 2014011700_008.grib2 2014011700_009.grib2 2014011700_010.grib2 2014011700_011.grib2 2014011700_012.grib2 2014011700_013.grib2 2014011700_014.grib2 2014011700_015.grib2 2014011700_016.grib2 2014011700_017.grib2 2014011700_018.grib2 2014011700_019.grib2 2014011700_020.grib2 2014011700_021.grib2 2014011700_022.grib2 2014011700_023.grib2 2014011700_024.grib2 2014011700_025.grib2 2014011700_026.grib2 2014011700_027.grib2 2014011700_028.grib2 2014011700_029.grib2 2014011700_030.grib2 2014011700_031.grib2 2014011700_032.grib2 2014011700_033.grib2 2014011700_034.grib2 2014011700_035.grib2 2014011700_036.grib2 2014011700_037.grib2 2014011700_038.grib2 2014011700_039.grib2 2014011700_040.grib2 2014011700_041.grib2 2014011700_042.grib2 2014011700_043.grib2 2014011700_044.grib2 2014011700_045.grib2 2014011700_046.grib2 2014011700_047.grib2" ;
:CDO = "Climate Data Operators version 1.4.7 (http://code.zmaw.de/projects/cdo)" ;
}
> On 31. Aug 2017, at 14:34, Beáta Szabó-Takács <szabo.b at czechglobe.cz> wrote:
>
> Hi Karin,
> I deleted the attribute north_pole_grid_longitude of rotated_latitude_longitude by:
>
> ncatted -O -a north_pole_grid_longitude,rotated_latitude_longitude,d,, evtH_31.nc
>
> The new netCDF is:
> ncdump -h evtH_31.nc
> netcdf evtH_31 {
> dimensions:
> time = 364 ;
> rlat = 412 ;
> rlon = 424 ;
> vertices = 4 ;
> bnds = 2 ;
> variables:
> float evtH(time, rlat, rlon) ;
> evtH:_FillValue = 1.e+20f ;
> evtH:long_name = "reference evapotranspiration: Hargreaves " ;
> evtH:units = "mm/day" ;
> evtH:url = "http://www.fao.org/docrep/X0490E/x0490e07.htm <http://www.fao.org/docrep/X0490E/x0490e07.htm>" ;
> evtH:info = "FAO 56; EQN 52; refevt_hargreaves_fao56" ;
> float lat(rlat, rlon) ;
> lat:standard_name = "latitude" ;
> lat:long_name = "latitude" ;
> lat:units = "degrees_north" ;
> lat:_CoordinateAxisType = "Lat" ;
> lat:bounds = "lat_bnds" ;
> double rlat(rlat) ;
> rlat:standard_name = "grid_latitude" ;
> rlat:long_name = "latitude in rotated pole grid" ;
> rlat:units = "degrees" ;
> rlat:axis = "Y" ;
> double rlon(rlon) ;
> rlon:standard_name = "grid_longitude" ;
> rlon:long_name = "longitude in rotated pole grid" ;
> rlon:units = "degrees" ;
> rlon:axis = "X" ;
> float lat_bnds(rlat, rlon, vertices) ;
> float lon(rlat, rlon) ;
> lon:standard_name = "longitude" ;
> lon:long_name = "longitude" ;
> lon:units = "degrees_east" ;
> lon:_CoordinateAxisType = "Lon" ;
> lon:bounds = "lon_bnds" ;
> float lon_bnds(rlat, rlon, vertices) ;
> int rotated_latitude_longitude ;
> rotated_latitude_longitude:grid_mapping_name = "rotated_latitude_longitude" ;
> rotated_latitude_longitude:grid_north_pole_latitude = 39.25 ;
> rotated_latitude_longitude:grid_north_pole_longitude = -162. ;
> double time(time) ;
> time:standard_name = "time" ;
> time:long_name = "time" ;
> time:bounds = "time_bnds" ;
> time:units = "days since 1949-12-1 00:00:00" ;
> time:calendar = "proleptic_gregorian" ;
> time:axis = "T" ;
> double time_bnds(time, bnds) ;
>
> // global attributes:
> :history = "Thu Aug 31 12:25:48 2017: ncatted -O -a north_pole_grid_longitude,rotated_latitude_longitude,d,, evtH_31.nc" ;
> }
>
> as you suggested. But I got the same error in Panoply. I do not know what should I do to solve this matter?
> Best regards,
> Beáta
>
> From: ncl-talk [mailto:ncl-talk-bounces at ucar.edu] On Behalf Of Karin Meier-Fleischer
> Sent: Thursday, August 31, 2017 1:38 PM
> To: ncl-talk at ucar.edu
> Subject: Re: [ncl-talk] some issue with netCDF writing
>
> Hi Beata,
>
> I would expect that the variable for the rotated pole information has to look like
>
> int rotated_pole ;
> rotated_pole:grid_mapping_name = "rotated_latitude_longitude" ;
> rotated_pole:grid_north_pole_latitude = 39.25. ;
> rotated_pole:grid_north_pole_longitude = -162. ;
>
> -Karin
>
> Am 31.08.17 um 13:24 schrieb Beáta Szabó-Takács:
> Dear NCL Users,
> I have also a problem with netCDF writing. I calculated the Hargreaves reference evapotranspiration in each year from 1981 to 2000 and wrote out the results into a netCDF file. I attached my script. The created netCDF file is correct according to ncdump -h:
> ncdump -h evtH_31.nc
> netcdf evtH_31 {
> dimensions:
> time = 364 ;
> rlat = 412 ;
> rlon = 424 ;
> vertices = 4 ;
> bnds = 2 ;
> variables:
> float evtH(time, rlat, rlon) ;
> evtH:_FillValue = 1.e+20f ;
> evtH:long_name = "reference evapotranspiration: Hargreaves " ;
> evtH:units = "mm/day" ;
> evtH:url = "http://www.fao.org/docrep/X0490E/x0490e07.htm" <http://www.fao.org/docrep/X0490E/x0490e07.htm> ;
> evtH:info = "FAO 56; EQN 52; refevt_hargreaves_fao56" ;
> float lat(rlat, rlon) ;
> lat:standard_name = "latitude" ;
> lat:long_name = "latitude" ;
> lat:units = "degrees_north" ;
> lat:_CoordinateAxisType = "Lat" ;
> lat:bounds = "lat_bnds" ;
> double rlat(rlat) ;
> rlat:standard_name = "grid_latitude" ;
> rlat:long_name = "latitude in rotated pole grid" ;
> rlat:units = "degrees" ;
> rlat:axis = "Y" ;
> double rlon(rlon) ;
> rlon:standard_name = "grid_longitude" ;
> rlon:long_name = "longitude in rotated pole grid" ;
> rlon:units = "degrees" ;
> rlon:axis = "X" ;
> float lat_bnds(rlat, rlon, vertices) ;
> float lon(rlat, rlon) ;
> lon:standard_name = "longitude" ;
> lon:long_name = "longitude" ;
> lon:units = "degrees_east" ;
> lon:_CoordinateAxisType = "Lon" ;
> lon:bounds = "lon_bnds" ;
> float lon_bnds(rlat, rlon, vertices) ;
> int rotated_latitude_longitude ;
> rotated_latitude_longitude:grid_mapping_name = "rotated_latitude_longitude" ;
> rotated_latitude_longitude:grid_north_pole_latitude = 39.25 ;
> rotated_latitude_longitude:grid_north_pole_longitude = -162. ;
> rotated_latitude_longitude:north_pole_grid_longitude = 0. ;
> double time(time) ;
> time:standard_name = "time" ;
> time:long_name = "time" ;
> time:bounds = "time_bnds" ;
> time:units = "days since 1949-12-1 00:00:00" ;
> time:calendar = "proleptic_gregorian" ;
> time:axis = "T" ;
> double time_bnds(time, bnds) ;
> }
> But when I use this netCDF file in Panoply I get the following error:
> There was an error preparing the data: Could not find pole attributes.
> Moreover, when I merged the created evtH.nc files in CDO with mergetime operator and calculated the yearly sum the longitude and latitude dimeansiones disappeared.
> ncdump -h PET_ys.nc
> netcdf PET_ys {
> dimensions:
> rlon = 424 ;
> rlat = 412 ;
> time = UNLIMITED ; // (20 currently)
> bnds = 2 ;
> variables:
> double rlon(rlon) ;
> rlon:standard_name = "longitude" ;
> rlon:long_name = "longitude" ;
> rlon:units = "degrees_east" ;
> rlon:axis = "X" ;
> double rlat(rlat) ;
> rlat:standard_name = "latitude" ;
> rlat:long_name = "latitude" ;
> rlat:units = "degrees_north" ;
> rlat:axis = "Y" ;
> double time(time) ;
> time:standard_name = "time" ;
> time:long_name = "time" ;
> time:bounds = "time_bnds" ;
> time:units = "days since 1949-12-1 00:00:00" ;
> time:calendar = "proleptic_gregorian" ;
> time:axis = "T" ;
> double time_bnds(time, bnds) ;
> float evtH(time, rlat, rlon) ;
> evtH:long_name = "reference evapotranspiration: Hargreaves " ;
> evtH:units = "mm/day" ;
> evtH:_FillValue = 1.e+20f ;
> evtH:missing_value = 1.e+20f ;
> evtH:url = "http://www.fao.org/docrep/X0490E/x0490e07.htm" <http://www.fao.org/docrep/X0490E/x0490e07.htm> ;
> evtH:info = "FAO 56; EQN 52; refevt_hargreaves_fao56" ;
>
> // global attributes:
> :CDI = "Climate Data Interface version 1.8.2 (http://mpimet.mpg.de/cdi <http://mpimet.mpg.de/cdi>)" ;
> :Conventions = "CF-1.6" ;
> :history = "Wed Aug 30 08:00:03 2017: cdo yearsum PET_80-00.nc PET_ys.nc\n",
> "Wed Aug 30 07:56:15 2017: cdo mergetime evtH_11.nc evtH_12.nc evtH_13.nc evtH_14.nc evtH_15.nc evtH_16.nc evtH_17.nc evtH_18.nc evtH_19.nc evtH_20.nc evtH_21.nc evtH_22.nc evtH_23.nc evtH_24.nc evtH_25.nc evtH_26.nc evtH_27.nc evtH_28.nc evtH_29.nc evtH_30.nc PET_80-00.nc" ;
> :frequency = "year" ;
> :CDO = "Climate Data Operators version 1.8.2 (http://mpimet.mpg.de/cdo <http://mpimet.mpg.de/cdo>)" ;
> }
>
> I do not understand why.
> Can someone write me what I did wrong?
> Thank you for your help in advance!
> Best regards,
> Beáta
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <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 <mailto:meier-fleischer at dkrz.de>
> URL: www.dkrz.de <http://www.dkrz.de/>
>
> Geschäftsführer: Prof. Dr. Thomas Ludwig
> Sitz der Gesellschaft: Hamburg
> Amtsgericht Hamburg HRB 39784
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Guido Cioni
http://guidocioni.altervista <http://guidocioni.altervista/>.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170831/83e13975/attachment-0001.html>
More information about the ncl-talk
mailing list