Re: FW: I mean regridding the data to a rectiliniear lat / lon grid

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri Oct 19 2012 - 07:20:27 MDT

You want to regrid.

The Lambert Conformal is 'curvilinear grid' and you want to
regrid to a 'rectilinear grid'. There are numerous examples on
the 'ESMF Regrid' page

http://www.ncl.ucar.edu/Applications/ then "ESMF Regridding"

Examples 5 and 8 couls serve as a basis for your needs

On 10/18/12 9:48 PM, Ping Yang wrote:
> Hi David,
>
> I am just following on a previous posted topic related to Lambert
> Conformal Conic grid, I plan to re-project (or regrid) a grid data which
> has the following information:
>
> dimensions:
> x = 189 ;
> y = 227 ;
> time = 365 ;
> nv = 2 ;
> variables:
> short lambert_conformal_conic ;
> lambert_conformal_conic:grid_mapping_name = "lambert_conformal_conic" ;
> lambert_conformal_conic:longitude_of_central_meridian = -100. ;
> lambert_conformal_conic:latitude_of_projection_origin = 42.5 ;
> lambert_conformal_conic:false_easting = 0. ;
> lambert_conformal_conic:false_northing = 0. ;
> lambert_conformal_conic:standard_parallel = 25., 60. ;
> double x(x) ;
> x:units = "m" ;
> x:long_name = "x coordinate of projection" ;
> x:standard_name = "projection_x_coordinate" ;
> double y(y) ;
> y:units = "m" ;
> y:long_name = "y coordinate of projection" ;
> y:standard_name = "projection_y_coordinate" ;
> double time(time) ;
> time:long_name = "time" ;
> time:calendar = "standard" ;
> time:units = "days since 1980-01-01 00:00:00 UTC" ;
> time:bounds = "time_bnds" ;
> double lat(y, x) ;
> lat:units = "degrees_north" ;
> lat:long_name = "latitude coordinate" ;
> lat:standard_name = "latitude" ;
> double lon(y, x) ;
> lon:units = "degrees_east" ;
> lon:long_name = "longitude coordinate" ;
> lon:standard_name = "longitude" ;
> short yearday(time) ;
> yearday:long_name = "yearday" ;
> yearday:valid_range = 1s, 365s ;
> float prcp(time, y, x) ;
> prcp:long_name = "daily total precipitation" ;
> prcp:units = "mm/day" ;
> prcp:missing_value = -9999.f ;
> prcp:_FillValue = -9999.f ;
> prcp:valid_range = 0.f, 200.f ;
> prcp:coordinates = "lat lon" ;
> prcp:grid_mapping = "lambert_conformal_conic" ;
> prcp:cell_methods = "area: sum time: sum" ;
> double time_bnds(time, nv) ;
>
> I need to do the following:
>
> 1) change the projection into lat/lon
> 2)regrid the data from higher resolution into lower resolution(aggregating)
>
> I am asking which will be the first to do and how can I do
> it(lambert_conformal_conic to lon/lat).
>
> Looking forward to hearing from you.
>
> Best Regards
>
> Ping
>
>
>
> On Fri, Aug 10, 2012 at 4:00 PM, David Brown <dbrown@ucar.edu
> <mailto:dbrown@ucar.edu>> wrote:
>
> Hi Gualberto,
> I am enclosing a modified version of the script that uses NCL to
> generate the 2D lat/lon coordinate arrays and write them to a file.
> To demonstrate their correctness, it uses them to
> transform the data into an orthographic projection. You can use the
> lat/lon arrays to perform the re-gridding, step 4 of the process
> outlined by Dave Allured. For that I recommend studying the
> ESMF regridding examples at
> http://www.ncl.ucar.edu/Applications/ESMF.shtml. You will need NCL
> 6.1.0-beta if you don't have it already. I also am attaching the
> orthographic plot.
> -dave
>
>
>
>
> On Aug 9, 2012, at 11:41 PM, Gualberto Hernández Juárez wrote:
>
>> Dave,
>>
>> I offer youexcuseforlatereply,
>>
>> So I understandwith the file yousent me"lcnative.ncl"I can nowrun
>> theregridding?
>>
>> You will havesomevery basicexamplethat can serve asreferenceto do
>> it?I supposeI have to useESMF.
>>
>> Thanks,
>> Gualberto
>>
>> ------------------------------------------------------------------------
>> Subject: Re: [ncl-talk] FW: I mean regridding the data to a
>> rectiliniear lat / lon grid
>> From:dbrown@ucar.edu <mailto:dbrown@ucar.edu>
>> Date: Thu, 9 Aug 2012 17:02:01 -0600
>> CC:ncl-talk@ucar.edu <mailto:ncl-talk@ucar.edu>
>> To:betoic@hotmail.com <mailto:betoic@hotmail.com>
>>
>> Hi Gualberto,
>> I have figured out what I think are the correct (or at least close
>> enough) parameters to get the right results from the PROJ4 tool. I
>> think the main issue I was having is that the Lambert Conformal
>> Conic projection has a singularity over the equator, because it
>> ceases to be conic and becomes a cylinder. At least NCL does not
>> work with a single parallel set to 0.0. However, I can make it
>> work using 2 standard parallels very close to each other (0.0 and
>> 0.01). The PROJ4 tool does not give up, but the numbers were wrong
>> if you do not do something similar. Anyway it would now be
>> possible to generate the 2d lat/lon arrays that you will need for
>> re-gridding, either just using PROJ4 or by sampling the projected
>> space in NCL. I am attaching a plot of temperature that I think
>> shows the map boundaries aligning very well with the data. I also
>> include the version of the script that created it.
>> -dave
>>
>>
>>
>> On Aug 8, 2012, at 1:47 PM, Gualberto Hernández Juárez wrote:
>>
>> I have not done, mainly becauseArcGisalsolimitedinNetCDFformat
>>
>> ------------------------------------------------------------------------
>> From:dbrown@ucar.edu <mailto:dbrown@ucar.edu>
>> Subject: Re: [ncl-talk] FW: I mean regridding the data to a
>> rectiliniear lat / lon grid
>> Date: Wed, 8 Aug 2012 12:46:30 -0600
>> To:betoic@hotmail.com <mailto:betoic@hotmail.com>
>>
>> One question: Can you find out the projection parameters
>> and/or the corner lat/lon values using ArcGIS?
>> -dave
>>
>> On Aug 8, 2012, at 12:35 PM, Gualberto Hernández Juárez wrote:
>>
>>
>> Dave,
>>
>> This is howI see itinArcGIS,correspondsto the same
>> variableMSLP.As yousaidthe picture yousent meisa little shaky.
>>
>> Gualberto.
>>
>>
>> ------------------------------------------------------------------------
>> From:dbrown@ucar.edu <mailto:dbrown@ucar.edu>
>> Subject: Re: [ncl-talk] FW: I mean regridding the data to
>> a rectiliniear lat / lon grid
>> Date: Wed, 8 Aug 2012 11:17:02 -0600
>> To:betoic@hotmail.com <mailto:betoic@hotmail.com>
>>
>> I was hoping for an image with the continental boundaries
>> correctly placed. To show you what I mean here is the best
>> I have been able to do using NCL. The trick is to figure
>> out the correct projection parameters and the lat/lon
>> locations of the lower left and upper right corner points.
>> I did this using the PROJ4 projection tool (similar in
>> capabilities to the tool Dave Allured recommended -- MPS
>> Geotrans). But I am not sure I got the right values
>> because it looks to me like the data does not quite fit
>> the map outlines. I would not trust any re-gridding
>> operation if I could not first get the the map outlines
>> correctly placed. It looks to me (based on plotting a
>> number of the pressure and temperature time steps) that
>> the lower part of Mexico and Central America is skewed to
>> the right and that not so much of South America should be
>> visible. Anyway so you know what I am talking about I am
>> attaching the plot I came up with in NCL. Also the script
>> as it exists now. Perhaps you have access to more
>> information about the projection parameters?
>> -dave
>>
>>
>>
>>
>> On Aug 7, 2012, at 8:20 PM, Gualberto Hern�ndez Ju�rez wrote:
>>
>>
>>
>> Dave,
>> I send the image
>> ------------------------------------------------------------------------
>> From:dbrown@ucar.edu <mailto:dbrown@ucar.edu>
>> Subject: Re: [ncl-talk] FW: I mean regridding the data
>> to a rectiliniear lat / lon grid
>> Date: Tue, 7 Aug 2012 18:16:24 -0600
>> To:betoic@hotmail.com <mailto:betoic@hotmail.com>
>>
>> Sorry maybe I misunderstand. I have the NetCDF
>> file MMOUT_DOMAIN1.nc. But I thought you said you
>> uploaded an image (picture ??) of the plot you made in
>> ArcMap. I would like to see the picture if you can
>> send it.
>> -dave
>>
>> On Aug 7, 2012, at 5:23 PM, Gualberto Hern�ndez Ju�rez
>> wrote:
>>
>> This is the fileMMOUT_DOMAIN1.nc
>>
>> The fileyou put inplace it
>> ftp://ftp.cgd.ucar.edu/incoming/
>>
>>
>> ------------------------------------------------------------------------
>> From:dbrown@ucar.edu <mailto:dbrown@ucar.edu>
>> Subject: Re: [ncl-talk] FW: I mean regridding the
>> data to a rectiliniear lat / lon grid
>> Date: Tue, 7 Aug 2012 17:19:16 -0600
>> To:betoic@hotmail.com <mailto:betoic@hotmail.com>
>>
>> (offline)
>> I need to know what you called the file in order
>> to retrieve it.
>> -dave
>>
>> On Aug 7, 2012, at 5:10 PM, Gualberto Hern�ndez
>> Ju�rez wrote:
>>
>> Thanks for your replyDave,
>>
>> Iplotthe fileonly inArcMap ofArcGIS, place an
>> imageinthe directory:
>>
>>
>> ftp://ftp.cgd.ucar.edu/incoming/
>>
>>
>> I just have toput the mapof the Mexican republic.
>>
>>
>> ------------------------------------------------------------------------
>> Subject: Re: [ncl-talk] FW: I mean regridding
>> the data to a rectiliniear lat / lon grid
>> From:dbrown@ucar.edu <mailto:dbrown@ucar.edu>
>> Date: Tue, 7 Aug 2012 16:41:41 -0600
>> CC:ncl-talk@ucar.edu <mailto:ncl-talk@ucar.edu>
>> To:betoic@hotmail.com <mailto:betoic@hotmail.com>
>>
>> Hi Gaulberto,
>> Here is a way to write the text file as X/Y
>> pairs as Dave Allured suggested:
>>
>> f = addfile ("MMOUT_DOMAIN1.nc", "r")
>> x = f->lon
>> y = f->lat
>> nx = dimsizes(x)
>> ny = dimsizes(y)
>> x2d = conform_dims((/ny,nx/),x,1)
>> y2d = conform_dims((/ny,nx/),y,0)
>> outstr = sprintf("%9.3f",x2d) + " " +
>> sprintf("%9.3f",y2d)
>> asciiwrite("xy.txt",outstr)
>>
>> I wonder if you have a plot of this grid in
>> its native (Lambert Conformal) configuration.
>> I have tried to plot it based on the LC
>> parameters given in the data file, but so far
>> I have been unsuccessful.
>> A correct plot of the domain would help.
>>
>> If you can get NCL to plot the data correctly
>> in its native projection, then it is possible
>> to compute the lat/lon coordinates using NCL
>> by itself.
>> -dave
>>
>>
>> On Aug 7, 2012, at 2:06 PM, Gualberto
>> Hern�ndez Ju�rez wrote:
>>
>> Dave,
>> How to make the text file, which you
>> mention in the first point.
>>
>> Thanks
>> Gualberto
>>
>> > Date: Tue, 7 Aug 2012 11:44:09 -0600
>> > Subject: Re: [ncl-talk] I mean regridding the data to a rectiliniear lat / lon grid
>> > From:dave.allured@noaa.gov
>> <mailto:dave.allured@noaa.gov>
>> > To:betoic@hotmail.com <mailto:betoic@hotmail.com>
>> > CC:ncl-talk@ucar.edu <mailto:ncl-talk@ucar.edu>
>> >
>> > Here is one way. I am sure there are others.
>> >
>> > 1. Use NCL to make a text file containing a 1-dimensional ordered
>> > list of all X/Y coordinate pairs.
>> >
>> > 2. Use MPS Geotrans in batch mode to translate the list of
>> > coordinates from Lambert Conformal to terrestrial lat/lon. It's free
>> > software, and it supports a huge variety of known terrestrial
>> > coordinate systems.
>> >
>> >http://earth-info.nga.mil/GandG/geotrans/
>> >
>> > 3. Use NCL to read in the translated coordinates, and reshape them
>> > into 2-D lat and lon coordinate arrays.
>> >
>> > 4. Use one of the many NCL regridding functions, plus the 2-D
>> > coordinates from step 3, to regrid the data array to a rectilinear
>> > grid of your choice.
>> >
>> > This is an overview. Steps 1 and 3 are fairly straightforward NCL
>> > coding. Steps 2 and 4 will involve significant study to get them
>> > working correctly. HTH.
>> >
>> > --Dave
>> >
>> > On Tue, Aug 7, 2012 at 10:54 AM, Gualberto Hern�ndez Ju�rez
>> > <betoic@hotmail.com
>> <mailto:betoic@hotmail.com>> wrote:
>> > > I need *regrid* the 2D lat/lon to a rectilinear lat lon.
>> > >
>> > > any comments will be grateful enough support, I'm new to NCL.
>> > >
>> > > Thank you,
>> > > Gualberto
>> > >
>> > >
>> > >> Date: Tue, 7 Aug 2012 10:41:42 -0600
>> > >> From:shea@ucar.edu <mailto:shea@ucar.edu>
>> > >> To:betoic@hotmail.com <mailto:betoic@hotmail.com>
>> > >> CC:ncl-talk@ucar.edu <mailto:ncl-talk@ucar.edu>
>> > >> Subject: Re: [ncl-talk] I mean regridding the data to a rectiliniear lat /
>> > >> lon grid
>> > >>
>> > >> Technically, this is already a rectilinear grid.
>> > >>
>> > >> double lat ( lat )
>> > >> _CoordinateAxisType : GeoY
>> > >> axis : Y
>> > >> grid_spacing : 27.0 km
>> > >> long_name : y coordinate of projection
>> > >> standard_name : projection_y_coordinate
>> > >> units : km
>> > >>
>> > >> double lon ( lon )
>> > >> _CoordinateAxisType : GeoX
>> > >> axis : X
>> > >> grid_spacing : 27.0 km
>> > >> long_name : x coordinate of projection
>> > >> standard_name : projection_x_coordinate
>> > >> units : km
>> > >>
>> > >> float u10 ( time, lat, lon )
>> > >> long_name : 10 m u wind (m/sec)
>> > >> _FillValue : -9999
>> > >> grid_mapping : Lambert_Conformal
>> > >>
>> > >> The issue is that the poorly named 'lat' and 'lon' variables
>> > >> should be (say) 'y' and 'x'.
>> > >>
>> > >> Basically, the projection information
>> > >>
>> > >> character Lambert_Conformal ( ncl_scalar )
>> > >> grid_mapping_name : lambert_conformal_conic
>> > >> long_name :
>> > >> latitude_of_projection_origin : 0
>> > >> longitude_of_central_meridian : -124.17
>> > >> false_easting : 0
>> > >> false_northing : -27
>> > >> standard_parallel : 0
>> > >> _CoordinateTransformType : Projection
>> > >> _CoordinateAxisTypes : GeoX GeoY
>> > >> earth_shape : Earth spherical with radius of 6,371,229.0 m
>> > >> earth_radius : 6371229
>> > >>
>> > >> must be used to generate two-dimensional latitude and longitude
>> > >> coordinates for each grid point. Then the data can be plotted on the
>> > >> lambert map projection. Is this what you want?
>> > >>
>> > >> *** I have no idea how to do this. Maybe someone else does. ***
>> > >>
>> > >> Then, if you really want to *regrid* the 2D lat/lon to a rectilinear
>> > >> lat lon, you would have to use the ESMF regridding
>> > >>http://www.ncl.ucar.edu/Applications/ESMF.shtml
>> > >>
>> > >>
>> > >> On 8/7/12 10:12 AM, Gualberto Hern�ndez Ju�rez wrote:
>> > >> > Hi,
>> > >> >
>> > >> > I mean regridding the data to a rectiliniear lat / lon grid
>> > >> >
>> > >> > locate the file in the directory:
>> > >> >
>> > >> >ftp://ftp.cgd.ucar.edu/incoming/
>> > >> >
>> > >> > or you can download from this link:
>> > >> >
>> > >> >https://dl.dropbox.com/u/96409134/MMOUT_DOMAIN1.nc
>> > >> >
>> > >> > Thanks I'll be awaiting your response.
>> > >> > Gualberto
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options,
>> unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options,
>> unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>>
>>
>> <Huracan
>> Bud.jpg>_______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>> <PresionSNivelMar23-05-2012_4-00pm.jpg>_______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> --
> Ping Yang, Ph.D.
> CUNY Environmental Crossroads Initiative
> Marshak Science Building - Suite 925
> The City College of New York - CUNY
> 160 Convent Avenue, New York NY 10031
> Phone: 212-650-5769
> Fax: 212-650-7064
>
>
> <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Oct 19 07:20:45 2012

This archive was generated by hypermail 2.1.8 : Tue Oct 23 2012 - 11:10:04 MDT