[ncl-talk] set_dimension_query

Adam Phillips asphilli at ucar.edu
Wed Sep 13 09:25:03 MDT 2017


Hi Kunal,
I think you just need to rearrange the order of your lines and tweak a
couple of lines. As the error message states, lat is not defined in your
3rd line and you are referring to it as if it is.Try this:
a = addfile("/media/Local Disk/NPL/MODIS_FPC/MAIACTAOT.
h00v02.20000570505.hdf","r")
var  = a->Optical_Depth_055(:,:)
nlat = 1200
nlon = 1200
lat = latGlobeFo(nlat, "lat", "latitude", "degrees_north")
lon = lonGlobeFo(nlon, "lon", "longitude", "degrees_east")
lat = lat(::-1)
lon = (/ lon - 180. /)  ; subtract 180 from all values
lon&lon = lon           ; update coordinates

var!0 = "lat"    ; you can name these dimensions whatever you want..
var!1 = "lon"
var&lat = lat     ; but make sure you refer to the correct named dimensions
var&lat = lon
;var&XDim_grid1km = lat
;var&YDim_grid1km = lon

If you have any further questions please respond to the ncl-talk email list.
Adam



On Wed, Sep 13, 2017 at 8:38 AM, Kunal Bali <kunal.bali9 at gmail.com> wrote:

> Dear NCL
>
> I have a file with the variable summary. The dimensions are in 2D.
>
> ncl 2>  printVarSummary(var)
>
> Variable: var
> Type: short
> Total Size: 2880000 bytes
>             1440000 values
> Number of Dimensions: 2
> Dimensions and sizes:    [*YDim_grid1km | 1200] x [XDim_grid1km | 1200]*
> Coordinates:
> Number Of Attributes: 7
>   long_name :    AOT at 0.55 micron
>   scale_factor :    0.001
>   add_offset :       0
>   unit :    None
>   _FillValue :    -28672
>   valid_range :    ( -100, 5000 )
>   hdf_name :    Optical_Depth_055
>
>
> I am trying to read the dimensions of this file as
>
> begin
> ;---Read data
>          a = addfile("/media/Local Disk/NPL/MODIS_FPC/MAIACTAOT.
> h00v02.20000570505.hdf","r")
>
>             var  = a->Optical_Depth_055(:,:)
>
>          var&XDim_grid1km = lat
>          var&YDim_grid1km = lon
>
>         nlat = 1200
>          nlon = 1200
>             lat = latGlobeFo(nlat, "lat", "latitude", "degrees_north")
>         lon = lonGlobeFo(nlon, "lon", "longitude", "degrees_east")
>             lat = lat(::-1)
>             lon = (/ lon - 180. /)  ; subtract 180 from all values
>             lon&lon = lon           ; update coordinates
>
>
>         var!0 = "lat"
>         var!1 = "lon"
>
>
> But the error appeared as
> *fatal:Variable (lat) is undefined*
>
>
> So, could anyone please let me know that how to read dimension of this
> file.
>
> Thank You
>
>
> Regards
> Kunal Bali
>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170913/9e67122d/attachment.html>


More information about the ncl-talk mailing list