[ncl-talk] NDVI_mask problem

Mary Haley haley at ucar.edu
Wed May 9 08:14:15 MDT 2018


Hi Jalal,

I took a look at one of these NDVI data files, and noticed that the lat/lon
coordinate arrays on the file have no attributes, which is not good.

These arrays should at least have "units" and "long_name" attributes and
units should be something like "degrees_north" and "degrees_east".  For
rectilinear data (data with lat/lon coordinate arrays), NCL needs these
units to be something that indicates they are in degrees, or otherwise it
can't be sure it is plotting the data correctly.

It's always important to look at your data when you get errors like this.
You do have:

printVarSummary(ndvi)

but I also added:

printVarSummary(ndvi&lat)
printVarSummary(ndvi&lon)

in order to look at the lat/lon arrays to see what the units were and you
can see there are none:

Variable: lat (coordinate)
Type: double
Total Size: 17280 bytes
            2160 values
Number of Dimensions: 1
Dimensions and sizes: [lat | 2160]
Coordinates:
Number Of Attributes: 0


To fix this, I did this after reading in ndvi:

  ndvi           = f->ndvi(0,:,:)
  ndvi&lat at units = "degrees_north"    ; Fix the units
  ndvi&lon at units = "degrees_east"
  printVarSummary(ndvi)

I also had to remove the reference to "ndvi at long_name" in a later title
string, because ndvi doesn't have a long_name attribute.

--Mary

On Wed, May 9, 2018 at 3:44 AM, Md. Jalal Uddin <dmjalal90 at gmail.com> wrote:

> Hi all,
>
> I tried to plot gimms ndvi (https://ecocast.arc.nasa.gov/data/pub/gimms/
> 3g.v1/) data by masking. I am getting following errors. I used  copy_VarCoords(ndvi,ndvi_mask)
> command to fix it but failed. Please help to solve this problem. Please
> find my script in the attachment.
>
> (0) check_for_y_lat_coord: Warning: Data either does not contain a valid
> latitude coordinate array or doesn't contain one at all.
> (0) A valid latitude coordinate array should have a 'units' attribute
> equal to one of the following values:
> (0)     'degrees_north' 'degrees-north' 'degree_north' 'degrees north'
> 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
> (0) check_for_lon_coord: Warning: Data either does not contain a valid
> longitude coordinate array or doesn't contain one at all.
> (0) A valid longitude coordinate array should have a 'units' attribute
> equal to one of the following values:
> (0)     'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
> 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
> (0) check_for_y_lat_coord: Warning: Data either does not contain a valid
> latitude coordinate array or doesn't contain one at all.
> (0) A valid latitude coordinate array should have a 'units' attribute
> equal to one of the following values:
> (0)     'degrees_north' 'degrees-north' 'degree_north' 'degrees north'
> 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
> (0) check_for_lon_coord: Warning: Data either does not contain a valid
> longitude coordinate array or doesn't contain one at all.
> (0) A valid longitude coordinate array should have a 'units' attribute
> equal to one of the following values:
> (0)     'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
> 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
> warning:Attempt to reference attribute (long_name) which is undefined
>
> Cheers,
> Jalal
> --
> *Md. Jalal Uddin*
> MSc in Applied Meteorology (English Language)
> Nanjing University of Information, Science and Technology, China
> Jasmine Jiangsu Government Scholar
> Cell: +8613260859092
> Office: Beichen Building, School of Geography and Remote Sensing, Room No.
> 406
>
> *AND *
> B.Sc. in Disaster Management (Hons.)
> Patuakhali Science and Technology University, Bangladesh.
> Cell: +8801792052662, +8801838613203
> Email: dmjalal90 at gmail.com
> Web: www.dmjalal90.weebly.com
> Facebook: jalal.hossen.39
> LinkedIn: https://bd.linkedin.com/in/md-jalal-uddin-80a026b0
> Twitter: dmjalal90
> Skype: dmjalal90
>
> _______________________________________________
> 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/20180509/94c54428/attachment.html>


More information about the ncl-talk mailing list