<div dir="ltr">Hi, <br><div><br>This file is an interesting and challenging one to geo-reference. Without proper documentation on how the file is constructed/encoded, all of what follows is speculation. But I'm fairly confident it is sound.<br><br>In the group GRID_1, there are these parameters:<br><br>  GridName="grid1km"<br>  XDim=1200<br>  YDim=1200<br>  UpperLeftPointMtrs=(-3450000.000000,1600000.000000)<br>  LowerRightMtrs=(-2250000.000000,400000.000000)<br>  Projection=GCTP_ALBERS<br>  ProjParams=(0,0,21030000,41000000,102000000,23000000,0,0,0,0,0,0,0)<br>  SphereCode=12<br>  GridOrigin=HDFE_GD_UL<br>  GROUP=Dimension<br>  END_GROUP=Dimension<br><br>The name suggests a 1KM grid, and as such, by its resolution, it should span 1200KM. Indeed, from the corner points:<br><br>In X:  (-3450000 - -2250000) = a span of 1200000meters; divided by xres=1200, yields 1000meter grid cells<br>In Y:  (1600000 - 400000) = 1200000meters; div by yres=1200 yields 1000meter grid cells<br><br>So everything is consistent so far. The GCTP_ALBERS suggest the grid was constructed based upon an ALBERS projection, using the GCTP library. The ProjParams give further details:<br><br>  ProjParams=(0,0,21030000,41000000,102000000,23000000,0,0,0,0,0,0,0)<br><br>Again, without documentation, this is speculation, but looking at pg13/appendexD in:<br><br>   <a href="https://www.ngs.noaa.gov/PUBS_LIB/GeneralCartographicTransformationPackage_v2_TR_NOS124_CGS9.pdf">https://www.ngs.noaa.gov/PUBS_LIB/GeneralCartographicTransformationPackage_v2_TR_NOS124_CGS9.pdf</a><br><br>for the Albers projection, the first 2 values appear to be semimajor axis of ellipsoid, and eccentricity. Both are zero, implying defaults of Clarke's 1866 ellipsoid and spherical earth (which seems to be an oymoron? I'm confused about that)<br><br>The next 6 values might be:<br><br>  lat of 1st standard parallel<br>  lat of 2nd standard parallel<br>  lon of central meridian<br>  lat of projection's origin<br>  false easting (zero in this case)<br>  false northing (zero)<br><br>the remaining zeros don't seem to apply.<br><br>NCL does not have an public interface to GCTP, but there is an undocumented interface to the well-known proj4 library. The trick here is to use it to convert from meters-on-the ground units into lat/lon.  The first step is to construct arrays representing the grid's position in meters. In the X direction, if we did<br><br>  x = fspan(-3450000., -2250000, 1200)<br><br>we get an array of 1201, which is wrong. I speculate that for a grid of 1200, those values represent the total *spatial extent* of the grid, but that the data are based upon cell centers, not corners. Thus something like:<br><br>  x = fspan(-3450000.+500., -2250000.-500., 1200)<br>  y = fspan(1600000.-500., 400000.+500., 1200)<br><br>A 1km grid cannot obviously be constant spacing in longitude, so ultimately, your coordinate arrays are going to be curvilinear:<br><br>  x := conform_dims((/1200, 1200/), x, 1)<br>  y := conform_dims((/1200, 1200/), y, 0)<br><br>NOTE: THIS ASSUMES THE GRID IS ROW MAJOR, WEST-->EAST, NORTH-->SOUTH<br><br>The undocumented NCL function "transform_coordinates" takes a proj4 source-porjection string, dest-proj string, x, y, z 1D arrays of type double, and returns the results in the x,y,z arrays. I won't go into the details of the proj-strings. We want something like:<br><br>src = "+proj=aea +lat_0=23.0 +lat_1=21d03m +lat_2=41 +lon_0=102 +ellps=clrk66"<br>dst = "+proj=latlon +ellps=sphere"<br>x := flt2dble(ndtooned(x))<br>y := flt2dble(ndtooned(y))<br>z = x   ; A quick-n-dirty way to get an empty Z array of same dimensions/type<br>z = 0.  ;<br>transform_coordinate(src, dst, x, y, z)<br><br>; convert back to curvilinear coord arrays<br>lon = onedtond(x, (/1200, 1200/))<br>lat = onedtond(y, (/1200, 1200/))<br><br><br>From here, you have to associate the lat/lon coordinate arrays with the variables you want to plot, as Adam and other previously described.<br><br>Attached is a script and example plot of the resultant grid. Please let the group know if this appears to be the correct area-of-interest.<br><br>Rick<br><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 29, 2017 at 11:45 AM, Rick Brownrigg <span dir="ltr"><<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi,<br><br></div>I do not know for certain without examining the file, but it looks like those values are map-projection parameters, from which curvilinear grid was generated as equal-area grid cells in lat/lon spac.<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888">Rick<br> </font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 29, 2017 at 10:16 AM, Kunal Bali <span dir="ltr"><<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Thanks for all the suggestions and help Adam Sir. Now the data is showing over the Indian region.<br></div>but one thing I need to confirm here. <br><br></div>Some values in the form of UpperLeftPointMtrs and LowerRightMtrs are given in the file ((in the original hdf file) ) description along with X YDim.<br><br></div>So, does these value interfer while creating the lat lon dimensions during conversion netcdf from hdf? <br><br></div>Sould these values be consider or we can ignore these values?<br><div><div><br><br>group: latlon {<br>    variables:<br>      short _HDFEOS_CRS;<br>        :Projection = "GCTP_ALBERS";<br>        :<span style="color:rgb(255,0,0)"><b>UpperLeftPointMtrs</b></span> = -3450000.0, 1600000.0; // double<br>        <span style="color:rgb(255,0,0)"><b>:LowerRightMtrs</b></span> = -2250000.0, 400000.0; // double<br>        :ProjParams = 0.0, 0.0, 2.103E7, 4.1E7, 1.02E8, 2.3E7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0; // double<br>        :SphereCode = "12";<br><br>    group: Data_Fields {<br>      dimensions:<br>        YDim = 1200;<br>        XDim = 1200;<br>      variables:<br>        float lat(YDim=1200, XDim=1200);<br><br>        float lon(YDim=1200, XDim=1200);<br><br><div><br><br><br><br><br></div></div></div><div class="gmail_extra">Regards<br clear="all"></div><div class="gmail_extra"><div><div class="m_1604075636619690069m_2830862177600100630gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Kunal Bali<br></div><br><div><br></div><div><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;border-collapse:collapse;font-family:Tahoma,Verdana;font-size:12px"><font color="#1F497D"><br></font></p></div></div></div></div></div></div>
<br><div class="gmail_quote">On Thu, Sep 28, 2017 at 9:27 PM, Adam Phillips <span dir="ltr"><<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Kunal,<div>As the documentation states, latGlobeFo (lonGlobeFo) g<span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">enerates latitudes (longitudes) and associated metadata for a <i>global</i> </span>fixed offset<span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px"> grid. </span></div><div><font color="#333333" face="verdana, sans-serif"><span style="font-size:13.3333px"><a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/latGlobeFo.shtml" target="_blank">https://www.ncl.ucar.edu/Docum<wbr>ent/Functions/Contributed/latG<wbr>lobeFo.shtml</a></span></font><br></div><div><font color="#333333" face="verdana, sans-serif"><span style="font-size:13.3333px"><a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/lonGlobeFo.shtml" target="_blank">https://www.ncl.ucar.edu/Docum<wbr>ent/Functions/Contributed/lonG<wbr>lobeFo.shtml</a></span><br></font></div><div><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">If you need to create coordinates for a regional grid, then you will have to do it by hand. For example, if you know your data are equally spaced in the both the latitude and longitude direction from 0:40N, 60:100E (for example), you can set up your coordinates like this:</span></div><div><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px"><br></span></div><div><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">lat = fspan(0,40,1200)</span></div><div><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">lon = fspan(60,100,1200)</span></div><div><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">print(lat)   ; check that these are the correct coordinates</span></div><div><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">print(lon)   ; check that these are the correct coordinates</span><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px"><br></span></div><div><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">lat@units = "degrees_north"</span></div><div><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">lat!0 = "lat"</span></div><div><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">lat&lat = lat</span></div><div><div><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">lon@units = "degrees_east"</span></div><div><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">lon!0 = "lon"</span></div><div><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">lon&lon = lon</span></div></div><span><div><span style="font-size:12.6667px">var!0 = "lat"    ; you can name these dimensions whatever you want..</span><br style="font-size:12.6667px"><span style="font-size:12.6667px">var!1 = "lon"</span><br style="font-size:12.6667px"><span style="font-size:12.6667px">var&lat = lat     ; but make sure you refer to the correct named dimensions</span><br style="font-size:12.6667px"><span style="font-size:12.6667px">var&lon = lon </span><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px"><br></span></div><div><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px"><br></span></div></span><div><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">The above is similar to what latGlobeFo/lonGlobeFo do for global grids. Hope that helps. If you have further questions please respond to ncl-talk.</span></div><span class="m_1604075636619690069m_2830862177600100630HOEnZb"><font color="#888888"><div><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">Adam</span></div></font></span></div><div class="m_1604075636619690069m_2830862177600100630HOEnZb"><div class="m_1604075636619690069m_2830862177600100630h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 26, 2017 at 10:26 AM, Kunal Bali <span dir="ltr"><<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thanks for all the suggestions Dennis sir.<br></div><div>But now I have come to know that the dimensions <br><br></div><div>nlat=1200<br></div><div>nlon=1200<br><br></div><div>are belongs to only of Indian region. <br></div><div><br></div><div>And the code I am using below is not displaying the data over Indian region.<br></div><div><div><div><span style="font-size:12.8px"><br> lat = latGlobeFo(nlat, "lat", "latitude", "degrees_north")<br> lon = lonGlobeFo(nlon, "lon", "longitude", "degrees_east")<br>lat = lat(::-1)</span><br style="font-size:12.8px"><span style="font-size:12.8px">lon = (/ lon - 180. /)  ; subtract 180 from all values </span></div><div><span style="font-size:12.8px">lon&lon = lon      <br></span></div><div><br></div><div>So please help me regarding this issue.<br></div><div><div class="gmail_extra"><br clear="all"><div><div class="m_1604075636619690069m_2830862177600100630m_4105679417966897611m_1711624011424498933gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>regards<br>Kunal Bali<br></div><br><div><br></div><div><br></div><div><br></div><div><p style="margin:0px;border-collapse:collapse;font-family:Tahoma,Verdana;font-size:12px"><font color="#1F497D"><br></font></p></div></div></div></div></div></div>
<br><div class="gmail_quote">On Tue, Sep 19, 2017 at 10:36 PM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div>Ditto what Marston posted.<br><br>===<br></div>Please look at NCL's FAQ.<br><br></div>[1] Click "Support" at top of page<br></div>[2] Click FAQ<br><div><div><br></div><div>I think it would be instructive to look at all of the topics.<br><br></div><div>For example:  <b>Error messages and other issues<br><br></b></div><div>Look at #7<br><br><br></div><div><b></b></div></div></div><div class="m_1604075636619690069m_2830862177600100630m_4105679417966897611m_1711624011424498933gmail-HOEnZb"><div class="m_1604075636619690069m_2830862177600100630m_4105679417966897611m_1711624011424498933gmail-h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 19, 2017 at 3:03 AM, Marston Johnston <span dir="ltr"><<a href="mailto:shejo284@gmail.com" target="_blank">shejo284@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="white" lang="EN-GB"><div class="m_1604075636619690069m_2830862177600100630m_4105679417966897611m_1711624011424498933gmail-m_53067710425680568m_-1899063326404824290WordSection1"><p class="MsoNormal"><span>It tells you in the warning message, exactly what to do to remove the warning.<u></u><u></u></span></p><p class="MsoNormal"><span>If you want to improve you coding skills, it would better to understand why the warning is occurring in the first place: dimension 0 and 1 of the variable you are passing has no names or the names do not match the variable on the lhs.<u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span>/M<u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><div><p class="MsoNormal"><span style="font-size:12pt;font-family:"Times New Roman",serif;color:rgb(0,112,192)">~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"Times New Roman",serif;color:rgb(0,112,192)">Marston S. Ward, PhD<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"Times New Roman",serif;color:rgb(0,112,192)">Department of Earth Sciences<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"Times New Roman",serif;color:rgb(0,112,192)">University of Gothenburg, Sweden<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"Times New Roman",serif;color:rgb(0,112,192)">Email: <a href="mailto:marston.johnston@gu.se" target="_blank"><span style="color:rgb(0,112,192)">marston.johnston@gu.se</span></a><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"Times New Roman",serif;color:rgb(0,112,192)">SkypeID: marston.johnston <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"Times New Roman",serif;color:rgb(0,112,192)">Phone: <a href="tel:+46%2031%20786%2049%2001" value="+46317864901" target="_blank">+46-31-7864901</a> <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"Times New Roman",serif;color:rgb(0,112,192)">Only the fruitful thing is true!<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12pt;font-family:"Times New Roman",serif;color:rgb(0,112,192)">~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<u></u><u></u></span></p></div><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(181,196,223) currentcolor currentcolor;padding:3pt 0cm 0cm"><p class="MsoNormal"><b><span style="font-size:12pt;color:black">From: </span></b><span style="font-size:12pt;color:black">ncl-talk <<a href="mailto:ncl-talk-bounces@ucar.edu" target="_blank">ncl-talk-bounces@ucar.edu</a>> on behalf of Kunal Bali <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>><br><b>Date: </b>Tuesday, 19 September 2017 at 10:50<br><b>Cc: </b>"<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>" <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br><b>Subject: </b>Re: [ncl-talk] set_dimension_query<u></u><u></u></span></p></div><div><div class="m_1604075636619690069m_2830862177600100630m_4105679417966897611m_1711624011424498933gmail-m_53067710425680568h5"><div><p class="MsoNormal"><u></u> <u></u></p></div><div><div><p class="MsoNormal" style="margin-bottom:12pt">Thank you for providing this information. <u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt">It's working. The script given below is now able to convert multiple files into .netcdf with the desired file name.  <br>However, on the same time, it also shows some warnings. But noted that, I am successfully creating the multiple files into the netcdf. I just need to know that how can I remove these warnings? <br><br>warning:VarVarWrite: Dimension names for dimension number (0) don't match, assigning name of rhs dimension to lhs and overwriting coordinate variable, use "(/../)" if this change is not desired<br>warning:VarVarWrite: Dimension names for dimension number (1) don't match, assigning name of rhs dimension to lhs and overwriting coordinate variable, use "(/../)" if this change is not desired<br>warning:["Execute.c":8640]:Exe<wbr>cute: Error occurred at or near line 22 in file netcdf2.ncl<br><br> <br><br>;-----------------------------<wbr>------------------------------<wbr>-----------<br><br>load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_csm.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/contributed.ncl"<br><br>begin<br>;---Read data<br><br>        diri = "/Users/Pushp/Desktop/test/"   ; input directory<br>        fili  = systemfunc("cd "+diri+" ; ls MAIACTAOT.h00v02*hdf")<br>        nfili = dimsizes(fili)<br>        print("nfili="+nfili)<br><br> <br>        dirnc = "/Users/Pushp/Desktop/test/"   ; output (netCDF) directory<br><br>        do nf=0,nfili-1<br>        pthi = diri+fili(nf)<br>        f    = addfile(pthi,"r")<br><br>        var  = short2flt(f->Optical_Depth_055<wbr>(:,:))<br> <br>        nlat = 1200<br>        nlon = 1200<br>        lat  = latGlobeFo(nlat, "lat", "latitude", "degrees_north")<br>        lon  = lonGlobeFo(nlon, "lon", "longitude", "degrees_east")   <br>    ;    lat  = lat(::-1)<br>        lon  = (/ lon - 180. /)  ; subtract 180 from all values<br>        lon&lon = lon           ; update coordinates<br><br>        var!0 = "lat"    ; you can name these dimensions whatever you want..<br>        var!1 = "lon"<br>        var&lat = lat     ; but make sure you refer to the correct named dimensions<br>        var&lon = lon<br><br>     <br>     filroot = str_get_cols(fili(nf), 0, 27)  ; eg: "MAIACTAOT.h00v02.20000570505"<br>     filnc    = filroot+".nc"<br>     pthnc  = dirnc + filnc <br><br>     system("/bin/rm -f "+pthnc) <br>     ncdf = addfile(pthnc,"c")  ; open new netCDF file<br><br>    <br>     end do    ; end 'nf' loop<br>        <br>   ;     system("/bin/rm -f <a href="http://simple2.nc" target="_blank">simple2.nc</a>") <br>   ;     ncdf = addfile("<a href="http://simple2.nc" target="_blank">simple2.nc</a>" ,"c")  ; open output netCDF file<br><br>    ;=============================<wbr>==============================<wbr>========<br>    ; create global attributes of the file (optional)<br>    ;=============================<wbr>==============================<wbr>========<br>       fAtt               = True            ; assign file attributes<br>       fAtt@title         = "NCL Simple Approach to netCDF Creation"<br>       fAtt@source_file   =  "<a href="http://original-file.nc" target="_blank">original-file.nc</a>"<br>       fAtt@Conventions   = "None"<br>       fAtt@creation_date = systemfunc ("date")<br>       fileattdef( ncdf, fAtt )            ; copy file attributes<br><br>    ;=============================<wbr>==============================<wbr>========<br>    ; make time an UNLIMITED dimension; recommended  for most applications<br>    ;=============================<wbr>==============================<wbr>========<br>       filedimdef(ncdf,"time",-1,True<wbr>)<br><br>;       ncdf->var&lat = lat<br>;       ncdf->var&lon = lon<br>       ncdf->var = var<br><br>end<u></u><u></u></p></div><div><p class="MsoNormal"><br clear="all"><u></u><u></u></p><div><div><div><div><div><div><p class="MsoNormal">Kunal Bali<u></u><u></u></p></div><div><p class="MsoNormal">Research Scholar <u></u><u></u></p></div><div><p class="MsoNormal">Radio & Atmospheric Science Division <u></u><u></u></p></div><div><p class="MsoNormal">CSIR - National Physical Laboratory<u></u><u></u></p></div><div><p class="MsoNormal">New Delhi - 110012<u></u><u></u></p></div><div><p class="MsoNormal">India<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p style="margin:0cm 0cm 0.0001pt"><span style="font-size:9pt;font-family:"Tahoma",sans-serif"><u></u> <u></u></span></p></div></div></div></div></div></div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Mon, Sep 18, 2017 at 9:04 PM, Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>> wrote:<u></u><u></u></p><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><div><div><div><div><div><div><div><p class="MsoNormal">Loop over the files ...<u></u><u></u></p></div><div><p class="MsoNormal"><br> diri = "/media/Local Disk/NPL/MODIS_FPC/"   ; input directory<u></u><u></u></p></div><p class="MsoNormal"> fili  = systemfunc("cd "+diri +; ls <span style="font-size:9.5pt">MAIACTAOT.h00v02*hdf")</span><u></u><u></u></p></div><p class="MsoNormal"><span style="font-size:9.5pt"> nfili = dimsizes(fili)</span><u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:9.5pt"> print("nfili="+nfili)</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt"> dirnc = "/media/Local Disk/NPL/MODIS_FPC/"   ; output (netCDF) directory</span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal"><span style="font-size:9.5pt"> do nf=0,nfili-1</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">      pthi = diri+fili(nf)</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">      f      = addfile(pthi,"r")<br><br>      ....<br><br>     </span>filroot = <b><span style="font-family:"Calibri",sans-serif">str_get_cols</span></b>(fili(nf), 0, 27)  ; eg: "MAIACTAOT.h00v02.20000570505"<u></u><u></u></p></div><p class="MsoNormal"><span style="font-size:9.5pt">     filnc    = filroot+".nc"</span><u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:9.5pt">     pthnc  = dirnc + filnc<br></span><br><span style="font-size:9.5pt">     system("/bin/rm -f "+pthnc)  <br>     ncdf = addfile(pthnc,"c")  ; open new netCDF file<br><br>     ....<br><br></span><u></u><u></u></p></div><p class="MsoNormal"><span style="font-size:9.5pt">end do    ; end 'nf' loop</span><u></u><u></u></p><div><div><p class="MsoNormal"><span style="font-size:9.5pt"><br>=====</span><u></u><u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:9.5pt">If there is something you do not understand use some print statements.</span><u></u><u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:9.5pt">Become familiar with the 'string' category. Look at all the functions.<br><br>   <a href="https://www.ncl.ucar.edu/Document/Functions/string.shtml" target="_blank">https://www.ncl.ucar.edu/Docum<wbr>ent/Functions/string.shtml</a></span><u></u><u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:9.5pt">Please read the documentation for the function used above<br><br>   <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/str_get_cols.shtml" target="_blank">https://www.ncl.ucar.edu/Docum<wbr>ent/Functions/Built-in/str_get<wbr>_cols.shtml</a></span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">Good Luck</span><u></u><u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12pt"><u></u> <u></u></p></div></div></div><div><div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Mon, Sep 18, 2017 at 6:11 AM, Kunal Bali <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>> wrote:<u></u><u></u></p><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><div><p class="MsoNormal">Thnks for the reply. <u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12pt">that will change the name of only one file. isn't it. but what about the other files <u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt">I have 365 files in one directory and I need to change all the file name one by one.<u></u><u></u></p><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><br clear="all"></span><span class="m_1604075636619690069m_2830862177600100630m_4105679417966897611m_1711624011424498933gmail-m_53067710425680568m_-1899063326404824290m1966040847522573004hoenzb"><span style="color:rgb(136,136,136)"><u></u><u></u></span></span></p><div><div><div><div><div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)">Kunal Bali</span><u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p></div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p></div><div><p style="margin:0cm 0cm 0.0001pt"><span style="font-size:9pt;font-family:"Tahoma",sans-serif;color:rgb(136,136,136)"><u></u> <u></u></span></p></div></div></div></div></div></div><div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Mon, Sep 18, 2017 at 5:14 PM, Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>> wrote:<u></u><u></u></p><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><p class="MsoNormal">Really? <br><br>Change:<br>      system("/bin/rm -f <a href="http://simple.nc" target="_blank">simple.nc</a>")  <br>      ncdf = addfile("<a href="http://simple.nc" target="_blank">simple.nc</a>" ,"c") <br><br>To:<br>      system("/bin/rm -f <a href="http://simple.nc" target="_blank">MAIACTAOT.h00v02.20000570505.n<wbr>c</a>")  <br>      ncdf = addfile("MAIACTAOT.h<a href="http://00v02.20000570505.nc" target="_blank">00v02.2000<wbr>0570505.nc</a>" ,"c") <u></u><u></u></p><div><div><p class="MsoNormal"><u></u> <u></u></p></div></div></div><div><div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Mon, Sep 18, 2017 at 12:37 AM, Kunal Bali <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>> wrote:<u></u><u></u></p><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><div><div><div><div><div><div><div><div><div><p class="MsoNormal" style="margin-bottom:12pt">Thanks, it worked.<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt">one more question is that.<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt">I used the code (given below). So it gives <a href="http://simple.nc" target="_blank">simple.nc</a> name as an output file.<br><br>ncdf = addfile("<a href="http://simple.nc" target="_blank">simple.nc</a>" ,"c")<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt">If I want to keep the original file name with the output file name then what should I do?<u></u><u></u></p></div><p class="MsoNormal">I mean the original file name is MAIACTAOT.h00v02.20003660700.h<wbr>df<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt">Now I want to create my netcdf file name  as <a href="http://MAIACTAOT.h00v02.20003660700.nc" target="_blank">MAIACTAOT.h00v02.20003660700.n<wbr>c</a> NOT <a href="http://simple.nc" target="_blank">simple.nc</a>. <u></u><u></u></p></div><p class="MsoNormal">I can not simply write <a href="http://simple.nc" target="_blank">simple.nc</a> file name because I have many files. <u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt">e.g I have one directory having 365 .hdf file. So I need to convert all the hdf file to netcdf file at once with the same name of original file names.<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt">I hope you have got my query.<u></u><u></u></p></div><p class="MsoNormal">please let me know that too.<u></u><u></u></p><div><div><div><div><div><div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Thank You<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></div></div></div><div><p class="MsoNormal"><br clear="all"><u></u><u></u></p><div><div><div><div><div><div><p class="MsoNormal">Kunal Bali<u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p style="margin:0cm 0cm 0.0001pt"><span style="font-size:9pt;font-family:"Tahoma",sans-serif"><u></u> <u></u></span></p></div></div></div></div></div></div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Thu, Sep 14, 2017 at 9:09 PM, Adam Phillips <<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.edu</a>> wrote:<u></u><u></u></p><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><p class="MsoNormal">Hi Kunal,<u></u><u></u></p><div><p class="MsoNormal">It looks to me like your latitudes are flipped. You are setting up and assigning your coordinate lat/lon variables in this coding:<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">nlat = 1200<br>nlon = 1200<br>lat = latGlobeFo(nlat, "lat", "latitude", "degrees_north")</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">lon = lonGlobeFo(nlon, "lon", "longitude", "degrees_east")   <br>lat = lat(::-1)<br>lon = (/ lon - 180. /)  ; subtract 180 from all values </span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">lon&lon = lon           ; update coordinates<br><br>var!0 = "lat"    ; you can name these dimensions whatever you want..<br>var!1 = "lon"<br>var&lat = lat     ; but make sure you refer to the correct named dimensions<br>var&lon = lon </span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Assuming I'm right on your latitudes being the issue, one of the following two modifications should work:<u></u><u></u></p></div><div><p class="MsoNormal">Delete this line:<u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">lat = lat(::-1)</span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">If the above doesn't fix it, try this:</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">Change this:</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">lat = lat(::-1)</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">to this:</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">lat = lat(::-1)</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">lat&lat = lat</span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">If you continue to have issues please respond to ncl-talk.</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt;color:rgb(136,136,136)">Adam</span><span style="color:rgb(136,136,136)"><u></u><u></u></span></p></div></div><div><div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Wed, Sep 13, 2017 at 12:35 PM, Kunal Bali <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>> wrote:<u></u><u></u></p><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">For direct output as a netcdf format, I used the script given below. It produced the netcdf file easily. But the netcdf file and original hdf file both showing the different results. The data pattern is shifted. I mean it may be related to the lat lon position. please see the attached file, you will understand.  And please let me know which one is correct. <br><br>;-----------------------------<wbr>------------------------------<wbr>-----------<br><br>load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_csm.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/contributed.ncl"<br><br>begin<br>;---Read data <br>        a = addfile("/media/Local Disk/NPL/MODIS_FPC/MAIACTAOT.h<wbr>00v02.20000570505.hdf","r")<br>        var  = short2flt(a->Optical_Depth_055<wbr>(:,:))<br>            ;          short2flt(a[:]->noxfire)<br>        nlat = 1200<br>        nlon = 1200<br>        lat = latGlobeFo(nlat, "lat", "latitude", "degrees_north")<br>        lon = lonGlobeFo(nlon, "lon", "longitude", "degrees_east")   <br>        lat = lat(::-1)<br>        lon = (/ lon - 180. /)  ; subtract 180 from all values <br>        lon&lon = lon           ; update coordinates<br><br>        var!0 = "lat"    ; you can name these dimensions whatever you want..<br>        var!1 = "lon"<br>        var&lat = lat     ; but make sure you refer to the correct named dimensions<br>        var&lon = lon <br>        <br>                 system("/bin/rm -f <a href="http://simple.nc" target="_blank">simple.nc</a>")  <br>             ncdf = addfile("<a href="http://simple.nc" target="_blank">simple.nc</a>" ,"c")  ; open output netCDF file<br><br>    ;=============================<wbr>==============================<wbr>========<br>    ; create global attributes of the file (optional)<br>    ;=============================<wbr>==============================<wbr>========<br>       fAtt               = True            ; assign file attributes<br>       fAtt@title         = "NCL Simple Approach to netCDF Creation"<br>       fAtt@source_file   =  "<a href="http://original-file.nc" target="_blank">original-file.nc</a>"<br>       fAtt@Conventions   = "None"<br>       fAtt@creation_date = systemfunc ("date")<br>       fileattdef( ncdf, fAtt )            ; copy file attributes<br><br>    ;=============================<wbr>==============================<wbr>========<br>    ; make time an UNLIMITED dimension; recommended  for most applications<br>    ;=============================<wbr>==============================<wbr>========<br>       filedimdef(ncdf,"time",-1,True<wbr>) <br>       ncdf->var = var<br><br>end<br>       <br>     <u></u><u></u></p><div><div><p class="MsoNormal"><u></u> <u></u></p></div></div><div><p class="MsoNormal"><br clear="all"><u></u><u></u></p><div><div><div><div><div><div><p class="MsoNormal">Kunal Bali<u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p style="margin:0cm 0cm 0.0001pt"><span style="font-size:9pt;font-family:"Tahoma",sans-serif"><u></u> <u></u></span></p></div></div></div></div></div></div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Wed, Sep 13, 2017 at 11:27 PM, Kunal Bali <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>> wrote:<u></u><u></u></p><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><div><p class="MsoNormal" style="margin-bottom:12pt">No problem, I sorted out. <u></u><u></u></p></div><p class="MsoNormal">Just changed short to float. <u></u><u></u></p></div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><br clear="all"></span><span class="m_1604075636619690069m_2830862177600100630m_4105679417966897611m_1711624011424498933gmail-m_53067710425680568m_-1899063326404824290m1966040847522573004m2882238953881155132m4735875726629588789m-4928089736255412493m9186617808376476535m-3688407689937875090hoenzb"><span style="color:rgb(136,136,136)"><u></u><u></u></span></span></p><div><div><div><div><div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)">Kunal Bali</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)">Research Scholar <u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)">Radio & Atmospheric Science Division <u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)">CSIR - National Physical Laboratory<u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)">New Delhi - 110012<u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)">India<u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p></div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p></div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p></div><div><p style="margin:0cm 0cm 0.0001pt"><span style="font-size:9pt;font-family:"Tahoma",sans-serif;color:rgb(136,136,136)"><u></u> <u></u></span></p></div></div></div></div></div></div><div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Wed, Sep 13, 2017 at 11:24 PM, Kunal Bali <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>> wrote:<u></u><u></u></p><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><div><div><div><p class="MsoNormal" style="margin-bottom:12pt">Thanks for providing this information. <u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt">Also, I would like to mention that when I plot this data. The values are not in the domain. I mean the real values lie in-between 0 to 1 but here it is reaching to 400. <u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt">So, how to correct the values?<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt">Description of the variable is <br><br>short Optical_Depth_055(YDim=1200, XDim=1200);<br>  :long_name = "AOT at 0.55 micron";<br>  :scale_factor = 0.001; // double<br>  :add_offset = 0.0; // double<br>  :unit = "None";<br>  :_FillValue = -28672S; // short<br>  :valid_range = -100S, 5000S; // short<span style="color:rgb(136,136,136)"><br><br><br></span><u></u><u></u></p><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><br clear="all"></span><span class="m_1604075636619690069m_2830862177600100630m_4105679417966897611m_1711624011424498933gmail-m_53067710425680568m_-1899063326404824290m1966040847522573004m2882238953881155132m4735875726629588789m-4928089736255412493m9186617808376476535m-3688407689937875090m7418340254611092360hoenzb"><span style="color:rgb(136,136,136)"><u></u><u></u></span></span></p><div><div><div><div><div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)">Kunal Bali</span><u></u><u></u></p></div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p></div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p></div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p></div><div><p style="margin:0cm 0cm 0.0001pt"><span style="font-size:9pt;font-family:"Tahoma",sans-serif;color:rgb(136,136,136)"><u></u> <u></u></span></p></div></div></div></div></div></div><div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Wed, Sep 13, 2017 at 10:28 PM, Adam Phillips <<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.edu</a>> wrote:<u></u><u></u></p><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><p class="MsoNormal">Hi Kunal,<u></u><u></u></p><div><p class="MsoNormal">Yes, clicking on the output netCDF link from the Applications page: <u></u><u></u></p></div><div><p class="MsoNormal"><a href="http://www.ncl.ucar.edu/Applications/o-netcdf.shtml" target="_blank">http://www.ncl.ucar.edu/Applic<wbr>ations/o-netcdf.shtml</a><u></u><u></u></p></div><div><p class="MsoNormal">I would recommend following the inefficient method #1. Unless you are writing a file with many large variables, the inefficient method works just fine. <u></u><u></u></p></div><div><p class="MsoNormal"><a href="http://www.ncl.ucar.edu/Applications/method_1.shtml" target="_blank">http://www.ncl.ucar.edu/Applic<wbr>ations/method_1.shtml</a><u></u><u></u></p></div><div><p class="MsoNormal">Good luck,<u></u><u></u></p></div><div><p class="MsoNormal">Adam  <u></u><u></u></p></div></div><div><div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Wed, Sep 13, 2017 at 10:25 AM, Kunal Bali <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>> wrote:<u></u><u></u></p><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><div><p class="MsoNormal" style="margin-bottom:12pt">Thank you so much, it worked<u></u><u></u></p></div><p class="MsoNormal">I want to know one more thing.<br>After rearranging the dimensions can we now convert (or write) this arranged file into netcdf format?<u></u><u></u></p><div><div><div><div><p class="MsoNormal" style="margin-bottom:12pt"><br><br><u></u><u></u></p></div></div></div></div><div><div><div><div><div><div><div><p class="MsoNormal">Kunal Bali<u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p style="margin:0cm 0cm 0.0001pt"><span style="font-size:9pt;font-family:"Tahoma",sans-serif"><u></u> <u></u></span></p></div></div></div></div></div></div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Wed, Sep 13, 2017 at 8:55 PM, Adam Phillips <<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.edu</a>> wrote:<u></u><u></u></p><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><p class="MsoNormal">Hi Kunal,<u></u><u></u></p><div><p class="MsoNormal">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:<u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">a = addfile("/media/Local Disk/NPL/MODIS_FPC/MAIACTAOT.h<wbr>00v02.20000570505.hdf","r")<br>var  = a->Optical_Depth_055(:,:)<br>nlat = 1200<br>nlon = 1200<br>lat = latGlobeFo(nlat, "lat", "latitude", "degrees_north")</span><u></u><u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:9.5pt">lon = lonGlobeFo(nlon, "lon", "longitude", "degrees_east")   <br>lat = lat(::-1)<br>lon = (/ lon - 180. /)  ; subtract 180 from all values <br>lon&lon = lon           ; update coordinates</span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">var!0 = "lat"    ; you can name these dimensions whatever you want..<br>var!1 = "lon"</span><u></u><u></u></p></div><p class="MsoNormal"><span style="font-size:9.5pt">var&lat = lat     ; but make sure you refer to the correct named dimensions</span><u></u><u></u></p><div><div><p class="MsoNormal"><span style="font-size:9.5pt">var&lat = lon </span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">;var&XDim_grid1km = lat<br>;var&YDim_grid1km = lon<br> </span><u></u><u></u></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">If you have any further questions please respond to the ncl-talk email list.</span><u></u><u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:9.5pt">Adam </span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div></div></div><div><p class="MsoNormal"><u></u> <u></u></p><div><div><div><p class="MsoNormal">On Wed, Sep 13, 2017 at 8:38 AM, Kunal Bali <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>> wrote:<u></u><u></u></p></div></div><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:currentcolor currentcolor currentcolor rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><div><div><div><div><div><p class="MsoNormal" style="margin-bottom:12pt">Dear NCL<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt">I have a file with the variable summary. The dimensions are in 2D. <br><br>ncl 2>  printVarSummary(var)<br><br>Variable: var<br>Type: short<br>Total Size: 2880000 bytes<br>            1440000 values<br>Number of Dimensions: 2<br>Dimensions and sizes:    [<b>YDim_grid1km | 1200] x [XDim_grid1km | 1200]</b><br>Coordinates: <br>Number Of Attributes: 7<br>  long_name :    AOT at 0.55 micron<br>  scale_factor :    0.001<br>  add_offset :       0<br>  unit :    None<br>  _FillValue :    -28672<br>  valid_range :    ( -100, 5000 )<br>  hdf_name :    Optical_Depth_055<br><br><u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt">I am trying to read the dimensions of this file as<br><br>begin<br>;---Read data <br>         a = addfile("/media/Local Disk/NPL/MODIS_FPC/MAIACTAOT.h<wbr>00v02.20000570505.hdf","r")<br>  <br>            var  = a->Optical_Depth_055(:,:)<br><br>         var&XDim_grid1km = lat<br>         var&YDim_grid1km = lon<br><br>        nlat = 1200<br>         nlon = 1200<br>            lat = latGlobeFo(nlat, "lat", "latitude", "degrees_north")<br>        lon = lonGlobeFo(nlon, "lon", "longitude", "degrees_east")   <br>            lat = lat(::-1)<br>            lon = (/ lon - 180. /)  ; subtract 180 from all values <br>            lon&lon = lon           ; update coordinates<br> <br>   <br>        var!0 = "lat"<br>        var!1 = "lon"<br> <u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12pt">But the error appeared as  <br><b>fatal:Variable (lat) is undefined</b><u></u><u></u></p><div><div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12pt">So, could anyone please let me know that how to read dimension of this file. <u></u><u></u></p></div><div><p class="MsoNormal">Thank You<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Regards<span style="color:rgb(136,136,136)"><br clear="all"></span><u></u><u></u></p></div><div><div><div><div><div><div><div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)">Kunal Bali<u></u><u></u></span></p></div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p></div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p></div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p></div><div><p style="margin:0cm 0cm 0.0001pt"><span style="font-size:9pt;font-family:"Tahoma",sans-serif;color:rgb(136,136,136)"><u></u> <u></u></span></p></div></div></div></div></div></div></div></div></div></div></div></div><p class="MsoNormal"><u></u> <u></u></p></div></div><p class="MsoNormal" style="margin-bottom:12pt">______________________________<wbr>_________________<br>ncl-talk mailing list<br><a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>List instructions, subscriber options, unsubscribe:<br><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><u></u><u></u></p></blockquote></div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><br><br clear="all"></span><span class="m_1604075636619690069m_2830862177600100630m_4105679417966897611m_1711624011424498933gmail-m_53067710425680568m_-1899063326404824290m1966040847522573004m2882238953881155132m4735875726629588789m-4928089736255412493m9186617808376476535m-3688407689937875090m7418340254611092360m-6183322678709470722m4501774087300120891hoenzb"><span style="color:rgb(136,136,136)"><u></u><u></u></span></span></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal"><span class="m_1604075636619690069m_2830862177600100630m_4105679417966897611m_1711624011424498933gmail-m_53067710425680568m_-1899063326404824290m1966040847522573004m2882238953881155132m4735875726629588789m-4928089736255412493m9186617808376476535m-3688407689937875090m7418340254611092360m-6183322678709470722m4501774087300120891hoenzb"><span style="color:rgb(136,136,136)">-- </span><u></u><u></u></span></p><div><div><div><div><div><div><div><div><div><div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)">Adam Phillips </span><u></u><u></u></p></div><p class="MsoNormal"><span style="color:rgb(136,136,136)">Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR<u></u><u></u></span></p></div></div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphill<wbr>i/</a>   <a href="tel:%28303%29%20497-1726" target="_blank">303-497-1726</a> <u></u><u></u></span></p></div><div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p></div></div></div></div></div></div></div></div></div></div></div></blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div></div><p class="MsoNormal" style="margin-bottom:12pt"><br>______________________________<wbr>_________________<br>ncl-talk mailing list<br><a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>List instructions, subscriber options, unsubscribe:<br><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><u></u><u></u></p></blockquote></div><p class="MsoNormal"><br><br clear="all"><span class="m_1604075636619690069m_2830862177600100630m_4105679417966897611m_1711624011424498933gmail-m_53067710425680568m_-1899063326404824290m1966040847522573004m2882238953881155132m4735875726629588789m-4928089736255412493m9186617808376476535hoenzb"><span style="color:rgb(136,136,136)"><u></u><u></u></span></span></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal"><span class="m_1604075636619690069m_2830862177600100630m_4105679417966897611m_1711624011424498933gmail-m_53067710425680568m_-1899063326404824290m1966040847522573004m2882238953881155132m4735875726629588789m-4928089736255412493m9186617808376476535hoenzb"><span style="color:rgb(136,136,136)">-- </span><u></u><u></u></span></p><div><div><div><div><div><div><div><div><div><div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)">Adam Phillips </span><u></u><u></u></p></div><p class="MsoNormal"><span style="color:rgb(136,136,136)">Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR<u></u><u></u></span></p></div></div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphill<wbr>i/</a>   <a href="tel:%28303%29%20497-1726" target="_blank">303-497-1726</a> <u></u><u></u></span></p></div><div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p></div></div></div></div></div></div></div></div></div></div></div></div></div></blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div></div><p class="MsoNormal" style="margin-bottom:12pt"><br>______________________________<wbr>_________________<br>ncl-talk mailing list<br><a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>List instructions, subscriber options, unsubscribe:<br><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><u></u><u></u></p></blockquote></div><p class="MsoNormal"><br><br clear="all"><span class="m_1604075636619690069m_2830862177600100630m_4105679417966897611m_1711624011424498933gmail-m_53067710425680568m_-1899063326404824290m1966040847522573004m2882238953881155132m4735875726629588789hoenzb"><span style="color:rgb(136,136,136)"><u></u><u></u></span></span></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal"><span class="m_1604075636619690069m_2830862177600100630m_4105679417966897611m_1711624011424498933gmail-m_53067710425680568m_-1899063326404824290m1966040847522573004m2882238953881155132m4735875726629588789hoenzb"><span style="color:rgb(136,136,136)">-- </span><u></u><u></u></span></p><div><div><div><div><div><div><div><div><div><div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)">Adam Phillips </span><u></u><u></u></p></div><p class="MsoNormal"><span style="color:rgb(136,136,136)">Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR<u></u><u></u></span></p></div></div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphill<wbr>i/</a>   <a href="tel:%28303%29%20497-1726" target="_blank">303-497-1726</a> <u></u><u></u></span></p></div><div><div><p class="MsoNormal"><span style="color:rgb(136,136,136)"><u></u> <u></u></span></p></div></div></div></div></div></div></div></div></div></div></div></div></div></blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div></div><p class="MsoNormal" style="margin-bottom:12pt"><br>______________________________<wbr>_________________<br>ncl-talk mailing list<br><a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>List instructions, subscriber options, unsubscribe:<br><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><u></u><u></u></p></blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div><p class="MsoNormal" style="margin-bottom:12pt"><br>______________________________<wbr>_________________<br>ncl-talk mailing list<br><a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>List instructions, subscriber options, unsubscribe:<br><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><u></u><u></u></p></blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">______________________________<wbr>_________________ ncl-talk mailing list <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> List instructions, subscriber options, unsubscribe: <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a> <u></u><u></u></p></div></div></div></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div></div></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br><br clear="all"><span class="m_1604075636619690069HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_1604075636619690069m_2830862177600100630m_4105679417966897611gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist,  </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphill<wbr>i/</a>   </font></span><span><font color="#888888"><a href="tel:(303)%20497-1726" value="+13034971726" target="_blank">303-497-1726</a> </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</font></span></div>
</div></div></blockquote></div><br></div></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>