Re: crop region

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Wed Aug 08 2012 - 18:06:35 MDT

Since the data longitude coordinates go from 0 to 359.5 there is no seam at 180. Therefore you do not need to use lonFilp. All you need to do is express the negative longitude as a positive value by adding 360 to it. (-160 + 360 --> 200).
 -dave

On Aug 8, 2012, at 5:51 PM, Erika Folova wrote:

> Hi Dave,
> Thanks for the response here is my script:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> ;************************************************
> ; MAIN
> ;************************************************
> begin
>
> f = addfile("test.nc","r")
> U = f->UGRD_P0_L100_GLL0(:,:)
> V = f->VGRD_P0_L100_GLL0(:,:)
> A = f->ABSV_P0_L100_GLL0(:,:)
> A = A*100000
>
> U = lonFlip( U )
> V = lonFlip( V )
> A = lonFlip( A )
>
> latS = -30.
> latN = 30.
> lonL = 100.
> lonR = -160.
> ;************************************************
> ; plotting parameters
> ;************************************************
> wks = gsn_open_wks("pdf","vectornew") ; open workstation
> gsn_define_colormap(wks,"testcmap") ; choose colormap
> ;gsn_define_colormap(wks,"BlAqGrYeOrReVi200")
>
> res = True ; plot mods desired
> res@mpFillOn = False ; turn off map fill
> res@mpMinLatF = latS ; zoom in on map
> res@mpMaxLatF = latN
> res@mpMinLonF = lonL
> res@mpMaxLonF = lonR
>
> [SNIP]
>
> plot=gsn_csm_vector_scalar_map(wks,U({latS:latN},{lonL:lonR}),V({latS:latN},{lonL:lonR}),A({latS:latN},{lonL:lonR}),res)
> end
>
> I got this error:
> (0) gsn_csm_map_ce: Fatal: The resources mpMinLonF/mpLeftCornerLonF must be less than the resources mpMaxLonF/mpRightCornerLonF.
> (0) Execution halted.
>
> I understand why did the error appear. However if I set:
> latS = -30.
> latN = 30.
> lonL = -160.
> lonR = 100.
>
> This is not the region that i want!
> Details of my data:
>
>
> Variable: A
> Type: float
> Total Size: 1039680 bytes
> 259920 values
> Number of Dimensions: 2
> Dimensions and sizes: [lat_0 | 361] x [lon_0 | 720]
> Coordinates:
> lat_0: [90..-90]
> lon_0: [ 0..359.5]
> Number Of Attributes: 13
> initial_time : 08/08/2012 (12:00)
> forecast_time_units : hours
> forecast_time : 0
> level : 85000
> level_type : Isobaric surface (Pa)
> parameter_template_discipline_category_number : ( 0, 0, 2, 10 )
> parameter_discipline_and_category : Meteorological products, Momentum
> grid_type : Latitude/longitude
> _FillValue : 1e+20
> units : s-1
> long_name : Absolute vorticity
> production_status : Operational products
> center : US National Weather Service - NCEP (WMC)
>
> Variable: U
> Type: float
> Total Size: 1039680 bytes
> 259920 values
> Number of Dimensions: 2
> Dimensions and sizes: [lat_0 | 361] x [lon_0 | 720]
> Coordinates:
> lat_0: [90..-90]
> lon_0: [ 0..359.5]
> Number Of Attributes: 13
> initial_time : 08/08/2012 (12:00)
> forecast_time_units : hours
> forecast_time : 0
> level : 85000
> level_type : Isobaric surface (Pa)
> parameter_template_discipline_category_number : ( 0, 0, 2, 2 )
> parameter_discipline_and_category : Meteorological products, Momentum
> grid_type : Latitude/longitude
> _FillValue : 1e+20
> units : m s-1
> long_name : U-component of wind
> production_status : Operational products
> center : US National Weather Service - NCEP (WMC)
>
> Variable: V
> Type: float
> Total Size: 1039680 bytes
> 259920 values
> Number of Dimensions: 2
> Dimensions and sizes: [lat_0 | 361] x [lon_0 | 720]
> Coordinates:
> lat_0: [90..-90]
> lon_0: [ 0..359.5]
> Number Of Attributes: 13
> initial_time : 08/08/2012 (12:00)
> forecast_time_units : hours
> forecast_time : 0
> level : 85000
> level_type : Isobaric surface (Pa)
> parameter_template_discipline_category_number : ( 0, 0, 2, 3 )
> parameter_discipline_and_category : Meteorological products, Momentum
> grid_type : Latitude/longitude
> _FillValue : 1e+20
> units : m s-1
> long_name : V-component of wind
> production_status : Operational products
> center : US National Weather Service - NCEP (WMC)
>
>
> Thanks a lot.
>
>
>
> On Thu, Aug 9, 2012 at 1:33 AM, David Brown <dbrown@ucar.edu> wrote:
> Hi Erika,
> It would help if we could see the code where you tried to use lonFlip.
> -dave
>
>
> On Aug 8, 2012, at 5:13 PM, Erika Folova wrote:
>
> > HI All,
> > Anyone here has a trick how to crop the region which is located between E and W longitude e.g:
> > West Pacific regions 110E - 150 W and 30 S- 30 N. I took a shoot using longitudes span command "lonflip" but it didn't work correctly.
> >
> > Thanks for any sight.
> > Erika
> > _______________________________________________
> > 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
Received on Wed Aug 8 18:06:42 2012

This archive was generated by hypermail 2.1.8 : Wed Aug 15 2012 - 08:12:08 MDT