From matthew.fearon.ctr at nrlmry.navy.mil Wed Jun 20 14:14:18 2018 From: matthew.fearon.ctr at nrlmry.navy.mil (Fearon, Dr. Matthew, Contractor, Code 7533) Date: Wed, 20 Jun 2018 20:14:18 +0000 Subject: [pyngl-talk] mapping regional data with mpLimitMode corners Message-ID: <85f4dc9f9f074921b3f1fb0a809fac01@ZEUS-2.nrlmry.navy.mil> Hello, I'm using the following Ngl resources to map regional raster data with a stereographic projection onto a basemap. Things work fairly well, except I am able to see edges of the underlying basemap. Please see figure one attached. When I include mpCenterRotF= -1, the basemap edge visibility is reduced, but still partially shown along the NW and SE edges. Please see figure two. I would like the data overlay to fill the window fully. I've tried adjusting the lat corners by 0.5 to 1 degree, eg, mpRightCornerLatF = lat[ny-1,nx-1]-0.5 and mpLeftCornerLatF = lat[0,0]+0.5, to figure two but doing so seems to reveal the underlying basemap more - perhaps because rotation of -1 is active after I contract my lat corners. Seems like this should be a simple fix, but here I struggle. Perhaps I should be mapping regional data differently? Any help or suggestions would be greatly appreciated. Thank you, Matt cnres.sfXArray = lon cnres.sfYArray = lat mpres.mpFillOn = True mpres.mpLandFillColor = "Tan1" mpres.mpOceanFillColor = "SkyBlue" mpres.mpInlandWaterFillColor = "SkyBlue" mpres.mpGeophysicalLineThicknessF= 2.5 mpres.mpLimitMode = "Corners" #"LatLon" mpres.mpProjection = "Stereographic" mpres.mpLeftCornerLatF = lat[0,0] mpres.mpLeftCornerLonF = lon[0,0] mpres.mpRightCornerLatF = lat[ny-1,nx-1] mpres.mpRightCornerLonF = lon[ny-1,nx-1] # mpres.mpCenterRotF = -1 mpres.mpRelativeCenterLon = True mpres.mpCenterLonF = 358. mpres.mpRelativeCenterLat = True mpres.mpCenterLatF = 80. mpres.tfDoNDCOverlay = "DataTransform" #NDCViewport" mpres.mpGridLineThicknessF = 0.5 mpres.mpGridLineDashPattern = 2 mpres.mpGridSpacingF = 1 mpres.mpDataBaseVersion = "MediumRes" map_plot = Ngl.map(wks,mpres) cnres.cnFillOn = True cnres.cnLinesOn = False cnres.cnLineLabelsOn = False cmap = Ngl.read_colormap_file("MPL_PuOr") cnres.cnFillPalette = cmap[::-1,:] cnres.cnLevelSelectionMode = "ExplicitLevels" cnres.cnLevels = [-10,-8,-6,-4,-2,2,4,6,8,10] cnres.lbAutoManage = False cnres.pmLabelBarWidthF = 0.02 cnres.lbLabelFontHeightF = 0.009 contour_plot = Ngl.contour(wks,cvar,cnres) Ngl.overlay(map_plot,contour_plot) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: figure1.png Type: image/png Size: 236234 bytes Desc: figure1.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: figure2.png Type: image/png Size: 233915 bytes Desc: figure2.png URL: From haley at ucar.edu Mon Jun 25 12:05:17 2018 From: haley at ucar.edu (Mary Haley) Date: Mon, 25 Jun 2018 12:05:17 -0600 Subject: [pyngl-talk] mapping regional data with mpLimitMode corners In-Reply-To: <85f4dc9f9f074921b3f1fb0a809fac01@ZEUS-2.nrlmry.navy.mil> References: <85f4dc9f9f074921b3f1fb0a809fac01@ZEUS-2.nrlmry.navy.mil> Message-ID: Hi Matt, Sorry for the delay. I was creating a new NCL example to help explain things. Plotting data in its native projection can be tricky, especially if you have a rotated pole or if you are not sure of the exact parameters for the map projection. I think you already know this, but these resources are going to be critical to getting the map projection correct: mpres.mpProjection = "Stereographic" mpres.mpLeftCornerLatF = lat[0,0] mpres.mpLeftCornerLonF = lon[0,0] mpres.mpRightCornerLatF = lat[ny-1,nx-1] mpres.mpRightCornerLonF = lon[ny-1,nx-1] # mpres.mpCenterRotF = -1 mpres.mpRelativeCenterLon = True mpres.mpCenterLonF = 358. mpres.mpRelativeCenterLat = True mpres.mpCenterLatF = 80. It's likely going to be the center lat/lon settings that are the issue, and not the four corners of your data, since the way you are setting the corners looks correct to me. Did the data come from a file that had the map projection parameters defined? If so, could you include the output from an ncdump -h of that file so I can see if there's anything that might have been left out? I don't know if you saw these examples, but they might help (even though they are NCL-based, the same principles apply): http://www.ncl.ucar.edu/Applications/native.shtml#ex1 http://www.ncl.ucar.edu/Applications/native.shtml#ex6 Example native_6.ncl is the one I just created. This was an example where we didn't know the correct center longitude, so I had to create a do loop to try different ones out. I also drew the lat/lon lines associated with the data (since I had them), so I could see if they were straight or not. If the lines are straight, then this is a good sign that you have the correct map projection resources set. Since you have the lat/lon arrays, you can also add the grid for debugging purposes. You can use Ngl.add_polyline for this. I've attached an example of adding lat/lon grid lines using dummy data. Hope this helps, --Mary On Wed, Jun 20, 2018 at 2:14 PM, Fearon, Dr. Matthew, Contractor, Code 7533 via pyngl-talk wrote: > Hello, > > > > I?m using the following Ngl resources to map regional raster data with a > stereographic projection onto a basemap. Things work fairly well, except I > am able to see edges of the underlying basemap. Please see figure one > attached. When I include mpCenterRotF= -1, the basemap edge visibility is > reduced, but still partially shown along the NW and SE edges. Please see > figure two. I would like the data overlay to fill the window fully. I?ve > tried adjusting the lat corners by 0.5 to 1 degree, eg, mpRightCornerLatF = > lat[ny-1,nx-1]-0.5 and mpLeftCornerLatF = lat[0,0]+0.5, to figure two but > doing so seems to reveal the underlying basemap more ? perhaps because > rotation of -1 is active after I contract my lat corners. Seems like this > should be a simple fix, but here I struggle. Perhaps I should be mapping > regional data differently? Any help or suggestions would be greatly > appreciated. > > > > Thank you, > > Matt > > > > > > cnres.sfXArray = lon > > cnres.sfYArray = lat > > > > mpres.mpFillOn = True > > mpres.mpLandFillColor = "Tan1" > > mpres.mpOceanFillColor = "SkyBlue" > > mpres.mpInlandWaterFillColor = "SkyBlue" > > mpres.mpGeophysicalLineThicknessF= 2.5 > > mpres.mpLimitMode = "Corners" #"LatLon" > > > > mpres.mpProjection = "Stereographic" > > mpres.mpLeftCornerLatF = lat[0,0] > > mpres.mpLeftCornerLonF = lon[0,0] > > mpres.mpRightCornerLatF = lat[ny-1,nx-1] > > mpres.mpRightCornerLonF = lon[ny-1,nx-1] > > > > # mpres.mpCenterRotF = -1 > > mpres.mpRelativeCenterLon = True > > mpres.mpCenterLonF = 358. > > mpres.mpRelativeCenterLat = True > > mpres.mpCenterLatF = 80. > > mpres.tfDoNDCOverlay = "DataTransform" #NDCViewport" > > > > mpres.mpGridLineThicknessF = 0.5 > > mpres.mpGridLineDashPattern = 2 > > mpres.mpGridSpacingF = 1 > > > > mpres.mpDataBaseVersion = "MediumRes" > > map_plot = Ngl.map(wks,mpres) > > > > cnres.cnFillOn = True > > cnres.cnLinesOn = False > > cnres.cnLineLabelsOn = False > > cmap = Ngl.read_colormap_file("MPL_PuOr") > > cnres.cnFillPalette = cmap[::-1,:] > > cnres.cnLevelSelectionMode = "ExplicitLevels" > > cnres.cnLevels = [-10,-8,-6,-4,-2,2,4,6,8,10] > > > > cnres.lbAutoManage = False > > cnres.pmLabelBarWidthF = 0.02 > > cnres.lbLabelFontHeightF = 0.009 > > contour_plot = Ngl.contour(wks,cvar,cnres) > > > > Ngl.overlay(map_plot,contour_plot) > > _______________________________________________ > pyngl-talk mailing list > List instructions, subscriber options, unsubscribe: > http://mailman.ucar.edu/mailman/listinfo/pyngl-talk > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: latlon_grid.py Type: text/x-python-script Size: 2811 bytes Desc: not available URL: From matthew.fearon.ctr at nrlmry.navy.mil Mon Jun 25 17:58:19 2018 From: matthew.fearon.ctr at nrlmry.navy.mil (Fearon, Dr. Matthew, Contractor, Code 7533) Date: Mon, 25 Jun 2018 23:58:19 +0000 Subject: [pyngl-talk] mapping regional data with mpLimitMode corners In-Reply-To: References: <85f4dc9f9f074921b3f1fb0a809fac01@ZEUS-2.nrlmry.navy.mil> Message-ID: <0a517b9512aa40a9b967370ff85256c9@ZEUS-2.nrlmry.navy.mil> Thanks for your reply and examples, Mary. I will look at them more closely, especially the your LatLon.py script. I have seen the stereographic NCL examples. The data I am plotting are based on a regional grid for the COAMPS model over the Arctic. I tried to use all the map projection attributes in my script, including the center lat/lon. I will double check the values and report back. Matt From: Mary Haley [mailto:haley at ucar.edu] Sent: Monday, June 25, 2018 11:05 AM To: Fearon, Dr. Matthew, Contractor, Code 7533 Cc: pyngl-talk at ucar.edu Subject: Re: [pyngl-talk] mapping regional data with mpLimitMode corners Hi Matt, Sorry for the delay. I was creating a new NCL example to help explain things. Plotting data in its native projection can be tricky, especially if you have a rotated pole or if you are not sure of the exact parameters for the map projection. I think you already know this, but these resources are going to be critical to getting the map projection correct: mpres.mpProjection = "Stereographic" mpres.mpLeftCornerLatF = lat[0,0] mpres.mpLeftCornerLonF = lon[0,0] mpres.mpRightCornerLatF = lat[ny-1,nx-1] mpres.mpRightCornerLonF = lon[ny-1,nx-1] # mpres.mpCenterRotF = -1 mpres.mpRelativeCenterLon = True mpres.mpCenterLonF = 358. mpres.mpRelativeCenterLat = True mpres.mpCenterLatF = 80. It's likely going to be the center lat/lon settings that are the issue, and not the four corners of your data, since the way you are setting the corners looks correct to me. Did the data come from a file that had the map projection parameters defined? If so, could you include the output from an ncdump -h of that file so I can see if there's anything that might have been left out? I don't know if you saw these examples, but they might help (even though they are NCL-based, the same principles apply): http://www.ncl.ucar.edu/Applications/native.shtml#ex1 http://www.ncl.ucar.edu/Applications/native.shtml#ex6 Example native_6.ncl is the one I just created. This was an example where we didn't know the correct center longitude, so I had to create a do loop to try different ones out. I also drew the lat/lon lines associated with the data (since I had them), so I could see if they were straight or not. If the lines are straight, then this is a good sign that you have the correct map projection resources set. Since you have the lat/lon arrays, you can also add the grid for debugging purposes. You can use Ngl.add_polyline for this. I've attached an example of adding lat/lon grid lines using dummy data. Hope this helps, --Mary On Wed, Jun 20, 2018 at 2:14 PM, Fearon, Dr. Matthew, Contractor, Code 7533 via pyngl-talk > wrote: Hello, I?m using the following Ngl resources to map regional raster data with a stereographic projection onto a basemap. Things work fairly well, except I am able to see edges of the underlying basemap. Please see figure one attached. When I include mpCenterRotF= -1, the basemap edge visibility is reduced, but still partially shown along the NW and SE edges. Please see figure two. I would like the data overlay to fill the window fully. I?ve tried adjusting the lat corners by 0.5 to 1 degree, eg, mpRightCornerLatF = lat[ny-1,nx-1]-0.5 and mpLeftCornerLatF = lat[0,0]+0.5, to figure two but doing so seems to reveal the underlying basemap more ? perhaps because rotation of -1 is active after I contract my lat corners. Seems like this should be a simple fix, but here I struggle. Perhaps I should be mapping regional data differently? Any help or suggestions would be greatly appreciated. Thank you, Matt cnres.sfXArray = lon cnres.sfYArray = lat mpres.mpFillOn = True mpres.mpLandFillColor = "Tan1" mpres.mpOceanFillColor = "SkyBlue" mpres.mpInlandWaterFillColor = "SkyBlue" mpres.mpGeophysicalLineThicknessF= 2.5 mpres.mpLimitMode = "Corners" #"LatLon" mpres.mpProjection = "Stereographic" mpres.mpLeftCornerLatF = lat[0,0] mpres.mpLeftCornerLonF = lon[0,0] mpres.mpRightCornerLatF = lat[ny-1,nx-1] mpres.mpRightCornerLonF = lon[ny-1,nx-1] # mpres.mpCenterRotF = -1 mpres.mpRelativeCenterLon = True mpres.mpCenterLonF = 358. mpres.mpRelativeCenterLat = True mpres.mpCenterLatF = 80. mpres.tfDoNDCOverlay = "DataTransform" #NDCViewport" mpres.mpGridLineThicknessF = 0.5 mpres.mpGridLineDashPattern = 2 mpres.mpGridSpacingF = 1 mpres.mpDataBaseVersion = "MediumRes" map_plot = Ngl.map(wks,mpres) cnres.cnFillOn = True cnres.cnLinesOn = False cnres.cnLineLabelsOn = False cmap = Ngl.read_colormap_file("MPL_PuOr") cnres.cnFillPalette = cmap[::-1,:] cnres.cnLevelSelectionMode = "ExplicitLevels" cnres.cnLevels = [-10,-8,-6,-4,-2,2,4,6,8,10] cnres.lbAutoManage = False cnres.pmLabelBarWidthF = 0.02 cnres.lbLabelFontHeightF = 0.009 contour_plot = Ngl.contour(wks,cvar,cnres) Ngl.overlay(map_plot,contour_plot) _______________________________________________ pyngl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/pyngl-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew.fearon.ctr at nrlmry.navy.mil Tue Jun 26 15:36:09 2018 From: matthew.fearon.ctr at nrlmry.navy.mil (Fearon, Dr. Matthew, Contractor, Code 7533) Date: Tue, 26 Jun 2018 21:36:09 +0000 Subject: [pyngl-talk] mapping regional data with mpLimitMode corners In-Reply-To: References: <85f4dc9f9f074921b3f1fb0a809fac01@ZEUS-2.nrlmry.navy.mil> Message-ID: <37aa5039d9954d0494f7e2b9ec056f28@ZEUS-2.nrlmry.navy.mil> Hi Mary, The combination below eliminated the map edge problems I was having when mapping the regional stereographic COAMPS grid. The mp resources used are analogous to your NCL native example 6. Originally, I had mpCenterLatF = 80. And although this is the center lat of the grid, the relativeCenterLat is 90 for the stereographic projection. I believe this is the correct logic. mpres.mpLimitMode = "Corners" mpres.mpProjection = "Stereographic" mpres.mpLeftCornerLatF = lat[0,0] mpres.mpLeftCornerLonF = lon[0,0] mpres.mpRightCornerLatF = lat[ny-1,nx-1] mpres.mpRightCornerLonF = lon[ny-1,nx-1] mpres.mpRelativeCenterLon = True mpres.mpCenterLonF = 358. mpres.mpRelativeCenterLat = True mpres.mpCenterLatF = 90. ### Original value of 80. mpres.tfDoNDCOverlay = "NDCViewport" Thank you, Matt From: Mary Haley [mailto:haley at ucar.edu] Sent: Monday, June 25, 2018 11:05 AM To: Fearon, Dr. Matthew, Contractor, Code 7533 Cc: pyngl-talk at ucar.edu Subject: Re: [pyngl-talk] mapping regional data with mpLimitMode corners Hi Matt, Sorry for the delay. I was creating a new NCL example to help explain things. Plotting data in its native projection can be tricky, especially if you have a rotated pole or if you are not sure of the exact parameters for the map projection. I think you already know this, but these resources are going to be critical to getting the map projection correct: mpres.mpProjection = "Stereographic" mpres.mpLeftCornerLatF = lat[0,0] mpres.mpLeftCornerLonF = lon[0,0] mpres.mpRightCornerLatF = lat[ny-1,nx-1] mpres.mpRightCornerLonF = lon[ny-1,nx-1] # mpres.mpCenterRotF = -1 mpres.mpRelativeCenterLon = True mpres.mpCenterLonF = 358. mpres.mpRelativeCenterLat = True mpres.mpCenterLatF = 80. It's likely going to be the center lat/lon settings that are the issue, and not the four corners of your data, since the way you are setting the corners looks correct to me. Did the data come from a file that had the map projection parameters defined? If so, could you include the output from an ncdump -h of that file so I can see if there's anything that might have been left out? I don't know if you saw these examples, but they might help (even though they are NCL-based, the same principles apply): http://www.ncl.ucar.edu/Applications/native.shtml#ex1 http://www.ncl.ucar.edu/Applications/native.shtml#ex6 Example native_6.ncl is the one I just created. This was an example where we didn't know the correct center longitude, so I had to create a do loop to try different ones out. I also drew the lat/lon lines associated with the data (since I had them), so I could see if they were straight or not. If the lines are straight, then this is a good sign that you have the correct map projection resources set. Since you have the lat/lon arrays, you can also add the grid for debugging purposes. You can use Ngl.add_polyline for this. I've attached an example of adding lat/lon grid lines using dummy data. Hope this helps, --Mary On Wed, Jun 20, 2018 at 2:14 PM, Fearon, Dr. Matthew, Contractor, Code 7533 via pyngl-talk > wrote: Hello, I?m using the following Ngl resources to map regional raster data with a stereographic projection onto a basemap. Things work fairly well, except I am able to see edges of the underlying basemap. Please see figure one attached. When I include mpCenterRotF= -1, the basemap edge visibility is reduced, but still partially shown along the NW and SE edges. Please see figure two. I would like the data overlay to fill the window fully. I?ve tried adjusting the lat corners by 0.5 to 1 degree, eg, mpRightCornerLatF = lat[ny-1,nx-1]-0.5 and mpLeftCornerLatF = lat[0,0]+0.5, to figure two but doing so seems to reveal the underlying basemap more ? perhaps because rotation of -1 is active after I contract my lat corners. Seems like this should be a simple fix, but here I struggle. Perhaps I should be mapping regional data differently? Any help or suggestions would be greatly appreciated. Thank you, Matt cnres.sfXArray = lon cnres.sfYArray = lat mpres.mpFillOn = True mpres.mpLandFillColor = "Tan1" mpres.mpOceanFillColor = "SkyBlue" mpres.mpInlandWaterFillColor = "SkyBlue" mpres.mpGeophysicalLineThicknessF= 2.5 mpres.mpLimitMode = "Corners" #"LatLon" mpres.mpProjection = "Stereographic" mpres.mpLeftCornerLatF = lat[0,0] mpres.mpLeftCornerLonF = lon[0,0] mpres.mpRightCornerLatF = lat[ny-1,nx-1] mpres.mpRightCornerLonF = lon[ny-1,nx-1] # mpres.mpCenterRotF = -1 mpres.mpRelativeCenterLon = True mpres.mpCenterLonF = 358. mpres.mpRelativeCenterLat = True mpres.mpCenterLatF = 80. mpres.tfDoNDCOverlay = "DataTransform" #NDCViewport" mpres.mpGridLineThicknessF = 0.5 mpres.mpGridLineDashPattern = 2 mpres.mpGridSpacingF = 1 mpres.mpDataBaseVersion = "MediumRes" map_plot = Ngl.map(wks,mpres) cnres.cnFillOn = True cnres.cnLinesOn = False cnres.cnLineLabelsOn = False cmap = Ngl.read_colormap_file("MPL_PuOr") cnres.cnFillPalette = cmap[::-1,:] cnres.cnLevelSelectionMode = "ExplicitLevels" cnres.cnLevels = [-10,-8,-6,-4,-2,2,4,6,8,10] cnres.lbAutoManage = False cnres.pmLabelBarWidthF = 0.02 cnres.lbLabelFontHeightF = 0.009 contour_plot = Ngl.contour(wks,cvar,cnres) Ngl.overlay(map_plot,contour_plot) _______________________________________________ pyngl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/pyngl-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew.fearon.ctr at nrlmry.navy.mil Tue Jun 26 15:47:14 2018 From: matthew.fearon.ctr at nrlmry.navy.mil (Fearon, Dr. Matthew, Contractor, Code 7533) Date: Tue, 26 Jun 2018 21:47:14 +0000 Subject: [pyngl-talk] esmf regridding with pyngl Message-ID: Hi, I was curious if the ESMF regridding routines may be available as part of PyNGL in the future? I see there is a current ESMF module for Python, however, the availability of the NCL-ESMF interface style in the Python environment would be outstanding. Just curious if there are plans for this or if it already exists? Thanks, Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: From haley at ucar.edu Tue Jun 26 20:26:34 2018 From: haley at ucar.edu (Mary Haley) Date: Tue, 26 Jun 2018 20:26:34 -0600 Subject: [pyngl-talk] esmf regridding with pyngl In-Reply-To: References: Message-ID: Hi Matt, We don't have the NCL-ESMF regridding interface in NCL. As you pointed out, the ESMF folks have created a Python interface called ESMPy. I did look around for some documentation, but didn't find anything like what we have on the NCL website. Here's what I did find: http://www.earthsystemmodeling.org/esmf_releases/public/last/esmpy_doc/html/examples.html The developer of a package called xESMF wrote to me awhile back and pointed out an interface he had created on top of ESMPy. xESMF is supposed to be easier to use as it hides some of ESMPy's complicated infrastructure. See: https://xesmf.readthedocs.io/en/latest/ On the left are a list of some tutorials including an ESMPy tutorial: https://github.com/nawendt/esmpy-tutorial xESMF uses sparse matrix multiply just like the NCL-ESMF package, which can make it faster if you already have the weights file. Good luck, --Mary On Tue, Jun 26, 2018 at 3:47 PM, Fearon, Dr. Matthew, Contractor, Code 7533 via pyngl-talk wrote: > Hi, > > > > I was curious if the ESMF regridding routines may be available as part of > PyNGL in the future? I see there is a current ESMF module for Python, > however, the availability of the NCL-ESMF interface style in the Python > environment would be outstanding. Just curious if there are plans for this > or if it already exists? > > > > Thanks, > > Matt > > > > _______________________________________________ > pyngl-talk mailing list > List instructions, subscriber options, unsubscribe: > http://mailman.ucar.edu/mailman/listinfo/pyngl-talk > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthew.fearon.ctr at nrlmry.navy.mil Thu Jun 28 11:37:50 2018 From: matthew.fearon.ctr at nrlmry.navy.mil (Fearon, Dr. Matthew, Contractor, Code 7533) Date: Thu, 28 Jun 2018 17:37:50 +0000 Subject: [pyngl-talk] Ngl wrf_ll_to_ij Message-ID: <4a26459981474bf49c11cf7eae87d369@ZEUS-2.nrlmry.navy.mil> Hello, Trying to use wrf_ll_to_ij in Python with Ngl. Not sure of the syntax and getting "argument parsing failed". Here's my attempt. Any help is much appreciated. Thanks, Matt res = 18000 opt = Ngl.Resources() opt.MAP_PROJ = 2 #[1=Lambert, 2=polar stereographic, 3=mercator, 6=lat-lon] (required) opt.TRUELAT1 = 90 #60 #required for MAP_PROJ = 1, 2, 3 (defaults to 0 otherwise) #opt.TRUELAT2 = 80 #required for MAP_PROJ = 6 (defaults to 0 otherwise) opt.STAND_LON = -2 #Standard longitude used in model projection (required) opt.REF_LON = -2 #A reference longitude and latitude (required) opt.REF_LAT = 80 opt.KNOWNI = 130 #The I and J locations of REF_LON, EF_LAT (required), Python index starts at zero opt.KNOWNJ = 134 opt.POLE_LAT = 90 #optional for MAP_PROJ = 6 (defaults to 90 otherwise) opt.POLE_LON = -2 #optional for MAP_PROJ = 6 (defaults to 0 otherwise) opt.DX = res #required for MAP_PROJ = 1, 2, 3 (defaults to 0 otherwise) opt.DY = res loc = Ngl.wrf_ll_to_ij(-2,60,opt) print loc -------------- next part -------------- An HTML attachment was scrubbed... URL: From ladwig at ucar.edu Thu Jun 28 12:03:21 2018 From: ladwig at ucar.edu (Bill Ladwig) Date: Thu, 28 Jun 2018 12:03:21 -0600 Subject: [pyngl-talk] Ngl wrf_ll_to_ij In-Reply-To: <4a26459981474bf49c11cf7eae87d369@ZEUS-2.nrlmry.navy.mil> References: <4a26459981474bf49c11cf7eae87d369@ZEUS-2.nrlmry.navy.mil> Message-ID: The WRF features in PyNGL were never officially released and are now deprecated. Please use wrf-python instead: http://wrf-python.readthedocs.io/en/latest/user_api/generated/wrf.ll_to_xy_proj.html#wrf.ll_to_xy_proj If it throws number conversion errors at you, you'll need to supply numerical arguments for all of the projection parameters (even if they aren't used). This will be fixed in an upcoming release. Regards, Bill On Thu, Jun 28, 2018 at 11:37 AM, Fearon, Dr. Matthew, Contractor, Code 7533 via pyngl-talk wrote: > Hello, > > > > Trying to use wrf_ll_to_ij in Python with Ngl. Not sure of the syntax and > getting ?argument parsing failed?. Here?s my attempt. Any help is much > appreciated. > > Thanks, > > Matt > > > > > > res = 18000 > > opt = Ngl.Resources() > > > > opt.MAP_PROJ = 2 #[1=Lambert, 2=polar stereographic, 3=mercator, > 6=lat-lon] (required) > > opt.TRUELAT1 = 90 #60 #required for MAP_PROJ = 1, 2, 3 (defaults to > 0 otherwise) > > #opt.TRUELAT2 = 80 #required for MAP_PROJ = 6 (defaults to 0 > otherwise) > > opt.STAND_LON = -2 #Standard longitude used in model projection > (required) > > opt.REF_LON = -2 #A reference longitude and latitude (required) > > opt.REF_LAT = 80 > > opt.KNOWNI = 130 #The I and J locations of REF_LON, EF_LAT > (required), Python index starts at zero > > opt.KNOWNJ = 134 > > opt.POLE_LAT = 90 #optional for MAP_PROJ = 6 (defaults to 90 > otherwise) > > opt.POLE_LON = -2 #optional for MAP_PROJ = 6 (defaults to 0 > otherwise) > > opt.DX = res #required for MAP_PROJ = 1, 2, 3 (defaults to 0 > otherwise) > > opt.DY = res > > > > > > loc = Ngl.wrf_ll_to_ij(-2,60,opt) > > print loc > > > > _______________________________________________ > pyngl-talk mailing list > List instructions, subscriber options, unsubscribe: > http://mailman.ucar.edu/mailman/listinfo/pyngl-talk > > -------------- next part -------------- An HTML attachment was scrubbed... URL: