[ncl-talk] some issue with netCDF writing

Karin Meier-Fleischer meier-fleischer at dkrz.de
Thu Aug 31 08:25:30 MDT 2017


Hi Beata,

by the way, if your data variables would have the coordinates attribute like

   t:coordinates = "lat lon" ;

which can be set for e.g. variable t with the CDO operator setattribute

   cdo setattribute,t at coordinates="lat lon" infile outfile

the lat and lon coordinates won't be deleted ('disappear'). ;)

-Karin


Am 31.08.17 um 13:38 schrieb Karin Meier-Fleischer:
> 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" ;
>>
>>                 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" ;
>>
>>                 evtH:info = "FAO 56; EQN 52; refevt_hargreaves_fao56" ;
>>
>> // global attributes:
>>
>>                 :CDI = "Climate Data Interface version 1.8.2 
>> (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)" ;
>>
>> }
>>
>> 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
>> 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
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

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


More information about the ncl-talk mailing list