This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Jon Blower wrote:
Thanks - will VariableDS.isMissing() do just as well or do I have to have a GridDatatype?
VariableDS.isMissing() is the same, as long as enhancement is on (should be unless you turn it off)
-----Original Message-----From: John Caron [mailto:address@hidden] Sent: 16 September 2010 14:06To: Jon Blower Subject: Re: [Ncwms-users] transparent pixels it should work for all data types. Jon Blower wrote:Ah, yes, I do use NaN to decide on missing values. I notice that GridDatatype.isMissingData() always takes a double as an argument.Willforthis work for integer data types too?The utility routine might be useful but TBH it would be just as easyme to use GridDatatype.isMissingData() if this works on all datatypes.Cheers, Jon*From:* John Caron [mailto:address@hidden] *Sent:* 16 September 2010 01:02 *To:* Jon Blower *Cc:* Ethan Davis *Subject:* Fwd: RE: [Ncwms-users] transparent pixelsHi Jon: Im guessing on the following:You use NaN to decide on missing values. But this is only used if the data type is float or double. In the case of integral data types, you have to test for missing data explicitly by doingGridDatatype.isMissingData(val);I could perhaps offer a utility routine that does that for you, converted to floats as needed, so you can uniformly test for NaN.Perhaps:Array result = GridDatatype.setMissingData(Array org); let me know if you think this is really the problem. -------- Original Message -------- *Subject: * RE: [Ncwms-users] transparent pixels *Date: * Tue, 14 Sep 2010 13:04:26 +1000 *From: * Johan <address@hidden> <mailto:address@hidden> *To: * 'John Caron' <address@hidden> <mailto:address@hidden>Hi John,Attached are some sample nc files and a sample ncml aggregation file.The nc filenames start with the variable datatype followed by anyattributesthat are present, such as _FillValue, missing_value, add_offset, scale_factor.The only files that work properly arefloat32_fill.nc int8_fill_offset_scale.nc int8_fill_missing_offset_scale_20100913T233200.ncThe latter is also used in the ncml aggregation file. Unfortunately, I cannot reproduce the problem associated with that anymore... Not surewhatwas going on there yesterday. Basically, when I looked at the serviceingodiva2, some map tiles were transparent and others were not,seemingly atrandom. I'll let you know if I can replicate it.Thanks, Johan-----Original Message-----From: John Caron [mailto:address@hidden]Sent: Tuesday, 14 September 2010 12:34 AM To: Johan Cc: address@hidden<mailto:address@hidden>Subject: Re: [Ncwms-users] transparent pixelsHi Johan:If you can send me some sample files where you see these problems,i'll tryto figure out whats going on. thanks.JohnJohan wrote:Thanks Ethan, Pauline and Peter, who responded to my request. I'll share my solution/workaround with the group in case anyone comesacrossthe same problem. I followed the documentation on using missing_value, _FillValue, andvalid_min, valid_max attributes. None of this worked for me. I shouldpointout that I'm generating netcdf files using the python NETCDF4 libraryandthe datatype of my variable is 8-bit integer. I'm using ncWMS-1.0RC2. When I change the datatype to float (32bit) it works fine, but this obviously wastes a lot of resources. 16-bit integers did not workeither.Then I used 8-bit integer with attributes 'add_offset=0.0' and 'scale_factor=1.0', and that works! So that's my workaround for now.Theonly drawback is that the service returns decimal numbers instead of integers. Interestingly, if I add both the attribute 'missing_value' and'_FillValue'the result depends on how the file is read. Reading the file via anNcMLaggregation results in partial success only, with some images being transparent but not all. Reading the file directly works fine. So I omit the 'missing_value' attribute for this reason. Cheers, JohanDr Johan SwinnenGIS Developer Navy Hydrography and METOC Branch p: 02 9359 3130 | f: 02 9359 3120 | w: http://www.metoc.gov.au -----Original Message-----From: Ethan Davis [mailto:address@hidden] Sent: Friday, 10 September 2010 12:54 AMTo: address@hidden<mailto:address@hidden>Subject: Re: [Ncwms-users] transparent pixels Hi Johan, The "Writing NetCDF Files: Best Practices" document has a section on "Missing Data Values" herehttp://www.unidata.ucar.edu/software/netcdf/docs/BestPractices.html#Miss ing%20Data%20Values Another option it doesn't mention at the moment is missing_value. I believe all the options (missing_value, _FillValue, and valid range/min/max) are recognized by ncWMS. Note: Yes, missing_value was deprecated for awhile but, being more obvious than _FillValue, it is coming back into favor. It will beaddedto the above document soon. Ethan On 9/8/2010 2:12 AM, Peter Walker wrote:Hi Johan, On 09/08/2010 07:40 AM, Johan wrote:Hi,Does anyone know how to make a particular pixel value transparent?SayI have a netcdf file with pixel values in the range 0 to 255 and I don't want to see the 0 values because they represent 'no data'.Canthis be done?Have you tried setting the _FillValue for that variable to 0 in the NetCDF file? Cheers, PeteI've tried changing the GetMap parameters 'bgcolor' and'transparent'but they only seem to affect pixels outside the spatial extent ofthenetcdf file, not pixels present in the netcdf file. Are thereperhapsany configurations inside the netcdf file that can be used whichncWMSunderstands?Thanks,JohanDr Johan SwinnenGIS Developer Navy Hydrography and METOC Branch p: 02 9359 3130 | f: 02 9359 3120 | w: http://www.metoc.gov.au <http://www.metoc.gov.au/>------------------------------------------------------------------------ ------This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ Ncwms-users mailing list address@hidden<mailto:address@hidden>https://lists.sourceforge.net/lists/listinfo/ncwms-users------------------------------------------------------------------------Plymouth Marine Laboratory Registered Office: Prospect Place The Hoe Plymouth PL1 3DH Website: www.pml.ac.uk <http://www.pml.ac.uk> <http://www.pml.ac.uk> Registered Charity No. 1091222 PML is a company limited by guarantee registered in England & Wales company number 4178503 Please think before you print.------------------------------------------------------------------------This e-mail, its content and any file attachments are confidential. If you have received this e-mail in error please do not copy,discloseit to any third party or use the contents or attachments in any way. Please notify the sender by replying to this e-mail or e-mail address@hidden <mailto:address@hidden> and then delete theemail without making any copies orusing it in any other way. The content of this message may contain personal views which are nottheviews of Plymouth Marine Laboratory unless specifically stated. You are reminded that e-mail communications are not secure and may contain viruses. Plymouth Marine Laboratory accepts no liability foranyloss or damage which may be caused by viruses.------------------------------------------------------------------------------------------------------------------------------------------------ ------This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ Ncwms-users mailing list address@hidden<mailto:address@hidden>https://lists.sourceforge.net/lists/listinfo/ncwms-users------------------------------------------------------------------------ ------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ Ncwms-users mailing list address@hidden<mailto:address@hidden>https://lists.sourceforge.net/lists/listinfo/ncwms-users------------------------------------------------------------------------ ------Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Ncwms-users mailing list address@hidden<mailto:address@hidden>https://lists.sourceforge.net/lists/listinfo/ncwms-users