[ncl-talk] the fatal error: Dimension (x) of file does not have an associated coordinate variable

Mary Haley haley at ucar.edu
Tue Jan 12 12:16:40 MST 2016


You can only use coordinate subscripting with dimensions that are
represented by 1-dimensional coordinate arrays that have the same dimension
name as their variable name.

You are trying to access vozocrtx with latitude and longitude subscripting:

u   = uin->vozocrtx(0,depth-1,{lat_min:lat_max},{lon_min:lon_max})

This variable is defined on the file as:

float vozocrtx(time_counter, depthu, y, x) ;

"time_counter" and "depthu" are 1-dimensional coordinate arrays:

 float depthu(depthu) ;
 float time_counter(time_counter) ;

but "y" and "x" are not. Your lat/lon variables are both 2-dimensional and
called "nav_lat" and "nav_lon".  To subscript an array based on 2D lat/lon
arrays, you can use "getind_latlon2d".  Please see the documentation for
this function for some examples:

http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml

​--Mary
​

On Tue, Jan 12, 2016 at 8:41 AM, 朱学明 <557xiaozhu at 163.com> wrote:

> Hello all,
>
>     I have got an error as follow,
>
> fatal:["FileSupport.c":133]:Dimension (x) of file
> (ext-PSY4V1R3_1dAV_201201_gridU) does not have an associated coordinate
> variable
> fatal:["Execute.c":8567]:Execute: Error occurred at or near line 184 in
> file mercator_vector_rectangle.ncl
>
> Here is the line 184 in file mercator_vector_rectangle.ncl:
>
> u   = uin->vozocrtx(0,depth-1,{lat_min:lat_max},{lon_min:lon_max})
>
> The nc file head from command "ncdump -h aaa.nc" is as follow,
>
> netcdf ext-PSY4V1R3_1dAV_201201_gridU {
> dimensions:
>  y = 429 ;
>  x = 566 ;
>  depthu = 50 ;
>  time_counter = UNLIMITED ; // (1 currently)
> variables:
>  short nav_lon(y, x) ;
>   nav_lon:units = "degrees_east" ;
>   nav_lon:valid_min = 98.f ;
>   nav_lon:valid_max = 146.f ;
>   nav_lon:add_offset = 0.f ;
>   nav_lon:scale_factor = 0.01f ;
>   nav_lon:long_name = "Longitude" ;
>   nav_lon:nav_model = "Default grid" ;
>  short nav_lat(y, x) ;
>   nav_lat:units = "degrees_north" ;
>   nav_lat:valid_min = -6.f ;
>   nav_lat:valid_max = 30.f ;
>   nav_lat:add_offset = 0.f ;
>   nav_lat:scale_factor = 0.01f ;
>   nav_lat:long_name = "Latitude" ;
>   nav_lat:nav_model = "Default grid" ;
>  float depthu(depthu) ;
>   depthu:units = "m" ;
>   depthu:positive = "unknown" ;
>   depthu:valid_min = 0.f ;
>   depthu:valid_max = 5728.f ;
>   depthu:title = "depthu" ;
>   depthu:long_name = "Vertical U levels" ;
>  float time_counter(time_counter) ;
>   time_counter:calendar = "gregorian" ;
>   time_counter:title = "Time" ;
>   time_counter:long_name = "Time axis" ;
>   time_counter:units = "seconds since 2007-10-31 00:00:00" ;
>   time_counter:time_origin = "2007-OCT-31 00:00:00" ;
>  float vozocrtx(time_counter, depthu, y, x) ;
>   vozocrtx:units = "m/s" ;
>   vozocrtx:missing_value = -32767s ;
>   vozocrtx:valid_min = -9999.99952502551 ;
>   vozocrtx:valid_max = 9999.99952502551 ;
>   vozocrtx:long_name = "Zonal Velocity" ;
>   vozocrtx:short_name = "vozocrtx" ;
>   vozocrtx:standard_name = "sea_water_x_velocity" ;
>   vozocrtx:online_operation = "N/A" ;
>   vozocrtx:axis = "TZYX" ;
>   vozocrtx:interval_operation = 432000. ;
>   vozocrtx:interval_write = 432000. ;
>   vozocrtx:associate = "time_counter depthu nav_lat nav_lon" ;
>   vozocrtx:coordinates = "nav_lon nav_lat depthu time_counter" ;
>
> // global attributes:
>   :Conventions = "GDT 1.3" ;
>   :file_name = "ORCA12_LIM-T103_y2011m12d31_gridU.nc" ;
>   :production = "OPA9.0 beta" ;
>   :TimeStamp = "2012-JAN-09 04:45:09 GMT+0000" ;
>   :NCO = "4.0.2" ;
>   :nco_openmp_thread_number = 1 ;
> }
>
>   How should I modify the ncl code or change the ncfile to fix the
> problem?  Thanks.
>
> 2016-01-12
> ------------------------------
> Xueming Zhu 朱学明
> Key Laboratory of Research on Marine Hazards Forecasting (LoMF), SOA
> National Marine Environmental Forecasting Center (NMEFC)
> No.8, Dahuisi Road, Haidian District, Beijing, 100081
> People's Republic of China
> Tel:+86-10-82481923
>
> _______________________________________________
> 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/20160112/262eb542/attachment.html 


More information about the ncl-talk mailing list