[ncl-talk] Error in creating Nino34 index from CMIP5 models

Mary Haley haley at ucar.edu
Sat Nov 17 15:58:12 MST 2018


Dear Kwesi,

You didn't provide a script, but my guess is that you are trying to
subscript your data array using latitude / longitude coordinates, similar
to this line which was in the original script:

  X      = mon_fullyear( in->SST(:,{latS:latN},{lonL:lonR}), 0)

The original example was written for data on a rectilinear lat/lon grid
that has latitude/longitude coordinate arrays.

Your data is curvilinear, which means it is represented by 2D lat/lon
arrays.  It does have coordinate arrays attached to it, but they are simply
integer indexes and NOT lat/lon coordinate arrays:

       int j(j) ;
                j:units = "1" ;
                j:long_name = "cell index along second dimension" ;
        int i(i) ;
                i:units = "1" ;
                i:long_name = "cell index along first dimension" ;

If you need to subset your data using lat/lon coordinates, you will need to
either use the getind_latlon2d
<http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml>
function or the region_ind
<http://www.ncl.ucar.edu/Document/Functions/Contributed/region_ind.shtml>
function.  You can see some examples at:

http://www.ncl.ucar.edu/Applications/latlon_subset.shtml

Look at either latlon_subset_2.ncl or latlon_subset_3.ncl.

Good luck,

--Mary


On Sat, Nov 17, 2018 at 7:57 AM Kwesi A. Quagraine <starskykwesi at gmail.com>
wrote:

> Hello Nclers,
>
> I am experiencing an error when calculating Nino34 index (
> indices_nino_1.ncl
> <https://www.ncl.ucar.edu/Applications/Scripts/indices_nino_1.ncl>) using
> CMIP5 models; The error message is; fatal:Coordinate subscript type
> mismatch. Subscript (2) can not be coerced to type of coordinate variable,
> subscript (0).
>
> Ncdump of file gives;
>
> netcdf tos_Omon_IPSL-CM5A-LR_historical_r1i1p1_185001-200512 {
> dimensions:
>         time = UNLIMITED ; // (1872 currently)
>         j = 149 ;
>         i = 182 ;
>         bnds = 2 ;
>         vertices = 4 ;
> variables:
>         double time(time) ;
>                 time:bounds = "time_bnds" ;
>                 time:units = "days since 1850-01-01 00:00:00" ;
>                 time:calendar = "noleap" ;
>                 time:axis = "T" ;
>                 time:long_name = "time" ;
>                 time:standard_name = "time" ;
>         double time_bnds(time, bnds) ;
>         int j(j) ;
>                 j:units = "1" ;
>                 j:long_name = "cell index along second dimension" ;
>         int i(i) ;
>                 i:units = "1" ;
>                 i:long_name = "cell index along first dimension" ;
>         float lat(j, i) ;
>                 lat:standard_name = "latitude" ;
>                 lat:long_name = "latitude coordinate" ;
>                 lat:units = "degrees_north" ;
>                 lat:bounds = "lat_vertices" ;
>         float lon(j, i) ;
>                 lon:standard_name = "longitude" ;
>                 lon:long_name = "longitude coordinate" ;
>                 lon:units = "degrees_east" ;
>                 lon:bounds = "lon_vertices" ;
>         float lat_vertices(j, i, vertices) ;
>                 lat_vertices:units = "degrees_north" ;
>         float lon_vertices(j, i, vertices) ;
>                 lon_vertices:units = "degrees_east" ;
>         float tos(time, j, i) ;
>                 tos:standard_name = "sea_surface_temperature" ;
>                 tos:long_name = "Sea Surface Temperature" ;
>                 tos:comment = "\"this may differ from \"\"surface
> temperature\"\" in regions of sea ice.\"" ;
>                 tos:units = "K" ;
>                 tos:original_name = "sosstsst" ;
>                 tos:original_units = "degC" ;
>                 tos:history = "2011-07-04T20:18:27Z altered by CMOR:
> Converted units from \'degC\' to \'K\'. 2011-07-04T20:18:27Z altered by
> CMOR: replaced missing value flag (9.96921e+36) with standard missing value
> (1e+20)." ;
>                 tos:cell_methods = "time: mean (interval: 30 minutes)" ;
>                 tos:cell_measures = "area: areacello" ;
>                 tos:missing_value = 1.e+20f ;
>                 tos:_FillValue = 1.e+20f ;
>                 tos:associated_files = "baseURL:
> http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation gridspecFile:
> gridspec_ocean_fx_IPSL-CM5A-LR_historical_r0i0p0.nc areacello:
> areacello_fx_IPSL-CM5A-LR_historical_r0i0p0.nc" ;
>                 tos:coordinates = "lat lon" ;
>
> // global attributes:
>                 :institution = "IPSL (Institut Pierre Simon Laplace,
> Paris, France)" ;
>                 :institute_id = "IPSL" ;
>                 :experiment_id = "historical" ;
>                 :source = "IPSL-CM5A-LR (2010) : atmos : LMDZ4 (LMDZ4_v5,
> 96x95x39); ocean : ORCA2 (NEMOV2_3, 2x2L31); seaIce : LIM2 (NEMOV2_3);
> ocnBgchem : PISCES (NEMO:
>
> Any help on this will be much appreciated. Thanks in advance.
>
> Best regards
> Kwesi
> ------------
> Try not to become a man of success but rather a man of value- Albert
> Einstein
>
> Kwesi A. Quagraine
> Department of Physics
> School of Physical Sciences
> College of Agriculture and Natural Sciences
> University of Cape Coast
> Cape Coast, Ghana
>
> Alt. Email: kwesi at csag.uct.ac.za
> Web: http://www.recycleupghana.org/
> Office: +27 21 650 3164
> Skype: quagraine_cwasi
> _______________________________________________
> 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/20181117/ec8e8340/attachment.html>


More information about the ncl-talk mailing list