From andrew.kren at noaa.gov Fri Feb 16 20:36:28 2024 From: andrew.kren at noaa.gov (Andrew Kren - NOAA Federal) Date: Fri, 16 Feb 2024 22:36:28 -0500 Subject: [ncl-talk] Issue plotting map when using a topo image Message-ID: Hi there, Sorry to bother. I overlaid a topo image before plotting contours of radar data. I followed several of the examples on the topo page. I was able to get most of it working, but for some reason the image comes out on a different orientation and the composited images are put on differently too, while the labelbar is cut off the image. Is there a reason this would be the case? Below shows what it looked like after using a topo image: -- Andrew Kren Meteorologist NOAA's National Weather Service Raleigh Forecast Office 1005 Capability Drive, Suite 300 Raleigh, North Carolina 27606 voice: 919-326-1035 mailto: andrew.kren at noaa.govhttp://www.weather.gov/rah -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: MRS_RG_CRADAR_F000.png Type: image/png Size: 1151665 bytes Desc: not available URL: From andrew.kren at noaa.gov Mon Feb 19 15:01:06 2024 From: andrew.kren at noaa.gov (Andrew Kren - NOAA Federal) Date: Mon, 19 Feb 2024 17:01:06 -0500 Subject: [ncl-talk] Question regarding plot going beyond the plot page Message-ID: Hi all, I sent a help request a few days ago. I am plotting a terrain map via a netcdf file and am overlaying reflectivity data. I am able to get this nearly 100% right. However, when I set gsnMaximize to True and gsnPaperOrientation to Portrait, the plot shows up in the vertical and the label bar and other text below the image is not shown or cut off (see example in the email). Does anyone know what could be causing this? When I did not have the terrain file, it plotted just fine within the pane. I have gone back and forth with/without maximizing and between portrait and landscape, and it was not working. Thanks much! [image: MRS_RG_CRADAR_F000.png] -- Andrew Kren Meteorologist NOAA's National Weather Service Raleigh Forecast Office 1005 Capability Drive, Suite 300 Raleigh, North Carolina 27606 voice: 919-326-1035 mailto: andrew.kren at noaa.govhttp://www.weather.gov/rah -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: MRS_RG_CRADAR_F000.png Type: image/png Size: 941173 bytes Desc: not available URL: From dave.allured at noaa.gov Tue Feb 20 10:12:43 2024 From: dave.allured at noaa.gov (Dave Allured - NOAA Affiliate) Date: Tue, 20 Feb 2024 10:12:43 -0700 Subject: [ncl-talk] Question regarding plot going beyond the plot page In-Reply-To: References: Message-ID: Andrew, can you get a 100% correct plot with terrain and reflectivity, when gsnMaximize and gsnPaperOrientation are omitted? If so, then I suggest this workaround. Generate the correct plot that way. For good resolution, generate as PDF or postscript, not jpeg or png. Then use external utilities to crop, rotate, and resize, as needed. To debug the other NCL functionality could be difficult. On Mon, Feb 19, 2024 at 3:02?PM Andrew Kren - NOAA Federal via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hi all, > > I sent a help request a few days ago. I am plotting a terrain map via a > netcdf file and am overlaying reflectivity data. I am able to get this > nearly 100% right. However, when I set gsnMaximize to True and > gsnPaperOrientation to Portrait, the plot shows up in the vertical and the > label bar and other text below the image is not shown or cut off (see > example in the email). Does anyone know what could be causing this? When I > did not have the terrain file, it plotted just fine within the pane. I have > gone back and forth with/without maximizing and between portrait and > landscape, and it was not working. > > Thanks much! > > [image: MRS_RG_CRADAR_F000.png] > > -- > > Andrew Kren > Meteorologist > NOAA's National Weather Service > Raleigh Forecast Office > 1005 Capability Drive, Suite 300 > Raleigh, North Carolina 27606 > voice: 919-326-1035 > mailto: andrew.kren at noaa.govhttp://www.weather.gov/rah > > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: MRS_RG_CRADAR_F000.png Type: image/png Size: 941173 bytes Desc: not available URL: From andrew.kren at noaa.gov Tue Feb 20 10:14:11 2024 From: andrew.kren at noaa.gov (Andrew Kren - NOAA Federal) Date: Tue, 20 Feb 2024 12:14:11 -0500 Subject: [ncl-talk] Question regarding plot going beyond the plot page In-Reply-To: References: Message-ID: I was able to figure it out Dave. I used the vP settings to adjust the page. And yes I always start out with eps and then use crop, etc. to convert to png. On Tue, Feb 20, 2024 at 12:13?PM Dave Allured - NOAA Affiliate < dave.allured at noaa.gov> wrote: > Andrew, can you get a 100% correct plot with terrain and reflectivity, > when gsnMaximize and gsnPaperOrientation are omitted? If so, then I > suggest this workaround. Generate the correct plot that way. For good > resolution, generate as PDF or postscript, not jpeg or png. Then use > external utilities to crop, rotate, and resize, as needed. To debug the > other NCL functionality could be difficult. > > > On Mon, Feb 19, 2024 at 3:02?PM Andrew Kren - NOAA Federal via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> Hi all, >> >> I sent a help request a few days ago. I am plotting a terrain map via a >> netcdf file and am overlaying reflectivity data. I am able to get this >> nearly 100% right. However, when I set gsnMaximize to True and >> gsnPaperOrientation to Portrait, the plot shows up in the vertical and the >> label bar and other text below the image is not shown or cut off (see >> example in the email). Does anyone know what could be causing this? When I >> did not have the terrain file, it plotted just fine within the pane. I have >> gone back and forth with/without maximizing and between portrait and >> landscape, and it was not working. >> >> Thanks much! >> >> [image: MRS_RG_CRADAR_F000.png] >> >> -- >> >> Andrew Kren >> Meteorologist >> NOAA's National Weather Service >> Raleigh Forecast Office >> 1005 Capability Drive, Suite 300 >> Raleigh, North Carolina 27606 >> voice: 919-326-1035 >> mailto: andrew.kren at noaa.govhttp://www.weather.gov/rah >> >> _______________________________________________ >> ncl-talk mailing list >> ncl-talk at mailman.ucar.edu >> List instructions, subscriber options, unsubscribe: >> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >> > -- Andrew Kren Meteorologist NOAA's National Weather Service Raleigh Forecast Office 1005 Capability Drive, Suite 300 Raleigh, North Carolina 27606 voice: 919-326-1035 mailto: andrew.kren at noaa.govhttp://www.weather.gov/rah -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: MRS_RG_CRADAR_F000.png Type: image/png Size: 941173 bytes Desc: not available URL: From dave.allured at noaa.gov Tue Feb 20 10:26:23 2024 From: dave.allured at noaa.gov (Dave Allured - NOAA Affiliate) Date: Tue, 20 Feb 2024 10:26:23 -0700 Subject: [ncl-talk] Question regarding plot going beyond the plot page In-Reply-To: References: Message-ID: Andrew, that's great. Thanks for your follow-up, this may help others who are looking for a similar solution. As a side note, here is unsolicited advice. I recommend retaining PDF or PS/EPS through all processing stages, and PDF only for final output. PNG, JPEG, and other raster formats easily become grainy or pixellated on magnification. PDF is a vector format that retains near-infinite resolution on magnification. PDF is rendered nicely by all modern browsers. Also it looks great in publications and on posters. On Tue, Feb 20, 2024 at 10:15?AM Andrew Kren - NOAA Federal < andrew.kren at noaa.gov> wrote: > I was able to figure it out Dave. I used the vP settings to adjust the > page. And yes I always start out with eps and then use crop, etc. to > convert to png. > > On Tue, Feb 20, 2024 at 12:13?PM Dave Allured - NOAA Affiliate < > dave.allured at noaa.gov> wrote: > >> Andrew, can you get a 100% correct plot with terrain and reflectivity, >> when gsnMaximize and gsnPaperOrientation are omitted? If so, then I >> suggest this workaround. Generate the correct plot that way. For good >> resolution, generate as PDF or postscript, not jpeg or png. Then use >> external utilities to crop, rotate, and resize, as needed. To debug the >> other NCL functionality could be difficult. >> >> >> On Mon, Feb 19, 2024 at 3:02?PM Andrew Kren - NOAA Federal via ncl-talk < >> ncl-talk at mailman.ucar.edu> wrote: >> >>> Hi all, >>> >>> I sent a help request a few days ago. I am plotting a terrain map via a >>> netcdf file and am overlaying reflectivity data. I am able to get this >>> nearly 100% right. However, when I set gsnMaximize to True and >>> gsnPaperOrientation to Portrait, the plot shows up in the vertical and the >>> label bar and other text below the image is not shown or cut off (see >>> example in the email). Does anyone know what could be causing this? When I >>> did not have the terrain file, it plotted just fine within the pane. I have >>> gone back and forth with/without maximizing and between portrait and >>> landscape, and it was not working. >>> >>> Thanks much! >>> >>> [image: MRS_RG_CRADAR_F000.png] >>> -- >>> >>> Andrew Kren >>> Meteorologist >>> NOAA's National Weather Service >>> Raleigh Forecast Office >>> 1005 Capability Drive, Suite 300 >>> Raleigh, North Carolina 27606 >>> voice: 919-326-1035 >>> mailto: andrew.kren at noaa.govhttp://www.weather.gov/rah >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: MRS_RG_CRADAR_F000.png Type: image/png Size: 941173 bytes Desc: not available URL: From barry.h.lynn at gmail.com Tue Feb 20 11:10:57 2024 From: barry.h.lynn at gmail.com (Barry Lynn) Date: Tue, 20 Feb 2024 20:10:57 +0200 Subject: [ncl-talk] Question regarding plot going beyond the plot page In-Reply-To: References: Message-ID: Hi Andrew: Could you please pass along the code snippet you needed to get this right? I often have this problem. Thank you, Barry On Tue, Feb 20, 2024 at 7:15?PM Andrew Kren - NOAA Federal via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > I was able to figure it out Dave. I used the vP settings to adjust the > page. And yes I always start out with eps and then use crop, etc. to > convert to png. > > On Tue, Feb 20, 2024 at 12:13?PM Dave Allured - NOAA Affiliate < > dave.allured at noaa.gov> wrote: > >> Andrew, can you get a 100% correct plot with terrain and reflectivity, >> when gsnMaximize and gsnPaperOrientation are omitted? If so, then I >> suggest this workaround. Generate the correct plot that way. For good >> resolution, generate as PDF or postscript, not jpeg or png. Then use >> external utilities to crop, rotate, and resize, as needed. To debug the >> other NCL functionality could be difficult. >> >> >> On Mon, Feb 19, 2024 at 3:02?PM Andrew Kren - NOAA Federal via ncl-talk < >> ncl-talk at mailman.ucar.edu> wrote: >> >>> Hi all, >>> >>> I sent a help request a few days ago. I am plotting a terrain map via a >>> netcdf file and am overlaying reflectivity data. I am able to get this >>> nearly 100% right. However, when I set gsnMaximize to True and >>> gsnPaperOrientation to Portrait, the plot shows up in the vertical and the >>> label bar and other text below the image is not shown or cut off (see >>> example in the email). Does anyone know what could be causing this? When I >>> did not have the terrain file, it plotted just fine within the pane. I have >>> gone back and forth with/without maximizing and between portrait and >>> landscape, and it was not working. >>> >>> Thanks much! >>> >>> [image: MRS_RG_CRADAR_F000.png] >>> >>> -- >>> >>> Andrew Kren >>> Meteorologist >>> NOAA's National Weather Service >>> Raleigh Forecast Office >>> 1005 Capability Drive, Suite 300 >>> Raleigh, North Carolina 27606 >>> voice: 919-326-1035 >>> mailto: andrew.kren at noaa.govhttp://www.weather.gov/rah >>> >>> _______________________________________________ >>> ncl-talk mailing list >>> ncl-talk at mailman.ucar.edu >>> List instructions, subscriber options, unsubscribe: >>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >>> >> > > -- > > Andrew Kren > Meteorologist > NOAA's National Weather Service > Raleigh Forecast Office > 1005 Capability Drive, Suite 300 > Raleigh, North Carolina 27606 > voice: 919-326-1035 > mailto: andrew.kren at noaa.govhttp://www.weather.gov/rah > > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -- Barry H. Lynn, Ph.D Senior Scientist, Lecturer, The Institute of Earth Sciences, The Hebrew University of Jerusalem, Givat Ram, Jerusalem 91904, Israel Tel: 972 547 231 170 Fax: (972)-25662581 Weather It Is, LTD Weather and Climate Focus https://weather-it-is.com Jerusalem, Israel Local: 02 930 9525 Cell: 054 7 231 170 Int-IS: x972 2 930 9525 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: MRS_RG_CRADAR_F000.png Type: image/png Size: 941173 bytes Desc: not available URL: From andrew.kren at noaa.gov Tue Feb 20 11:14:59 2024 From: andrew.kren at noaa.gov (Andrew Kren - NOAA Federal) Date: Tue, 20 Feb 2024 13:14:59 -0500 Subject: [ncl-talk] Question regarding plot going beyond the plot page In-Reply-To: References: Message-ID: Hi Barry, Sure, I had to add these four settings and then also turn gsnMaximize to False. res at vpXF = 0.02 res at vpYF = 0.98 res at vpWidthF = 0.90 res at vpHeightF = 0.73 Note that you'll probably have to adjust these four values for the image to fit the pane correctly. I also modified the label bar width and closeness to the image by setting: resp at pmLabelBarWidthF = 0.04 ; make label bar less wide resp at pmLabelBarOrthogonalPosF = 0.005 ; move label bar closer to y-axis of map Any other questions, happy to help. On Tue, Feb 20, 2024 at 1:11?PM Barry Lynn wrote: > Hi Andrew: > > Could you please pass along the code snippet you needed to get this > right? I often have this problem. > > Thank you, > > Barry > > On Tue, Feb 20, 2024 at 7:15?PM Andrew Kren - NOAA Federal via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> I was able to figure it out Dave. I used the vP settings to adjust the >> page. And yes I always start out with eps and then use crop, etc. to >> convert to png. >> >> On Tue, Feb 20, 2024 at 12:13?PM Dave Allured - NOAA Affiliate < >> dave.allured at noaa.gov> wrote: >> >>> Andrew, can you get a 100% correct plot with terrain and reflectivity, >>> when gsnMaximize and gsnPaperOrientation are omitted? If so, then I >>> suggest this workaround. Generate the correct plot that way. For good >>> resolution, generate as PDF or postscript, not jpeg or png. Then use >>> external utilities to crop, rotate, and resize, as needed. To debug the >>> other NCL functionality could be difficult. >>> >>> >>> On Mon, Feb 19, 2024 at 3:02?PM Andrew Kren - NOAA Federal via ncl-talk < >>> ncl-talk at mailman.ucar.edu> wrote: >>> >>>> Hi all, >>>> >>>> I sent a help request a few days ago. I am plotting a terrain map via a >>>> netcdf file and am overlaying reflectivity data. I am able to get this >>>> nearly 100% right. However, when I set gsnMaximize to True and >>>> gsnPaperOrientation to Portrait, the plot shows up in the vertical and the >>>> label bar and other text below the image is not shown or cut off (see >>>> example in the email). Does anyone know what could be causing this? When I >>>> did not have the terrain file, it plotted just fine within the pane. I have >>>> gone back and forth with/without maximizing and between portrait and >>>> landscape, and it was not working. >>>> >>>> Thanks much! >>>> >>>> [image: MRS_RG_CRADAR_F000.png] >>>> >>>> -- >>>> >>>> Andrew Kren >>>> Meteorologist >>>> NOAA's National Weather Service >>>> Raleigh Forecast Office >>>> 1005 Capability Drive, Suite 300 >>>> Raleigh, North Carolina 27606 >>>> voice: 919-326-1035 >>>> mailto: andrew.kren at noaa.govhttp://www.weather.gov/rah >>>> >>>> _______________________________________________ >>>> ncl-talk mailing list >>>> ncl-talk at mailman.ucar.edu >>>> List instructions, subscriber options, unsubscribe: >>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >>>> >>> >> >> -- >> >> Andrew Kren >> Meteorologist >> NOAA's National Weather Service >> Raleigh Forecast Office >> 1005 Capability Drive, Suite 300 >> Raleigh, North Carolina 27606 >> voice: 919-326-1035 >> mailto: andrew.kren at noaa.govhttp://www.weather.gov/rah >> >> _______________________________________________ >> ncl-talk mailing list >> ncl-talk at mailman.ucar.edu >> List instructions, subscriber options, unsubscribe: >> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >> > > > -- > > Barry H. Lynn, Ph.D > Senior Scientist, Lecturer, > The Institute of Earth Sciences, > The Hebrew University of Jerusalem, > Givat Ram, Jerusalem 91904, Israel > Tel: 972 547 231 170 > Fax: (972)-25662581 > > Weather It Is, LTD > Weather and Climate Focus > https://weather-it-is.com > Jerusalem, Israel > Local: 02 930 9525 > Cell: 054 7 231 170 > Int-IS: x972 2 930 9525 > > -- Andrew Kren Meteorologist NOAA's National Weather Service Raleigh Forecast Office 1005 Capability Drive, Suite 300 Raleigh, North Carolina 27606 voice: 919-326-1035 mailto: andrew.kren at noaa.govhttp://www.weather.gov/rah -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: MRS_RG_CRADAR_F000.png Type: image/png Size: 941173 bytes Desc: not available URL: From debasish.hazra5 at gmail.com Thu Feb 22 02:17:36 2024 From: debasish.hazra5 at gmail.com (Debasish Hazra) Date: Thu, 22 Feb 2024 04:17:36 -0500 Subject: [ncl-talk] lat,lon subscript for Lambert projection Message-ID: Hi, I am trying to plot a timeseries over a point location from a netcdf file which is in Lambert Conformal projection. I have defined lat2d = a1->lat lon2d = a1->lon nlat = dimsizes(lat2d(:,0)) nlon = dimsizes(lat2d(0,:)) dims = dimsizes(lon2d) print(dims) precip_intg1 = a1->precip(0,:,:,:) loc1 = precip_intg1(:,{32.635},{-106.338}) fatal:NclOneDValGetClosestIndex: finish coordinate index out of range, can't continue fatal:Could not obtain coordinate indexes, unable to perform subscript Is there a way to subscript lat,lon for Lambert projection in NCL. Thanks Debasish -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.allured at noaa.gov Thu Feb 22 08:34:09 2024 From: dave.allured at noaa.gov (Dave Allured - NOAA Affiliate) Date: Thu, 22 Feb 2024 08:34:09 -0700 Subject: [ncl-talk] lat,lon subscript for Lambert projection In-Reply-To: References: Message-ID: Coordinate subscripting is only available for 1-D coordinates. It looks like your file has 2-D coordinates. For 2-D, use NCL's lookup functions. See the doc page for *lat/lon functions*. This is independent of the type of projection, because all curvilinear projections should be using 2-D coordinate variables, such as your lat2d and lon2d. For locating single points, use *getind_latlon2d*. For the boundary indices of a region, use *region_ind*. On Thu, Feb 22, 2024 at 2:18?AM Debasish Hazra via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hi, > I am trying to plot a timeseries over a point location from a netcdf file > which is in Lambert Conformal projection. I have defined > lat2d = a1->lat > lon2d = a1->lon > nlat = dimsizes(lat2d(:,0)) > nlon = dimsizes(lat2d(0,:)) > dims = dimsizes(lon2d) > print(dims) > precip_intg1 = a1->precip(0,:,:,:) > loc1 = precip_intg1(:,{32.635},{-106.338}) > > fatal:NclOneDValGetClosestIndex: finish coordinate index out of range, > can't continue > fatal:Could not obtain coordinate indexes, unable to perform subscript > > Is there a way to subscript lat,lon for Lambert projection in NCL. > Thanks > Debasish > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ehsantaghizadeh at yahoo.com Sat Feb 24 14:15:23 2024 From: ehsantaghizadeh at yahoo.com (Ehsan Taghizadeh) Date: Sat, 24 Feb 2024 21:15:23 +0000 (UTC) Subject: [ncl-talk] Issue plotting map when using a topo image In-Reply-To: References: Message-ID: <1504340741.181071.1708809323528@mail.yahoo.com> Dear Andrew, I hope your problem has been solved. If not, could you please share some part of your script that is related to your question? -----------------------------------------------------------------------------Sincerely,Ehsan Taghizade On Saturday, February 17, 2024 at 07:07:40 AM GMT+3:30, Andrew Kren - NOAA Federal via ncl-talk wrote: Hi there, Sorry to bother. I overlaid?a topo image before plotting contours of radar data. I followed several of the examples on the topo page. I was able to get most of it working, but for some reason the image comes out on a different orientation and the composited images are put on differently too, while the labelbar is cut off the image. Is there a reason this would be the case? Below shows what it looked like after using a topo image: -- Andrew Kren Meteorologist NOAA's National Weather Service Raleigh Forecast Office 1005 Capability Drive, Suite 300 Raleigh, North Carolina 27606 voice: 919-326-1035 mailto: andrew.kren at noaa.gov http://www.weather.gov/rah_______________________________________________ ncl-talk mailing list ncl-talk at mailman.ucar.edu List instructions, subscriber options, unsubscribe: https://mailman.ucar.edu/mailman/listinfo/ncl-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: From setareh.rahimi at gmail.com Sun Feb 25 12:35:12 2024 From: setareh.rahimi at gmail.com (Setareh Rahimi) Date: Sun, 25 Feb 2024 23:05:12 +0330 Subject: [ncl-talk] How to convert the value of a NetCDF file to zero In-Reply-To: References: <633146882.489741.1706206005585@mail.yahoo.com> Message-ID: Hi Dennis, I tested the script you sent and noticed the values of the input file for some variables will change after using the script (check the attached). In addition, around the selected area, there would be rectangles in the same colors, which I did not expect. I wonder why this happened. I attached the original input file and the modified one. Please kindly advise me in these regards. Best wishes, On Fri, Jan 26, 2024 at 6:36?AM Dennis Shea wrote: > Dave ... As always .... THX > ------------------------- > Attached is an *untested* version of my original script with Dave's > suggested modifications. Again, I do not have a local NCL version so I can > not test it. > > Note: because the WRF coordinate dimensions are curvilinear, the > subscripts may return a larger area than 1D coordinate variables. You may > have to come up with your own version. > > Good Luck > > D > > > > On Thu, Jan 25, 2024 at 3:18?PM Dave Allured - NOAA Affiliate via ncl-talk > wrote: > >> Setareh, with simple 1-D coordinate variables, you would easily do this >> with coordinate range subscripting. Read about that in the NCL ref >> manual. Here is an example that writes directly into an existing file, >> rather than making a new file. >> >> f->MSEBIO_ISOP( {0,10}, {10,30} ) = 0 >> >> However, the coordinates in your particular file are 3-D, so you have to >> use extra code. Here is the simplest way. This is also the slowest, but >> if you are only working with a small amount of data, it is better to keep >> the code simple. This example also writes directly into the existing >> file. Not tested: >> >> lat1 = 0 >> lat2 = 10 >> lon1 = 10 >> lon2 = 30 >> >> do t = 0, ntimes-1 >> do i = 0, nlats-1 >> do j = 0, nlons-1 >> if ( (XLAT(t,i,j) .ge. lat1) .and. (XLAT(t,i,j) .le. lat2) >> \ >> .and. (XLONG(t,i,j) .ge. lon1) .and. (XLONG(t,i,j) .le. >> lon2) ) then >> f->MSEBIO_ISOP(t,i,j) = 0 >> ! You can add more variables here >> end if >> end do >> end do >> end do >> >> >> On Thu, Jan 25, 2024 at 1:04?PM Setareh Rahimi >> wrote: >> >>> Dear Dave, >>> >>> So many thanks for your help. I just checked it and it worked. >>> >>> May I ask you please to advise me on how to only convert the values of >>> all variables to zero for a specific region and not whole the domain? (for >>> example lat[0,10], and lon[10,30])? >>> >>> Thanks in advance. >>> Kind regards, >>> >>> On Thu, Jan 25, 2024 at 11:18?PM Dave Allured - NOAA Affiliate < >>> dave.allured at noaa.gov> wrote: >>> >>>> The problem is that Dennis's program did not copy the file global >>>> attributes, which contain part of the georeferencing. Just add this line >>>> near the top of the program, after the line "print (vNames)": >>>> >>>> copy_VarAtts (f, fout) >>>> >>>> >>>> On Thu, Jan 25, 2024 at 11:07?AM Ehsan Taghizadeh via ncl-talk < >>>> ncl-talk at mailman.ucar.edu> wrote: >>>> >>>>> Dear Setareh, >>>>> I suggest you read the variables from the fout file again. For >>>>> example, if there is a variable named "V10" in fout, you just need to read >>>>> that variable from fout, as follows: >>>>> V10_zero=fout->V10 >>>>> >>>>> This V10_zero has the same coordinates as V10 in the original file, >>>>> but its values are zero. >>>>> I hope this is correct. >>>>> >>>>> >>>>> On Thursday, January 25, 2024 at 06:17:12 PM GMT+3:30, Setareh Rahimi >>>>> via ncl-talk wrote: >>>>> >>>>> Dear Dennis, >>>>> I noticed an issue. When I use the attached script it converts all >>>>> values to zero, but the data is no georefrenced any more. So how can I fix >>>>> this please? >>>>> Thanks in advance. >>>>> Best regards, >>>>> >>>>> S.Rahimi >>>>> >>>>> >>>>> On Sun, Jan 21, 2024 at 18:44 Dennis Shea wrote: >>>>> >>>>> Attached is a script that does what you requested. >>>>> >>>>> >>>>> On Sat, Jan 20, 2024 at 6:40?AM Setareh Rahimi via ncl-talk < >>>>> ncl-talk at mailman.ucar.edu> wrote: >>>>> >>>>> >>>>> Dear NCL users, >>>>> >>>>> I have a NetCDF file (attached) that contains some variables. I >>>>> would like to change the values of all variables to zero for all grid >>>>> points. So how can I do this using NCL, please? >>>>> >>>>> This file is an input file for the WRF-Chem model, and I do not want >>>>> to change the format of the file, only want to change the values to zero. >>>>> >>>>> Please kindly advise me in this regard. >>>>> >>>>> Thanks in advance. >>>>> Kind regards, >>>>> -- >>>>> S.Rahimi >>>>> >>>>> _______________________________________________ >> ncl-talk mailing list >> ncl-talk at mailman.ucar.edu >> List instructions, subscriber options, unsubscribe: >> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >> > -- S.Rahimi -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: convert to zero.png Type: image/png Size: 86724 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: default.png Type: image/png Size: 194451 bytes Desc: not available URL: From barry.h.lynn at gmail.com Tue Feb 27 06:29:34 2024 From: barry.h.lynn at gmail.com (Barry Lynn) Date: Tue, 27 Feb 2024 15:29:34 +0200 Subject: [ncl-talk] Converting to Python -- sorry for being disloyal Message-ID: Hi: I have a student who must use python. I've been trying to find out how to extract WRF times in a way that can be used in python. In the end, we need to format the dates like I already did (and did for years) in NCL. times = wrf_user_getvar(a,"times",-1) new_time_units = "hours since 1800-01-01 00:00" new_time_units = new_time_units new_time_array = cd_inv_calendar( year(it_val), month(it_val), day(it_val), \ hour(it_val), minute(it_val), 0, new_time_units,0) ; print("new_time_array = " + new_time_array) ; format = "" ;; defaults to "%H%M IST %d %c %Y" format = "%H%M UTC %d %c %Y" ; format = "%d %c %Y" new_time_array = new_time_array + 0.01 time_var=cd_string(new_time_array,format) -- Barry H. Lynn, Ph.D Senior Scientist, Lecturer, The Institute of Earth Sciences, The Hebrew University of Jerusalem, Givat Ram, Jerusalem 91904, Israel Tel: 972 547 231 170 Fax: (972)-25662581 Weather It Is, LTD Weather and Climate Focus https://weather-it-is.com Jerusalem, Israel Local: 02 930 9525 Cell: 054 7 231 170 Int-IS: x972 2 930 9525 -------------- next part -------------- An HTML attachment was scrubbed... URL: From barry.h.lynn at gmail.com Wed Feb 28 07:10:09 2024 From: barry.h.lynn at gmail.com (Barry Lynn) Date: Wed, 28 Feb 2024 16:10:09 +0200 Subject: [ncl-talk] Fill Values in NCL and Python Message-ID: Hi: I know how to change an array value to fillvalue in NCL using a where statement. How do I do the same in python, please? Barry -- Barry H. Lynn, Ph.D Senior Scientist, Lecturer, The Institute of Earth Sciences, The Hebrew University of Jerusalem, Givat Ram, Jerusalem 91904, Israel Tel: 972 547 231 170 Fax: (972)-25662581 Weather It Is, LTD Weather and Climate Focus https://weather-it-is.com Jerusalem, Israel Local: 02 930 9525 Cell: 054 7 231 170 Int-IS: x972 2 930 9525 -------------- next part -------------- An HTML attachment was scrubbed... URL: From meier-fleischer at dkrz.de Wed Feb 28 08:02:18 2024 From: meier-fleischer at dkrz.de (Karin Meier-Fleischer) Date: Wed, 28 Feb 2024 16:02:18 +0100 Subject: [ncl-talk] Fill Values in NCL and Python In-Reply-To: References: Message-ID: Hi Barry, the following two Python examples demonstrate how to set values in a NumPy and an Xarray array to NaN using a condition. arr = np.arange(0., 10.) arr[arr >= 7.] = np.nan print(arr) -----> output: [ 0. 1. 2. 3. 4. 5. 6. nan nan nan] xarr = xr.DataArray(np.arange(10)) xarr = xarr.where(xarr < 7, np.nan) print(xarr.values) -----> output: [ 0. 1. 2. 3. 4. 5. 6. nan nan nan] Regards, Karin Am 28.02.24 um 15:10 schrieb Barry Lynn via ncl-talk: > Hi: > > I know how to change an array value to fillvalue in NCL using a where > statement. > > How do I do the same in python, please? > > Barry > -- > > Barry H. Lynn, Ph.D > Senior Scientist, Lecturer, > The Institute of Earth Sciences, > The Hebrew University of Jerusalem, > Givat Ram, Jerusalem 91904, Israel > Tel: 972 547 231 170 > Fax: (972)-25662581 > > Weather It Is, LTD > Weather and Climate Focus > https://weather-it-is.com > Jerusalem, Israel > Local: 02 930 9525 > Cell: 054 7 231 170 > Int-IS: x972 2 930 9525 > > > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: From meier-fleischer at dkrz.de Wed Feb 28 08:11:43 2024 From: meier-fleischer at dkrz.de (Karin Meier-Fleischer) Date: Wed, 28 Feb 2024 16:11:43 +0100 Subject: [ncl-talk] Fill Values in NCL and Python In-Reply-To: References: Message-ID: NCL: ??? xsqrt = *where*(arr .gt. 0,*sqrt* (arr), arr at _FillValue) Python: ??? xsqrt = np.where(arr > 0, np.sqrt(arr), np.nan) Am 28.02.24 um 16:02 schrieb Karin Meier-Fleischer via ncl-talk: > Hi Barry, > > the following two Python examples demonstrate how to set values in a > NumPy and an Xarray array to NaN using a condition. > > arr = np.arange(0., 10.) > arr[arr >= 7.] = np.nan > print(arr) > > -----> output: [ 0. 1. 2. 3. 4. 5. 6. nan nan nan] > > xarr = xr.DataArray(np.arange(10)) > xarr = xarr.where(xarr < 7, np.nan) > print(xarr.values) > > -----> output: [ 0. 1. 2. 3. 4. 5. 6. nan nan nan] > > Regards, > Karin > > Am 28.02.24 um 15:10 schrieb Barry Lynn via ncl-talk: >> Hi: >> >> I know how to change an array value to fillvalue in NCL using a where >> statement. >> >> How do I do the same in python, please? >> >> Barry >> -- >> >> Barry H. Lynn, Ph.D >> Senior Scientist, Lecturer, >> The Institute of Earth Sciences, >> The Hebrew University of Jerusalem, >> Givat Ram, Jerusalem 91904, Israel >> Tel: 972 547 231 170 >> Fax: (972)-25662581 >> >> Weather It Is, LTD >> Weather and Climate Focus >> https://weather-it-is.com >> Jerusalem, Israel >> Local: 02 930 9525 >> Cell: 054 7 231 170 >> Int-IS: x972 2 930 9525 >> >> >> _______________________________________________ >> ncl-talk mailing list >> ncl-talk at mailman.ucar.edu >> List instructions, subscriber options, unsubscribe: >> https://mailman.ucar.edu/mailman/listinfo/ncl-talk > > > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: