[ncl-talk] Writing attributes to netCDF file

Laura Fowler laura at ucar.edu
Mon Aug 30 14:35:39 MDT 2021


Hello:

I am trying to write a variable to a netCDF file. This variable was
initially re-gridded using ESMF_regrid_with_weights so that a
printVarSummary of that variable is:

Variable: diag_r

Type: float

Total Size: 3950404 bytes

            987601 values

Number of Dimensions: 2

Dimensions and sizes: [g5_x_0 | 881] x [g5_y_1 | 1121]

Coordinates:

Number Of Attributes: 7

  _FillValue : 9.96921e+36

  units : mm

  long_name : time-step convective precipitation

  lat2d : <ARRAY of 987601 elements>

  lon2d : <ARRAY of 987601 elements>

  remap : remapped via ESMF_regrid_with_weights: Bilinear

  missing_value : 9.96921e+36



where lat2d and lon2d are the latitudes and longitudes of the NCEP Stage IV
precipitation data. When I write the re-gridded variable to a netCDF file,
then I get the following output of ncdump :


[laura at casper-login2 6488066.CONUS]$ ncdump -h
CONUS_mpas.precipitation.init_20120611_06.nc | more

netcdf CONUS_mpas.precipitation.init_20120611_06 {

dimensions:

StrLen = 19 ;

Time = 49 ;

g5_x_0 = 881 ;

g5_y_1 = 1121 ;

variables:

char xtime(Time, StrLen) ;

string xtime:units = "YYYY-MM-DD_hh:mm:ss" ;

string xtime:long_name = "Model valid time" ;

float g5_lat_0(g5_x_0, g5_y_1) ;

g5_lat_0:La1 = 23.117f ;

g5_lat_0:Lo1 = -119.023f ;

g5_lat_0:Lov = -105.f ;

g5_lat_0:Dx = 4763.f ;

g5_lat_0:Dy = 4763.f ;

string g5_lat_0:ProjectionCenter = "north" ;

string g5_lat_0:units = "degrees_north" ;

string g5_lat_0:GridType = "Polar Stereographic Projection Grid" ;

string g5_lat_0:long_name = "latitude" ;

g5_lat_0:corners = 23.117f, 19.80426f, 45.61898f, 53.51062f ;

float g5_lon_1(g5_x_0, g5_y_1) ;

g5_lon_1:La1 = 23.117f ;

g5_lon_1:Lo1 = -119.023f ;

g5_lon_1:Lov = -105.f ;

g5_lon_1:Dx = 4763.f ;

g5_lon_1:Dy = 4763.f ;

string g5_lon_1:ProjectionCenter = "north" ;

string g5_lon_1:units = "degrees_east" ;

string g5_lon_1:GridType = "Polar Stereographic Projection Grid" ;

string g5_lon_1:long_name = "longitude" ;

g5_lon_1:corners = -119.023f, -80.74809f, -59.95461f, -134.0418f ;

float precip(g5_x_0, g5_y_1) ;

precip:_FillValue = 9.96921e+36f ;

string precip:units = "mm" ;

string precip:long_name = "time-step convective precipitation" ;

precip:lat2d = 23.1169986724854, 23.12473487854, 23.132453918457,
23.1401557922363, 23.1478404998779, 23.1555061340332, 23.1

631546020508, 23.1707859039307, 23.1784000396729, 23.1859951019287,
23.1935729980469, 23.2011337280273, 23.2086753845215, 23.2162017822266,

23.2237091064453, 23.2311973571777, 23.2386703491211, 23.2461242675781,
23.2535591125488, 23.2609786987305, 23.2683792114258, 23.27576255798



which shows that, by default, it explicitly outputs the lat2d and lon2d
attributes. Is there a way that ncdump only outputs the actual values of
the re-gridded variables without info about the lat2d and lon2d attributes,
like a "normal" netCDF variable?



Thanks,

Laura




-- 
!-------------------------------------------------------------------------------------------------------------
Laura D. Fowler

Mesoscale and Microscale Meteorology Division (MMM)
National Center for Atmospheric Research
P.O. Box 3000, Boulder CO 80307-3000

e-mail: laura at ucar.edu
phone: 303-497-1628

!-------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210830/b6741423/attachment.html>


More information about the ncl-talk mailing list