--
You received this message because you are subscribed to the Google Groups "pytroll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytroll+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pytroll/10911491-a6cd-4b16-a8fb-4d933fe6d88an%40googlegroups.com.
Graham,
Satpy can read these files! So, since you are here, why not use Pytroll libraries?
from satpy import Scene
from satpy.utils import debug_on
debug_on()
SST_FILES =
["/path/to/your/SST/file/S-OSI_-FRA_-MTOP-NARSST_FIELD-202204061000Z.nc"]
scn = Scene(filenames=SST_FILES, reader='ghrsst_l2')
scn.load(['sea_surface_temperature'])
# Here we resample to the area "euron1", but you can take any
area already defined in the "areas.yaml" file
local_scn = scn.resample('euron1')
local_scn.show('sea_surface_temperature')
-Adam
To view this discussion on the web, visit https://groups.google.com/d/msgid/pytroll/18047abc-3ebc-43c8-b4f0-61ef53c92650n%40googlegroups.com.
-- Adam Dybbroe, Satellite Remote Sensing Scientist Research lead - Nowcasting and Remote Sensing Meteorological Research unit, Research and Development Swedish Meteorological and Hydrological Institute (SMHI) www.pytroll.org nwcsaf.smhi.se www.smhi.se
The reader is supposed to handle the GHRSST netCDF format, and I know it reads the OSISAF NAR SSTs (Metop and JPSS) and also the SLSTR SSTs.
I haven't tried it myself on the Sea Ice parameters. But as you can see it at least reads the Sea Ice fraction which is part of the SST files:
In [3]: scn.available_dataset_names()
Out[3]:
['latitude_osisaf',
'longitude_osisaf',
'sea_ice_fraction',
'sea_surface_temperature']
Good luck!
-Adam
To view this discussion on the web, visit https://groups.google.com/d/msgid/pytroll/3b436957-776f-4d2e-97ed-a6ffba9011afn%40googlegroups.com.
Hi Graham,
You can add a custom composite as you wish. I have this one (in my case a local "visir.yaml" file in a directory called "composites" under the path pointed to by SATPY_CONFIG_PATH):
composites:
sea_surface_temperature_bw:
compositor:
!!python/name:satpy.composites.SingleBandCompositor
standard_name: sea_surface_temperature_bw
prerequisites:
- name: sea_surface_temperature
sea_surface_temperature_smhi:
compositor:
!!python/name:satpy.composites.SingleBandCompositor
standard_name: sea_surface_subskin_temperature_smhi
prerequisites:
- name: sea_surface_temperature
And then I have a custom enhancement like this one (in a file "generic.yaml" under a sub-directory called "enhancements" under the path pointed to by SATPY_CONFIG_PATH):
enhancements:
default:
operations:
- name: stretch
method: &stretchfun
!!python/name:satpy.enhancements.stretch
kwargs: {stretch: linear}
osisaf_sst_smhi_colormap:
standard_name: sea_surface_subskin_temperature
operations:
- name: osisaf_sst
method: !!python/name:satpy.enhancements.colorize
kwargs:
palettes:
- colors: [
[255, 0, 255],
[195, 0, 129],
[129, 0, 47],
[195, 0, 0],
[255, 0, 0],
[236, 43, 0],
[217, 86, 0],
[200, 128, 0],
[211, 154, 13],
[222, 180, 26],
[233, 206, 39],
[244, 232, 52],
[255.99609375, 255.99609375, 63.22265625],
[203.125, 255.99609375, 52.734375],
[136.71875, 255.99609375, 27.34375],
[0, 255.99609375, 0],
[0, 207.47265625, 0],
[0, 158.94921875, 0],
[0, 110.42578125, 0],
[0, 82.8203125, 63.99609375],
[0, 55.21484375, 127.9921875],
[0, 27.609375, 191.98828125],
[0, 0, 255.99609375],
[100.390625, 100.390625, 255.99609375],
[150.5859375, 150.5859375, 255.99609375]]
min_value: 296.55
max_value: 273.55
This code should produce a colored SST with black coastlines:
scn = Scene(filenames=SST_FILES, reader='ghrsst_l2')
scn.load(['sea_surface_temperature_smhi', 'sea_surface_temperature'])
local_scn = scn.resample('euron1')
timestr = local_scn.start_time.strftime('%Y%m%d_%H%M')
coast = {'outline': (0, 0, 0), 'width': 1.0, 'level': 1,
'resolution': 'i'}
local_scn.save_dataset('sea_surface_temperature_smhi',
filename='./sst_smhi_palette_{time}.png'.format(time=timestr),
overlay={'coast_dir':
'/home/a000680/data/shapes/',
'overlays': {'coasts':
coast}})
I am on holiday a couple of weeks more, so please excuse me if not responding until later in August. I suggest you continue in the channel "composites" or "satpy" on Pytroll Slack. You may be able to get faster help there.
-Adam
To view this discussion on the web, visit https://groups.google.com/d/msgid/pytroll/0e6a571f-b1e3-4a89-9ae5-c7289d09209en%40googlegroups.com.
Hi Graham,
Great that you managed to get it to work as you wished!
I am catching up slowly after the holiday.
I am really not the best person for this, I haven't done much myself with pytroll except adding logos and coastlines, but the module to use here is pydecorate. https://pydecorate.readthedocs.io/en/latest/
And Satpy does implicitly support at least some features (if not
all?) from pydecorate.
My suggestion to you if you want more help here would be to go to the pytroll slack channel #pycoast-pydecorate !
-Adam
To view this discussion on the web, visit https://groups.google.com/d/msgid/pytroll/30373e10-d5f8-4045-af11-78fd233b9af7n%40googlegroups.com.