├── .gitignore ├── AUTHORS ├── COPYING ├── COPYRIGHT ├── Makefile ├── README ├── common ├── Makefile ├── Makefile_struct_parser ├── alloc_output_data.F90 ├── bound_grid.F90 ├── chunk_utils.F90 ├── coefficients_spectral_response_correction.inc ├── common_constants.F90 ├── constants_cloud_typing_pavolonis.F90 ├── dealloc_output_data.F90 ├── def_output_primary.F90 ├── def_output_secondary.F90 ├── dependencies.inc ├── fort_alloc.inc ├── generate_parser.h ├── generate_parser.lex ├── generate_parser.y ├── global_attributes.F90 ├── hdf.f ├── interp_field.inc ├── interpol.F90 ├── nc_get_string_att.c ├── ncdf_def_var_template.inc ├── ncdf_open_field.inc ├── ncdf_read_field.inc ├── ncdf_read_packed_field.inc ├── ncdf_read_template.inc ├── ncdf_write_template.inc ├── orac_indexing.F90 ├── orac_ncdf.F90 ├── orac_ncdf_utils.F90 ├── orac_output.F90 ├── parse_string.inc ├── parse_string2.inc ├── parsing.F90 ├── print_data_template.h ├── rttov_version.F90 ├── source_attributes.F90 ├── struct_parser.F90 ├── struct_parser.h ├── struct_parser.hh ├── struct_parser.lex ├── struct_parser.y ├── struct_parser_utils.c ├── system_utils.F90 ├── system_utils_c.c ├── write_output_primary.F90 └── write_output_secondary.F90 ├── config ├── arch.conda.inc ├── arch.gfortran.inc ├── arch.ifort.inc ├── lib.conda.inc └── lib.inc ├── derived_products └── broadband_fluxes │ ├── Makefile │ ├── README │ ├── adiabatic_lwc.F90 │ ├── bugsrad │ ├── README │ ├── bandsolve.f │ ├── bugs_lwr.f │ ├── bugs_physconst.f90 │ ├── bugs_rad.f │ ├── bugs_swr.f │ ├── bugsrad_planck.f90 │ ├── cloud_correlate.f90 │ ├── cloudg.f │ ├── comscp1.f │ ├── comscp2.f │ ├── continuum.f90 │ ├── gases_ckd.f90 │ ├── kinds.f90 │ ├── newexp.f90 │ ├── rayle.f90 │ ├── two_rt_lw.f │ ├── two_rt_lw_iter.f │ ├── two_rt_lw_ocastrndm.f90 │ ├── two_rt_lw_sel.f │ ├── two_rt_sw.f │ ├── two_rt_sw_bs.f │ └── two_rt_sw_ocastrndm.f90 │ ├── collocate_aerosol2cloud.F90 │ ├── collocate_prtm_profile.F90 │ ├── compute_column_o3.F90 │ ├── compute_fth.F90 │ ├── compute_lts.F90 │ ├── dependencies.inc │ ├── driver_for_bugsrad.f90 │ ├── driver_for_fuliou.F90 │ ├── driver_for_lut.F90 │ ├── driver_readchg2.f90 │ ├── get_modis_aerosol.F90 │ ├── get_modis_cloud.F90 │ ├── greg2jul.F90 │ ├── interpolate_meteorology.F90 │ ├── midlatsum1.F90 │ ├── preprocess_bugsrad_sfc_albedo.F90 │ ├── preprocess_bugsrad_sfc_emissivity.F90 │ ├── preprocess_fuliou_sfc_albedo.F90 │ ├── preprocess_input.F90 │ ├── process_broadband_fluxes.F90 │ ├── read_hdf_sd_data.F90 │ └── read_hdf_sd_dims.F90 ├── docs └── README ├── feedstocks ├── README.md ├── build_libs.sh ├── conda_build_config.yaml ├── dependencies.nompi.yml ├── dependencies.openmpi.yml ├── epr_api │ ├── build.sh │ ├── makefile.patch │ ├── meta.yaml │ └── write_bands.c ├── fu_liou │ ├── CERESRadiativeTransferModel-OS.pdf │ ├── ar.patch │ ├── block.patch │ ├── build.sh │ ├── meta.yaml │ ├── run_test.sh │ ├── simple.f90 │ └── simple.txt ├── hdfeos2 │ ├── 0001-fix-automake-files-for-linux-compatibility.patch │ ├── SWapi.patch │ ├── build.sh │ ├── cacheinit.hdfeos.cmake │ ├── cmake.patch │ ├── meta.yaml │ ├── string.patch │ └── test.patch ├── hsd_reader │ ├── Makefile │ ├── build.sh │ ├── env.patch │ ├── env_nompi.patch │ ├── make.inc │ └── meta.yaml ├── libemos │ ├── activate.sh │ ├── build.sh │ ├── cmake.patch │ ├── deactivate.sh │ ├── init.patch │ ├── meta.yaml │ └── tables.patch ├── nr │ ├── LICENSE │ ├── Makefile.patch │ ├── build.sh │ ├── data.patch │ ├── meta.yaml │ ├── nompi.patch │ ├── run_test.sh │ └── shoot.patch ├── orac │ ├── activate.sh │ ├── build.sh │ ├── deactivate.sh │ ├── make.patch │ ├── meta.yaml │ └── nompi.patch ├── pyorac │ ├── local_defaults.py │ └── meta.yaml ├── rttov │ ├── arch.patch │ ├── build.sh │ ├── conda.patch │ ├── local.patch │ ├── loop.patch │ ├── meta.yaml │ ├── run_test.sh │ └── tests.patch ├── seviri_ml │ ├── __init__.py │ ├── build.sh │ ├── init_numpy.patch │ ├── make.patch │ ├── meta.yaml │ ├── module.patch │ ├── run_test.sh │ ├── setup.py │ ├── tensor_import.patch │ └── test.patch └── seviri_util │ ├── build.sh │ ├── make.inc │ ├── make.patch │ └── meta.yaml ├── patches ├── epr-api-2.3 │ └── src │ │ ├── README │ │ ├── epr_band.c │ │ ├── epr_core.h │ │ ├── epr_dddb.c │ │ ├── epr_dddb.h │ │ ├── epr_param.c │ │ ├── epr_product.c │ │ └── epr_record.c └── nr │ ├── Makefile │ └── README ├── post_processing ├── Makefile ├── alloc_input_data.F90 ├── correct_parallax.F90 ├── dealloc_input_data.F90 ├── dependencies.inc ├── orac_input.F90 ├── orac_postproc.F90 ├── postproc_constants.F90 ├── postproc_utils.F90 ├── prepare_output_pp.F90 ├── prepare_output_primary_pp.F90 ├── prepare_output_secondary_pp.F90 ├── read_input_dimensions.F90 ├── read_input_primary.F90 └── read_input_secondary.F90 ├── pre_processing ├── Makefile ├── aatsr_corrections.F90 ├── allocate_channel_info.F90 ├── allocate_imager_structures.F90 ├── allocate_preproc_structures.F90 ├── allocate_surface_structures.F90 ├── bright_m.F90 ├── build_preproc_fields.F90 ├── calender.F90 ├── channel_structures.F90 ├── cloud_emis.F90 ├── cloud_typing_pavolonis.F90 ├── compute_geopot_coordinate.F90 ├── correct_for_ice_snow.F90 ├── cox_munk.F90 ├── cox_munk_constants.F90 ├── create_time_for_pixel.F90 ├── deallocate_channel_info.F90 ├── deallocate_ecmwf_structures.F90 ├── deallocate_imager_structures.F90 ├── deallocate_preproc_structures.F90 ├── deallocate_surface_structures.F90 ├── define_preprop_grid.F90 ├── dependencies.inc ├── ecmwf.F90 ├── fill_grid.F90 ├── fundamental_constants.inc ├── gauss_leg_quad.F90 ├── get_USGS_data.F90 ├── get_modis_time.F90 ├── get_surface_emissivity.F90 ├── get_surface_reflectance.F90 ├── imager_structures.F90 ├── map_time_to_pixel.F90 ├── mcd43c.F90 ├── modis_bright.F90 ├── netcdf_output.F90 ├── netcdf_output_check.F90 ├── netcdf_output_close.F90 ├── netcdf_output_create.F90 ├── netcdf_output_create_file.F90 ├── netcdf_output_write_swath.F90 ├── neural_net_constants.F90 ├── neural_net_preproc.F90 ├── nsidc_nise.F90 ├── ocean_colour.F90 ├── orac_preproc.F90 ├── pavolonis_fill_coefficients.inc ├── preparation.F90 ├── preproc_constants.F90 ├── preproc_structures.F90 ├── read_USGS_file.F90 ├── read_aatsr.F90 ├── read_aatsr_dimensions.F90 ├── read_aatsr_l1b.F90 ├── read_aatsr_orbit.c ├── read_aatsr_orbit.h ├── read_abi.F90 ├── read_abi_funcs.F90 ├── read_abi_main.F90 ├── read_agri.F90 ├── read_avhrr.F90 ├── read_avhrr_angles.F90 ├── read_avhrr_dimensions.F90 ├── read_avhrr_l1b_radiances.F90 ├── read_avhrr_l1b_radiances_2.F90 ├── read_avhrr_land_sea_mask.F90 ├── read_avhrr_land_sea_mask_2.F90 ├── read_avhrr_lat_lon.F90 ├── read_avhrr_time.F90 ├── read_avhrr_time_lat_lon_angles.F90 ├── read_camel_emissivity.F90 ├── read_cimss_emissivity.F90 ├── read_ecmwf.F90 ├── read_ecmwf_grib.F90 ├── read_ecmwf_nc.F90 ├── read_ecmwf_wind_badc.F90 ├── read_ecmwf_wind_grib.F90 ├── read_ecmwf_wind_nc.F90 ├── read_era5_jasmin.F90 ├── read_gfs_grib.F90 ├── read_gfs_nc.F90 ├── read_himawari.F90 ├── read_imager.F90 ├── read_mcd43c1.F90 ├── read_mcd43c3.F90 ├── read_modis.F90 ├── read_modis_angles.F90 ├── read_modis_dimensions.F90 ├── read_modis_l1b_radiances.F90 ├── read_modis_l1b_radiances_2.F90 ├── read_modis_land_sea_mask.F90 ├── read_modis_lat_lon.F90 ├── read_modis_time.F90 ├── read_modis_time_lat_lon_angles.F90 ├── read_nsidc_nise.F90 ├── read_python.F90 ├── read_seviri.F90 ├── read_slstr.F90 ├── read_slstr_funcs.F90 ├── read_slstr_main.F90 ├── read_viirs_Iband.F90 ├── read_viirs_Mband.F90 ├── rearrange_ecmwf.F90 ├── remove_rayleigh.F90 ├── ross_thick_li_sparse_r.F90 ├── rttov_driver.F90 ├── rttov_driver_gfs.F90 ├── select_camel_emiss_file.F90 ├── select_modis_albedo_file.F90 ├── select_modis_emiss_file.F90 ├── set_ecmwf.F90 ├── setup.F90 ├── seviri_neural_net_preproc.F90 ├── solar_position.F90 ├── surface_emissivity.F90 ├── surface_reflectance.F90 ├── surface_structures.F90 ├── utils_for_main.F90 ├── write_ir_rttov.F90 └── write_solar_rttov.F90 ├── src ├── Makefile ├── alloc_rtm_pc.F90 ├── alloc_sad_lut.F90 ├── alloc_spixel.F90 ├── calc_corrected_ctx.F90 ├── calc_cwp.F90 ├── check_limits.F90 ├── check_value.inc ├── cholesky.F90 ├── ctrl.F90 ├── data.F90 ├── dealloc_ctrl.F90 ├── dealloc_data.F90 ├── dealloc_rtm.F90 ├── dealloc_rtm_pc.F90 ├── dealloc_sad_lut.F90 ├── dealloc_spixel.F90 ├── dependencies.inc ├── determine_illum.F90 ├── diag.F90 ├── find_in_array.inc ├── find_lun.F90 ├── fm.F90 ├── fm_routines.F90 ├── fm_solar.F90 ├── fm_thermal.F90 ├── get_geometry.F90 ├── get_indexing.F90 ├── get_location.F90 ├── get_lsf.F90 ├── get_lwswrtm.F90 ├── get_measurements.F90 ├── get_rtm.F90 ├── get_spixel.F90 ├── get_surface.F90 ├── get_x.F90 ├── gzero.F90 ├── int_ctp.F90 ├── int_lut_re.F90 ├── int_lut_routines.F90 ├── int_lut_taure.F90 ├── int_lut_tausatre.F90 ├── int_lut_tausatreonsol.F90 ├── int_lut_tausatsolazire.F90 ├── int_lut_tausolre.F90 ├── int_routines.F90 ├── interp3dlut.F90 ├── interpol_routines.F90 ├── interpol_solar.F90 ├── interpol_solar_spline.F90 ├── interpol_thermal.F90 ├── interpol_thermal_spline.F90 ├── inversion.F90 ├── invert_cholesky.F90 ├── invert_marquardt.F90 ├── linint.F90 ├── locate.F90 ├── nullify_data.F90 ├── orac.F90 ├── orac_constants.F90 ├── planck.F90 ├── prepare_output.F90 ├── prepare_output_primary.F90 ├── prepare_output_secondary.F90 ├── r2t.F90 ├── read_alb.F90 ├── read_cloudflags.F90 ├── read_config_file.F90 ├── read_ctp.F90 ├── read_ctrl.def ├── read_data.F90 ├── read_driver.F90 ├── read_geometry.F90 ├── read_input_dimensions.F90 ├── read_location.F90 ├── read_lsflags.F90 ├── read_lwrtm.F90 ├── read_msi.F90 ├── read_prtm.F90 ├── read_sad.F90 ├── read_sad_chan.F90 ├── read_sad_lut.F90 ├── read_swrtm.F90 ├── read_utils.F90 ├── rtm.F90 ├── rtm_pc.F90 ├── sabotage_inputs.F90 ├── sad_chan.F90 ├── sad_lut.F90 ├── sad_util.F90 ├── set_crp_solar.F90 ├── set_crp_thermal.F90 ├── set_diag.F90 ├── set_gzero.F90 ├── set_kx.F90 ├── set_limits.F90 ├── set_sy.F90 ├── solve_cholesky.F90 ├── spixel.F90 ├── spixel_routines.F90 ├── switch.inc ├── t2r.F90 ├── testInterp.F90 ├── x_mdad.F90 ├── x_sdad.F90 └── zero_diag.F90 └── tools ├── collocate_orac_and_calipso.py ├── convj.py ├── forward_model_examples.ipynb ├── make_depend.pl ├── orac.py ├── pyorac ├── __init__.py ├── arguments.py ├── batch.py ├── colour_print.py ├── definitions.py ├── drivers.py ├── fm.py ├── local_defaults.py.example ├── lut.py ├── mappable.py ├── processing_settings.py ├── run.py ├── swath.py └── util.py ├── regression.py ├── setup.py ├── single_process.py ├── slstr_ml ├── Dataloader.py ├── README.md ├── SLSTR_NN.py ├── Visualisation.py ├── for firstyearstudents └── satpy_read_SLSTR.py └── swath_examples.ipynb /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # / 3 | / 4 | 5 | # /common/ 6 | /common/obj 7 | /common/gmon.out 8 | /common/h2o_ref.dat 9 | /common/liborac_common.a 10 | /common/generate_parser 11 | /common/generate_parser.tab.c 12 | /common/generate_parser.tab.h 13 | /common/generate_parser.c 14 | /common/struct_parser.tab.cc 15 | /common/struct_parser.tab.hh 16 | /common/position.hh 17 | /common/location.hh 18 | /common/stack.hh 19 | /common/rttov_version 20 | 21 | # /config/ 22 | /config/*debug* 23 | 24 | # /derived_products/broadband_fluxes/ 25 | /derived_products/broadband_fluxes/obj 26 | /derived_products/broadband_fluxes/libprocess_broadband_fluxes.a 27 | /derived_products/broadband_fluxes/process_broadband_fluxes 28 | /derived_products/broadband_fluxes/gmon.out 29 | /derived_products/broadband_fluxes/h2o_ref.dat 30 | /derived_products/broadband_fluxes/fu_liou 31 | 32 | # /post_processing/ 33 | /post_processing/obj 34 | /post_processing/libpostproc.a 35 | /post_processing/orac_postproc 36 | /post_processing/gmon.out 37 | /post_processing/h2o_ref.dat 38 | 39 | # /pre_processing/ 40 | /pre_processing/obj 41 | /pre_processing/libpreproc.a 42 | /pre_processing/orac_preproc 43 | /pre_processing/gmon.out 44 | /pre_processing/h2o_ref.dat 45 | 46 | # /src/ 47 | /src/obj 48 | /src/orac 49 | /src/liborac.a 50 | /src/gmon.out 51 | /src/h2o_ref.dat 52 | /src/read_ctrl.cc 53 | /src/read_ctrl.F90 54 | /src/read_ctrl.lex 55 | 56 | # /tools/ 57 | /tools/pyorac/local_defaults.py 58 | /tools/__pycache__ 59 | /tools/*.pyc 60 | /tools/pyorac/__pycache__ 61 | /tools/pyorac/*.pyc 62 | 63 | # /feedstocks/ 64 | /feedstocks/*/conda_build_config.yaml 65 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Current and past contributors in alphabetical order by last name: 2 | 3 | Chris Arnold 4 | Matthew Christensen 5 | Matthias Jerg 6 | Greg McGarragh 7 | Caroline Poulsen 8 | Adam Povey 9 | Simon Proud 10 | Andy Smith 11 | Oliver Sus 12 | Gareth Thomas 13 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | !******************************************************************************* 2 | ! 3 | ! Copyright (C) 2000-2018, RAL Space, Science and Technology Facilities Council 4 | ! Copyright (C) 2000-2018, University of Oxford 5 | ! Copyright (C) 2011-2018, Deutscher Wetterdienst 6 | ! 7 | ! This program is free software: you can redistribute it and/or modify it under 8 | ! the terms of the GNU General Public License as published by the Free Software 9 | ! Foundation, either version 3 of the License, or (at your option) any later 10 | ! version. 11 | ! 12 | ! This program is distributed in the hope that it will be useful, but WITHOUT 13 | ! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 | ! FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU General Public License along with 17 | ! this program. If not, see . 18 | ! 19 | !******************************************************************************* 20 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | cd common && $(MAKE) 3 | cd pre_processing && $(MAKE) 4 | cd src && $(MAKE) 5 | cd post_processing && $(MAKE) 6 | cd derived_products/broadband_fluxes && $(MAKE) 7 | 8 | depend: 9 | cd common && $(MAKE) depend 10 | cd pre_processing && $(MAKE) depend 11 | cd src && $(MAKE) depend 12 | cd post_processing && $(MAKE) depend 13 | cd derived_products/broadband_fluxes && $(MAKE) depend 14 | 15 | clean tidy: 16 | cd common && $(MAKE) clean 17 | cd pre_processing && $(MAKE) clean 18 | cd src && $(MAKE) clean 19 | cd post_processing && $(MAKE) clean 20 | cd derived_products/broadband_fluxes && $(MAKE) clean 21 | 22 | clean_parser: 23 | cd common && $(MAKE) clean_parser 24 | cd src && $(MAKE) clean_parser 25 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Documentation for ORAC is managed through the Wiki at: 2 | 3 | https://github.com/ORAC-CC/orac/wiki 4 | 5 | ORAC is licensed under the GNU General Public License (GPL), Version 3. See the 6 | file COPYING included with this source for more details. 7 | -------------------------------------------------------------------------------- /common/chunk_utils.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: chunk_utils.F90 3 | ! 4 | ! Purpose: 5 | ! 6 | ! History: 7 | ! 2016/07/11, SP: Initial, replaces preprocessor specific chunking routines 8 | ! 9 | ! Bugs: 10 | ! None known. 11 | !------------------------------------------------------------------------------- 12 | 13 | module chunk_utils_m 14 | 15 | implicit none 16 | 17 | private 18 | 19 | public :: calc_n_chunks, & 20 | chunkify 21 | 22 | contains 23 | 24 | function calc_n_chunks(n_segments, segment_starts, segment_ends, & 25 | chunk_size) result (n_chunks) 26 | 27 | implicit none 28 | 29 | integer, intent(in) :: n_segments 30 | integer, intent(in) :: segment_starts(*) 31 | integer, intent(in) :: segment_ends(*) 32 | integer, intent(in) :: chunk_size 33 | integer :: n_chunks 34 | 35 | integer :: i 36 | 37 | n_chunks = 0 38 | 39 | do i = 1, n_segments 40 | n_chunks = n_chunks + (segment_ends(i) - segment_starts(i)) / & 41 | chunk_size + 1 42 | end do 43 | 44 | end function calc_n_chunks 45 | 46 | 47 | subroutine chunkify(n_segments, segment_starts, segment_ends, & 48 | chunk_size, n_chunks, chunk_starts, chunk_ends) 49 | 50 | implicit none 51 | 52 | integer, intent(in) :: n_segments 53 | integer, intent(in) :: segment_starts(*) 54 | integer, intent(in) :: segment_ends(*) 55 | integer, intent(in) :: chunk_size 56 | integer, intent(out) :: n_chunks 57 | integer, intent(out) :: chunk_starts(*) 58 | integer, intent(out) :: chunk_ends(*) 59 | 60 | integer :: i 61 | 62 | n_chunks = 1 63 | 64 | do i = 1, n_segments 65 | chunk_starts(n_chunks) = segment_starts(i) 66 | 67 | do while (chunk_starts(n_chunks) + chunk_size .lt. segment_ends(i)) 68 | chunk_ends(n_chunks) = chunk_starts(n_chunks) + chunk_size - 1 69 | n_chunks = n_chunks + 1 70 | chunk_starts(n_chunks) = chunk_starts(n_chunks - 1) + chunk_size 71 | end do 72 | 73 | chunk_ends(n_chunks) = segment_ends(i) 74 | 75 | n_chunks = n_chunks + 1 76 | end do 77 | 78 | n_chunks = n_chunks - 1 79 | 80 | end subroutine chunkify 81 | 82 | end module chunk_utils_m 83 | -------------------------------------------------------------------------------- /common/dependencies.inc: -------------------------------------------------------------------------------- 1 | $(OBJS)/constants_cloud_typing_pavolonis.o: $(OBJS)/common_constants.o \ 2 | coefficients_spectral_response_correction.inc 3 | $(OBJS)/global_attributes.o: $(OBJS)/common_constants.o 4 | $(OBJS)/interpol.o: $(OBJS)/common_constants.o bound_grid.F90 interp_field.inc 5 | $(OBJS)/orac_indexing.o: $(OBJS)/common_constants.o 6 | $(OBJS)/orac_ncdf.o: $(OBJS)/common_constants.o $(OBJS)/global_attributes.o \ 7 | $(OBJS)/source_attributes.o $(OBJS)/system_utils.o \ 8 | ncdf_def_var_template.inc ncdf_open_field.inc ncdf_read_field.inc \ 9 | ncdf_read_packed_field.inc ncdf_read_template.inc \ 10 | ncdf_write_template.inc orac_ncdf_utils.F90 11 | $(OBJS)/orac_output.o: $(OBJS)/orac_indexing.o $(OBJS)/orac_ncdf.o \ 12 | alloc_output_data.F90 dealloc_output_data.F90 def_output_primary.F90 \ 13 | def_output_secondary.F90 write_output_primary.F90 \ 14 | write_output_secondary.F90 15 | $(OBJS)/parsing.o: $(OBJS)/common_constants.o parse_string.inc parse_string2.inc 16 | $(OBJS)/source_attributes.o: $(OBJS)/common_constants.o 17 | -------------------------------------------------------------------------------- /common/fort_alloc.inc: -------------------------------------------------------------------------------- 1 | subroutine FORT_ALLOC_NAME_1D(ptr, n0, m0) bind(C,name=XSTR(FORT_ALLOC_NAME_1D)) 2 | use iso_c_binding 3 | implicit none 4 | 5 | type(c_ptr), intent(inout) :: ptr 6 | integer(c_int), intent(inout) :: n0 7 | integer(c_int), intent(in) :: m0 8 | FORT_ALLOC_TYPE, pointer :: arr(:) 9 | 10 | if (n0 /= m0) then 11 | if (n0 /= 0) then 12 | call c_f_pointer(ptr, arr, [n0]) 13 | deallocate(arr) 14 | end if 15 | allocate(arr(m0)) 16 | n0 = m0 17 | ptr = c_loc(arr(1)) 18 | end if 19 | 20 | end subroutine FORT_ALLOC_NAME_1D 21 | 22 | subroutine FORT_ALLOC_NAME_2D(ptr, n0, n1, m0, m1) bind(C,name=XSTR(FORT_ALLOC_NAME_2D)) 23 | use iso_c_binding 24 | implicit none 25 | 26 | type(c_ptr), intent(inout) :: ptr 27 | integer(c_int), intent(inout) :: n0, n1 28 | integer(c_int), intent(in) :: m0, m1 29 | FORT_ALLOC_TYPE, pointer :: arr(:,:) 30 | 31 | if (n0 /= m0 .or. n1 /= m1) then 32 | if (n0 /= 0 .or. n1 /= 0) then 33 | call c_f_pointer(ptr, arr, [n0,n1]) 34 | deallocate(arr) 35 | end if 36 | allocate(arr(m0,m1)) 37 | n0 = m0 38 | n1 = m1 39 | ptr = c_loc(arr(1,1)) 40 | end if 41 | 42 | end subroutine FORT_ALLOC_NAME_2D 43 | -------------------------------------------------------------------------------- /common/generate_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | NAME: 3 | generate_parser.h 4 | PURPOSE: 5 | Declarations for generate_parser. 6 | HISTORY: 7 | 09 Jun 2016, ACP: Initial version 8 | 13 Jul 2016, GRM: Add TYPE_FC, N_TYPES, N_STCK. 9 | */ 10 | #ifndef GENERATE_PARSER_H 11 | #define GENERATE_PARSER_H 12 | 13 | #include 14 | #include 15 | 16 | // Length of strings 17 | #define STR_LEN 1024 18 | 19 | // Subscripts of first dimension of stck arrays 20 | #define TYPE_UPP 0 21 | #define TYPE_C 1 22 | #define TYPE_F 2 23 | #define TYPE_FC 3 24 | #define N_TYPES 4 25 | 26 | // Subscripts of f FILE pointer array 27 | #define C_DEF 0 28 | #define X_RUL 1 29 | #define X_DEF 2 30 | #define C_ARG 3 31 | #define C_CP1 4 32 | #define C_CP2 5 33 | #define F_ARG 6 34 | #define F_DEF 7 35 | #define F_AR1 8 36 | #define F_AR2 9 37 | #define F_CP1 10 38 | #define F_CP2 11 39 | #define F_PRI 12 40 | #define X_SED 13 41 | #define N_INC_FILES 14 42 | 43 | #define N_STCK N_TYPES 44 | 45 | // Function declarations 46 | char* strupp(char* , char* ); 47 | void print_struct_in_c_def(FILE** , char* , char* , char* ); 48 | void print_var_in_c_def(FILE** , char* , char* ); 49 | void print_dim_in_c_def(FILE** , char* , int ); 50 | void print_const_in_c_def(FILE** , char* , char* ); 51 | void print_const_in_x_rul(FILE** , char* ); 52 | void print_str_in_x_rul(FILE** , char* , char* ); 53 | void print_struct_in_x_rul(FILE** , char* , char* , char* ); 54 | void print_var_in_x_rul(FILE** , char* , char* , char* , char* , char* , int ); 55 | void print_struct_in_def(FILE** , char* , char* ); 56 | void print_var_in_c_wrapper(FILE** , char* , char* , char* ); 57 | void print_alloc_in_c_wrapper(FILE** , char* , char* , char* , int ); 58 | void print_struct_in_f(FILE** , char* , char* , char* ); 59 | void print_const_in_f(FILE** , char* , char* ); 60 | void print_var_in_f(FILE** , char* , char* , char* , char* ); 61 | void print_alloc_in_f(FILE** , char* , char* , int ); 62 | void print_print_str_in_f(FILE* f[], char* parent_struct, char* name); 63 | void print_print_var_in_f(FILE* f[], char* parent_struct, char* name, char* type_c, 64 | char* len, int alloc); 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /common/hdf.f: -------------------------------------------------------------------------------- 1 | C Wrapper for the HDF 4 "header" file 2 | module hdf_m 3 | implicit none 4 | public 5 | include "hdf.inc" 6 | contains 7 | end module hdf_m 8 | -------------------------------------------------------------------------------- /common/nc_get_string_att.c: -------------------------------------------------------------------------------- 1 | /** 2 | Routine to read a string attribute from a NetCDF variable. 3 | 4 | This isn't supported natively by netcdf-fortran and so this is an 5 | interface to the C routine that can. Code is largely cribbed from 6 | https://www.unidata.ucar.edu/software/netcdf/docs/group__attributes.html#ga0d66350856a4a6dd3f459fd092937c27 7 | 8 | History: 9 | 2021/03/16, AP: Original version. 10 | **/ 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | void nc_check(const int stat) 18 | { 19 | if (stat != NC_NOERR) { 20 | printf("ERROR: ncdf_get_string_att(): %s\n", nc_strerror(stat)); 21 | exit(1); 22 | } 23 | } 24 | 25 | void nc_get_string_att (const char *fname, const char *vname, 26 | const char *aname, char str[128]) 27 | { 28 | int stat = 0; 29 | 30 | int ncid = 0; 31 | stat = nc_open(fname, NC_NOWRITE, &ncid); nc_check(stat); 32 | 33 | int varid = 0; 34 | stat = nc_inq_varid(ncid, vname, &varid); nc_check(stat); 35 | 36 | size_t attlen = 0; 37 | stat = nc_inq_attlen(ncid, varid, aname, &attlen); nc_check(stat); 38 | 39 | char **string_attr = (char**)malloc(attlen * sizeof(char*)); 40 | memset(string_attr, 0, attlen * sizeof(char*)); 41 | 42 | stat = nc_get_att_string(ncid, varid, aname, string_attr); nc_check(stat); 43 | // Copy the first, and only the first, element of the array 44 | strcpy(str, string_attr[0]); 45 | 46 | stat = nc_free_string(attlen, string_attr); nc_check(stat); 47 | free(string_attr); 48 | 49 | stat = nc_close(ncid); nc_check(stat); 50 | 51 | return; 52 | } 53 | -------------------------------------------------------------------------------- /common/ncdf_open_field.inc: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: ncdf_open_field.inc 3 | ! 4 | ! Purpose: 5 | ! Code shared by all version of ncdf_read_array function. See orac_ncdf.F90 for 6 | ! detailed header information. 7 | ! 8 | ! Description and Algorithm details: 9 | ! 1) Read data 10 | ! 3) Replace fill values, apply scale factor, add offset 11 | ! 12 | ! History: 13 | ! 2014/02/10, AP: Original version. 14 | ! 2014/08/15, AP: Fixed bug in management of scale factor/offset. Homogenizing 15 | ! verbose and error printing formats. Split into open field/read field. 16 | ! 2015/07/16, GM: Modifications to properly read packed data and check ranges. 17 | ! 18 | ! Bugs: 19 | ! None known. 20 | !------------------------------------------------------------------------------- 21 | #ifdef DEBUG 22 | print*, 'Opening variable: ', trim(name) 23 | #endif 24 | ! locate variable in file 25 | ierr = nf90_inq_varid(ncid, name, vid) 26 | if (ierr.ne.NF90_NOERR) then 27 | print*, 'ERROR: ncdf_read_file(): Could not locate variable ', trim(name) 28 | print*, trim(nf90_strerror(ierr)) 29 | stop error_stop_code 30 | end if 31 | 32 | ! read field attributes 33 | fv_flag = .false. 34 | vr_flag = .false. 35 | 36 | vmin = -huge(vmin) 37 | vmax = huge(vmax) 38 | 39 | if (nf90_get_att(ncid, vid, '_FillValue', fv).eq.NF90_NOERR) fv_flag = .true. 40 | if (nf90_get_att(ncid, vid, 'scale_factor', sf).ne.NF90_NOERR) sf = 1.0 41 | if (nf90_get_att(ncid, vid, 'add_offset', of).ne.NF90_NOERR) of = 0.0 42 | if (nf90_get_att(ncid, vid, 'valid_min', vmin).eq.NF90_NOERR) vr_flag = .true. 43 | if (nf90_get_att(ncid, vid, 'valid_max', vmax).eq.NF90_NOERR) vr_flag = .true. 44 | -------------------------------------------------------------------------------- /common/ncdf_read_field.inc: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: ncdf_read_field.inc 3 | ! 4 | ! Purpose: 5 | ! Code shared by all version of ncdf_read_array function. See orac_ncdf.F90 for 6 | ! detailed header information. 7 | ! 8 | ! Description and Algorithm details: 9 | ! 1) Locate variable in file 10 | ! 2) Read fill values, apply scale factor, add offset 11 | ! 12 | ! History: 13 | ! 2014/02/10, AP: Original version. 14 | ! 2014/08/15, AP: Fixed bug in management of scale factor/offset. Homogenizing 15 | ! verbose and error printing formats. Split into open field/read field. 16 | ! 2014/09/03, GM: Fixed bug: fv should not be used as a loop local auxillary 17 | ! variable. 18 | ! 2015/07/16, GM: Modifications to properly read packed data and check ranges. 19 | ! 20 | ! Bugs: 21 | ! None known. 22 | !------------------------------------------------------------------------------- 23 | 24 | #ifdef DEBUG 25 | print*, 'Reading variable: ', trim(name) 26 | print*, 'Start: ', start_pos 27 | print*, 'Count: ', counter 28 | print*, 'Stride: ', stride 29 | #endif 30 | 31 | ! read data 32 | ierr = nf90_get_var(ncid, vid, arr, start_pos, counter, stride) 33 | if (ierr.ne.NF90_NOERR) then 34 | print*, 'ERROR: ncdf_read_file(): Could not read variable ', trim(name) 35 | print*, trim(nf90_strerror(ierr)) 36 | stop error_stop_code 37 | end if 38 | 39 | ! replace file's fill value and out of range values with our own and apply 40 | ! scale factor/offset 41 | if (fv_flag) then 42 | if (vr_flag) then 43 | where (arr.ne.fv .and. arr.lt.vmin) arr = fv 44 | where (arr.ne.fv .and. arr.gt.vmax) arr = fv 45 | end if 46 | if (sf .ne. 1.0 .or. of .ne. 0.0) then 47 | where (arr.ne.fv) 48 | arr = sf*arr + of 49 | elsewhere 50 | arr = fill 51 | endwhere 52 | end if 53 | else 54 | if (sf .ne. 1.0 .or. of .ne. 0.0) then 55 | if (vr_flag) then 56 | where(arr.ge.vmin .and. arr.le.vmax) 57 | arr = sf*arr + of 58 | elsewhere 59 | arr = fill 60 | endwhere 61 | else 62 | arr = sf*arr + of 63 | end if 64 | end if 65 | end if 66 | 67 | ! additional information for print out 68 | #ifdef DEBUG 69 | if (nf90_get_att(ncid, vid, 'units', unit).eq.NF90_NOERR) then 70 | call c_to_f_str(unit) 71 | print*, 'Field units: ', trim(unit) 72 | end if 73 | if (vr_flag) then 74 | print*, 'Field valid min: ', sf*vmin + of 75 | print*, 'Field valid max: ', sf*vmax + of 76 | end if 77 | #endif 78 | -------------------------------------------------------------------------------- /common/ncdf_read_packed_field.inc: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: ncdf_read_field.inc 3 | ! 4 | ! Purpose: 5 | ! Code shared by all version of ncdf_read_array function. See orac_ncdf.F90 for 6 | ! detailed header information. 7 | ! 8 | ! Description and Algorithm details: 9 | ! 1) Locate variable in file 10 | ! 2) Read fill values, apply scale factor, add offset 11 | ! 12 | ! History: 13 | ! 2014/02/10, AP: Original version. 14 | ! 2014/08/15, AP: Fixed bug in management of scale factor/offset. Homogenizing 15 | ! verbose and error printing formats. Split into open field/read field. 16 | ! 2014/09/03, GM: Fixed bug: fv should not be used as a loop local auxillary 17 | ! variable. 18 | ! 19 | ! Bugs: 20 | ! None known. 21 | !------------------------------------------------------------------------------- 22 | #ifdef DEBUG 23 | print*, 'Reading variable: ', trim(name) 24 | #endif 25 | 26 | ! read data 27 | ierr = nf90_get_var(ncid, vid, arr_packed, start, counter, stride) 28 | if (ierr.ne.NF90_NOERR) then 29 | print*, 'ERROR: ncdf_read_file(): Could not read variable ', trim(name) 30 | print*, trim(nf90_strerror(ierr)) 31 | stop error_stop_code 32 | end if 33 | 34 | ! replace file's fill value with our own and apply scale factor/offset 35 | if (fv_flag) & 36 | where (arr_packed.eq.fv) arr = fill 37 | if (vr_flag) then 38 | where (arr_packed.lt.vmin) arr = fill 39 | where (arr_packed.gt.vmax) arr = fill 40 | end if 41 | where (arr_packed.ne.fv) arr = sf*arr_packed + of 42 | 43 | ! additional information for print out 44 | #ifdef DEBUG 45 | if (nf90_get_att(ncid, vid, 'units', unit).eq.NF90_NOERR) then 46 | call c_to_f_str(unit) 47 | print*, 'Field units: ', trim(unit) 48 | end if 49 | if (vr_flag) then 50 | print*, 'Field valid min: ', sf*vmin + of 51 | print*, 'Field valid max: ', sf*vmax + of 52 | end if 53 | #endif 54 | -------------------------------------------------------------------------------- /common/parse_string2.inc: -------------------------------------------------------------------------------- 1 | integer function PARSE_STRING_NAME_0D(in, out, ch_ids) result(status) 2 | implicit none 3 | 4 | character(len=*), intent(in) :: in 5 | PARSE_STRING_TYPE(kind=PARSE_STRING_KIND), intent(out) :: out 6 | integer, optional, intent(in) :: ch_ids(:) ! Dummy for main processor routine 7 | integer :: ios 8 | 9 | status = 0 10 | 11 | read(in, *, iostat=ios) out 12 | if (ios /= 0) status = PARSE_ERR_CONV 13 | end function PARSE_STRING_NAME_0D 14 | -------------------------------------------------------------------------------- /common/print_data_template.h: -------------------------------------------------------------------------------- 1 | static int XCAT(snprint_scaler_, TYPE_NAME)(char *buf, size_t size, const TYPE_C x) { 2 | 3 | return snprintf(buf, size, TYPE_FORMAT, x); 4 | } 5 | 6 | 7 | static int XCAT(TYPE_NAME, _array_snprint)(char *buf, size_t size, const TYPE_C *array, 8 | const unsigned int *dims, const unsigned int i, const unsigned int stride) { 9 | 10 | unsigned int j; 11 | unsigned int count = 0; 12 | 13 | for (j = 0; j < dims[i]; ++j) { 14 | if (i == 0) { 15 | count += XCAT(snprint_scaler_, TYPE_NAME)(buf + count, XXX(size, count), 16 | array[j]); 17 | if (j < dims[i] - 1) 18 | count += snprintf(buf + count, XXX(size, count), ", "); 19 | } 20 | else { 21 | count += XCAT(TYPE_NAME, _array_snprint)(buf + count, XXX(size, count), 22 | &array[j * stride], dims, i - 1, 23 | stride / dims[i]); 24 | if (j < dims[i] - 1) 25 | count += snprintf(buf + count, XXX(size, count), "; "); 26 | } 27 | } 28 | 29 | return count; 30 | } 31 | 32 | 33 | static int XCAT(snprint_array_, TYPE_NAME)(char *buf, size_t size, const TYPE_C *array, 34 | unsigned int n_dims, const unsigned int *dims) { 35 | 36 | unsigned int i; 37 | unsigned int stride; 38 | 39 | stride = 1; 40 | for (i = 0; i < n_dims - 1; ++i) 41 | stride *= dims[i]; 42 | 43 | return XCAT(TYPE_NAME, _array_snprint)(buf, size, array, dims, n_dims - 1, stride); 44 | } 45 | -------------------------------------------------------------------------------- /common/rttov_version.F90: -------------------------------------------------------------------------------- 1 | ! Prints the full version number of the linked RTTOV library 2 | program rttov_version 3 | 4 | use rttov_const, only: version, release, minor_version 5 | 6 | implicit none 7 | 8 | write(*,'(i2,".",i1,".",i1)') version, release, minor_version 9 | 10 | end program rttov_version 11 | -------------------------------------------------------------------------------- /common/source_attributes.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: attribute_structures.F90 3 | ! 4 | ! Purpose: 5 | ! Define variables types which hold the source attribute data. 6 | ! 7 | ! Description and Algorithm details: 8 | ! None 9 | ! 10 | ! Arguments: 11 | ! None 12 | ! 13 | ! History: 14 | ! 2014/12/01, CP: Created a source attribute module using source attributes as 15 | ! a template 16 | ! 2018/02/01, GT: Added L1B version and orbit number strings to attributes. 17 | ! 18 | ! Bugs: 19 | ! None known. 20 | !------------------------------------------------------------------------------- 21 | 22 | module source_attributes_m 23 | 24 | use common_constants_m 25 | 26 | implicit none 27 | 28 | type source_attributes_t 29 | character(len=attribute_length_long) :: albedo_file 30 | character(len=attribute_length_long) :: brdf_file 31 | character(len=attribute_length_long) :: emissivity_file 32 | character(len=attribute_length_long) :: usgs_file 33 | character(len=attribute_length_long) :: snow_file 34 | character(len=attribute_length_long) :: sea_ice_file 35 | character(len=attribute_length_long) :: level1b_file 36 | character(len=attribute_length_long) :: geo_file 37 | character(len=attribute_length) :: level1b_version 38 | character(len=attribute_length) :: level1b_orbit_number 39 | end type source_attributes_t 40 | 41 | end module source_attributes_m 42 | -------------------------------------------------------------------------------- /common/struct_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | NAME: 3 | struct_parser.h 4 | PURPOSE: 5 | Declarations needed by both struct_parser.y and ".lex 6 | HISTORY: 7 | 09 Jun 2016, ACP: Initial version 8 | */ 9 | #ifndef STRUCT_PARSER_H1 10 | #define STRUCT_PARSER_H1 11 | 12 | /* Concatenation macros */ 13 | #ifdef STR 14 | #undef STR 15 | #endif 16 | #define STR(a) #a 17 | 18 | #ifdef XSTR 19 | #undef XSTR 20 | #endif 21 | #define XSTR(a) STR(a) 22 | 23 | #ifdef CAT2 24 | #undef CAT2 25 | #endif 26 | #define CAT2(a, b) STR(a.b) 27 | 28 | #ifdef XCAT2 29 | #undef XCAT2 30 | #endif 31 | #define XCAT2(x, y) CAT2(x, y) 32 | 33 | #ifdef CAT3 34 | #undef CAT3 35 | #endif 36 | #define CAT3(a, b, c) STR(a.b.c) 37 | 38 | #ifdef XCAT3 39 | #undef XCAT3 40 | #endif 41 | #define XCAT3(x, y, z) CAT3(x, y, z) 42 | 43 | #ifdef FCAT 44 | #undef FCAT 45 | #endif 46 | #define FCAT // 47 | 48 | /* A token somewhat too awkward to read from the Fortran source */ 49 | #define MAXSTATEVAR_TOKEN ITS_TOKEN + MAXNUMSOLAR_TOKEN*MAXRHO_XX_TOKEN + \ 50 | MAXNUMVIEWS_TOKEN 51 | #endif 52 | -------------------------------------------------------------------------------- /common/system_utils_c.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Name: system_utils_c.c 3 | * 4 | * Purpose: 5 | * 6 | * History: 7 | * 2015/10/05, GM: Original version. 8 | * 9 | ******************************************************************************/ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | 17 | /******************************************************************************* 18 | * Name: system_utils_match_file 19 | * 20 | * Purpose: 21 | * 22 | * Description and Algorithm details: 23 | * 24 | * Arguments: 25 | * Name : Description 26 | * 27 | * History: 28 | * 2015/10/05, GM: Original version. 29 | * 30 | * Bugs: 31 | * None known. 32 | ******************************************************************************/ 33 | int system_utils_match_file(const char *dir_name, const char *file_regex, 34 | char *file_name, int n) 35 | { 36 | int flag; 37 | 38 | DIR *dir; 39 | struct dirent *entry; 40 | 41 | regex_t regex; 42 | 43 | if ((dir = opendir(dir_name)) == NULL) { 44 | fprintf(stderr, "ERROR: Error opening directory: %s\n", dir_name); 45 | return -1; 46 | } 47 | 48 | if (regcomp(®ex, file_regex, 0)) { 49 | fprintf(stderr, "ERROR: Error compiling regular expression: %s\n", file_regex); 50 | return -1; 51 | } 52 | 53 | flag = 0; 54 | 55 | while ((entry = readdir(dir)) != NULL) { 56 | if (regexec(®ex, entry->d_name, 0, NULL, 0) == 0) { 57 | if (file_name) 58 | strncpy(file_name, entry->d_name, n); 59 | flag = 1; 60 | break; 61 | } 62 | } 63 | 64 | regfree(®ex); 65 | 66 | closedir(dir); 67 | 68 | return flag; 69 | } 70 | -------------------------------------------------------------------------------- /config/arch.conda.inc: -------------------------------------------------------------------------------- 1 | # Directory for object files 2 | OBJS = obj 3 | 4 | # Define Fortran 77 compiler 5 | F77 = $(GFORTRAN) 6 | 7 | # Define Fortran 90 compiler 8 | F90 = $(GFORTRAN) 9 | 10 | # Define C compiler 11 | CC = $(GCC) 12 | 13 | # Define C++ compiler 14 | CXX = $(GXX) 15 | 16 | # Linker already defined by conda environment 17 | 18 | # Set Fortran 77 compiler flags 19 | F77FLAGS = -O3 -cpp -ffree-line-length-0 -g -fcheck=bounds -fallow-argument-mismatch 20 | # Uncomment if extra warnings are required. Take out -Werror if that annoys you. 21 | #FF77LAGS += -Wall -Werror -Wno-conversion -Wno-uninitialized -Wno-unused-dummy-argument -Wtabs 22 | 23 | # Set Fortran 90 compiler flags 24 | FFLAGS = -O3 -cpp -ffree-line-length-0 -g -fcheck=bounds -fallow-argument-mismatch 25 | # Uncomment if OpenMP support is desired. Highly recommented. 26 | FFLAGS += -fopenmp 27 | # Uncomment if extra warnings are required. Take out -Werror if that annoys you. 28 | #FFLAGS += -Wall -Werror -Wno-conversion -Wno-uninitialized -Wno-unused-dummy-argument -Wtabs 29 | 30 | LFLAGS = -fopenmp 31 | 32 | # Set C compiler flags 33 | CFLAGS = -O3 -g 34 | # Uncomment if extra warnings are required. 35 | #CFLAGS += -Wall -Werror 36 | 37 | AUXFLAGS = -J $(OBJS) 38 | 39 | # Set Bison/Flex parser flags 40 | FLEXFLAGS = 41 | BISONFLAGS = 42 | # Uncomment if debugging the parser 43 | #FLEXFLAGS += -d 44 | #BISONFLAGS += -t 45 | -------------------------------------------------------------------------------- /config/arch.gfortran.inc: -------------------------------------------------------------------------------- 1 | # Directory for object files 2 | OBJS = obj 3 | 4 | # Define Fortran 77 compiler 5 | F77 = gfortran 6 | 7 | # Define Fortran 90 compiler 8 | F90 = gfortran 9 | 10 | # Define C compiler 11 | CC = gcc 12 | 13 | # Define C++ compiler 14 | CXX = g++ 15 | 16 | # Define C preprocessor 17 | CPP = cpp 18 | 19 | # Define linker 20 | AR = ar 21 | 22 | # Set Fortran 77 compiler flags 23 | F77FLAGS = -O3 -cpp -ffree-line-length-0 -g 24 | # Uncomment if extra warnings are required. Take out -Werror if that annoys you. 25 | #FF77LAGS += -Wall -Werror -Wno-conversion -Wno-uninitialized -Wno-unused-dummy-argument -Wtabs 26 | 27 | # Set Fortran 90 compiler flags 28 | FFLAGS = -O3 -cpp -ffree-line-length-0 -g 29 | # Uncomment if OpenMP support is desired. Highly recommented. 30 | FFLAGS += -fopenmp 31 | # Uncomment if extra warnings are required. Take out -Werror if that annoys you. 32 | #FFLAGS += -Wall -Werror -Wno-conversion -Wno-uninitialized -Wno-unused-dummy-argument -Wtabs 33 | 34 | LFLAGS = -fopenmp 35 | 36 | # Set C compiler flags 37 | CFLAGS = -O3 -g 38 | # Uncomment if extra warnings are required. 39 | #CFLAGS += -Wall -Werror 40 | 41 | AUXFLAGS = -J $(OBJS) 42 | 43 | # Set Bison/Flex parser flags 44 | FLEXFLAGS = 45 | BISONFLAGS = 46 | # Uncomment if debugging the parser 47 | #FLEXFLAGS += -d 48 | #BISONFLAGS += -t 49 | -------------------------------------------------------------------------------- /config/arch.ifort.inc: -------------------------------------------------------------------------------- 1 | # Directory for object files 2 | OBJS = obj 3 | 4 | # Define Fortran 77 compiler 5 | F77 = ifort 6 | 7 | # Define Fortran 90 compiler 8 | F90 = ifort 9 | 10 | # Define C compiler 11 | CC = icc 12 | 13 | # Define C++ compiler 14 | CXX = icpc 15 | 16 | # Define C preprocessor 17 | CPP = cpp 18 | 19 | # Define linker 20 | AR = ar 21 | 22 | # Set Fortran 77 compiler flags 23 | F77FLAGS = -O3 -cpp -g 24 | 25 | # Set Fortran 90 compiler flags 26 | FFLAGS = -O3 -cpp -g 27 | # Uncomment if OpenMP support is desired 28 | FFLAGS += -qopenmp 29 | 30 | LFLAGS = -lifcore -qopenmp 31 | 32 | # Set C compiler flags 33 | CFLAGS = -O3 -g 34 | 35 | AUXFLAGS = -module $(OBJS) 36 | 37 | # Set Bison/Flex parser flags 38 | FLEXFLAGS = 39 | BISONFLAGS = 40 | # Uncomment if debugging the parser 41 | #FLEXFLAGS += -d 42 | #BISONFLAGS += -t 43 | -------------------------------------------------------------------------------- /config/lib.conda.inc: -------------------------------------------------------------------------------- 1 | # Base directory for all libraries and include files taken from the 2 | # environmental variable CONDA_PREFIX. 3 | 4 | # Set up libraries and includes 5 | LIBS = -L$(CONDA_PREFIX)/lib \ 6 | -lemosR64 -lemos -lfftw3 \ 7 | -lhdfeos -lGctp \ 8 | -leccodes_f90 -leccodes \ 9 | -lmfhdf -lmfhdf_fortran -lmfhdf_fcstub -lhdf \ 10 | -lnetcdff \ 11 | -lnetcdf \ 12 | -lrttov13_coef_io -lrttov13_emis_atlas -lrttov13_hdf \ 13 | -lrttov13_parallel -lrttov13_main -lrttov13_other \ 14 | -lhdf5 -lhdf5_fortran -lhdf5_hl -lhdf5_hl_fortran \ 15 | -lsz \ 16 | -ljpeg -lm -lz -lstdc++ -lblas -llapack 17 | 18 | INC = -I./ \ 19 | -I$(CONDA_PREFIX)/include \ 20 | -I$(CONDA_PREFIX)/mod 21 | 22 | CINC = -I./ \ 23 | -I$(CONDA_PREFIX)/include 24 | 25 | 26 | # Configuration options 27 | 28 | # Uncomment if you want to enable OpenMP for RTTOV computations. 29 | INC += -DINCLUDE_RTTOV_OPENMP 30 | 31 | # Uncomment if ATSR support is desired. 32 | LIBS += -lepr_api 33 | INC += -DINCLUDE_ATSR_SUPPORT 34 | CINC += -DINCLUDE_ATSR_SUPPORT 35 | 36 | # Uncomment if Numerical Recipes is available for cubic spline profile 37 | # interpolation and bilinear LUT interpolation. 38 | LIBS += -lnr 39 | INC += -DINCLUDE_NR 40 | 41 | # Uncomment if Fu_Liou support is desired for broadband fluxes. 42 | LIBS += -lEd3Fu_201212 43 | INC += -DINCLUDE_FU_LIOU_SUPPORT 44 | 45 | # Uncomment if Himawari support is desired. 46 | LIBS += -lhimawari_util 47 | INC += -DINCLUDE_HIMAWARI_SUPPORT 48 | 49 | # Uncomment if SEVIRI support is desired. 50 | LIBS += -lseviri_util 51 | INC += -DINCLUDE_SEVIRI_SUPPORT 52 | 53 | # Uncomment if SEVIRI_ML support is desired. 54 | # Please modify Python -lpython3.X to your Python version. 55 | LIBS += -lsevann -lpython3.10 56 | INC += -DINCLUDE_SEVIRI_NEURALNET 57 | -------------------------------------------------------------------------------- /derived_products/broadband_fluxes/bugsrad/README: -------------------------------------------------------------------------------- 1 | This code was forked from the original BUGSRad source code obtained from: 2 | 3 | http://biocycle.atmos.colostate.edu/shiny/BUGSrad/ 4 | 5 | BUGSRad was originally developed by Dr. Graeme Stephens. Ongoing development and 6 | maintenance has since been performed by: 7 | 8 | Laura D. Fowler (laura@slikrock.atmos.colostate.edu) 9 | Philip Partain (Philip.Partain@colostate.edu) 10 | 11 | The BUGSRad code is considered in the public domain. 12 | -------------------------------------------------------------------------------- /derived_products/broadband_fluxes/bugsrad/bugs_physconst.f90: -------------------------------------------------------------------------------- 1 | 2 | 3 | module bugsrad_physconst 4 | 5 | use kinds 6 | implicit none 7 | private 8 | 9 | ! Physical and math constants 10 | real (kind=dbl_kind), parameter, public :: & 11 | gravity = 9.80665_dbl_kind &! (m s^-2) 12 | ,cp_dry_air = 1.004e+03_dbl_kind &! (J kg^-1 K^-1) 13 | ,R_d = 287.0_dbl_kind &! (J K^-1 kg^-1) 14 | ,R_star = 8.3143e+03_dbl_kind &! (J K^-1 kmol^-1) 15 | ,sol_const = 1.360e+03_dbl_kind &! (W m^-2) 16 | ,P_std = 1.01325e+05_dbl_kind &! (Pa) 17 | ,T_std = 273.15_dbl_kind &! (K) 18 | ,PI = 3.1415926535_dbl_kind &! (-) 19 | ,molar_volume = 2.2421e+4_dbl_kind &! (cm3-atm) 20 | ,N_av = 6.0221367e23 ! (molecules/mol) 21 | 22 | 23 | ! Molecular weights (g/mol) 24 | real (kind=dbl_kind), parameter, public :: & 25 | MW_dry_air = 28.964_dbl_kind & 26 | ,MW_h2o = 18.016_dbl_kind & 27 | ,MW_co2 = 44.010_dbl_kind & 28 | ,MW_o3 = 48.000_dbl_kind & 29 | ,MW_ch4 = 16.042_dbl_kind & 30 | ,MW_n2o = 44.016_dbl_kind 31 | 32 | !Other 33 | integer (kind=int_kind), parameter, public:: & 34 | mbs = 6 !Number of shortwave spectral bands 35 | real (kind=dbl_kind), parameter, public :: & 36 | epsilon = MW_h2o/MW_dry_air & 37 | ,f_virt = (1._dbl_kind - epsilon)/epsilon 38 | 39 | real (kind=dbl_kind), dimension(mbs), parameter, public :: & 40 | ri = (/ 1.19234e-26, 7.6491e-28, 9.0856e-29, 1.97266e-29 & 41 | ,6.13005e-30, 2.06966e-30 /) 42 | 43 | end module bugsrad_physconst 44 | -------------------------------------------------------------------------------- /derived_products/broadband_fluxes/bugsrad/kinds.f90: -------------------------------------------------------------------------------- 1 | 2 | 3 | ! CVS: $Id: kinds.F90,v 1.1 2004/01/26 16:24:44 norm Exp $ 4 | ! CVS: $Name: $ 5 | 6 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 7 | 8 | module kinds 9 | 10 | !*********************************************************************** 11 | ! 12 | ! This module defines variable precision for all common data 13 | ! types. 14 | ! 15 | !----------------------------------------------------------------------- 16 | 17 | implicit none 18 | 19 | !----------------------------------------------------------------------- 20 | 21 | integer, parameter :: char_len = 80, & 22 | int_kind = kind(1), & 23 | log_kind = kind(.true.), & 24 | real_kind = selected_real_kind(6), & 25 | dbl_kind = selected_real_kind(13) !13 for dble 26 | 27 | end module kinds 28 | 29 | !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 30 | -------------------------------------------------------------------------------- /derived_products/broadband_fluxes/bugsrad/newexp.f90: -------------------------------------------------------------------------------- 1 | 2 | 3 | ! CVS: $Id: newexp.F90,v 1.1 2003/11/11 21:55:13 norm Exp $ 4 | ! CVS: $Name: $ 5 | 6 | module newexp 7 | use kinds 8 | contains 9 | 10 | function exp(x) result(val) 11 | !Fast replacement for standard exp() function 12 | implicit none 13 | real (kind = dbl_kind), intent(in) :: x 14 | real (kind=dbl_kind):: & 15 | y1 , y2 , y4 , val 16 | 17 | y1 = 1._dbl_kind - x*(0.2507213_dbl_kind - (x*(0.0292732_dbl_kind - x*0.0038278_dbl_kind))) 18 | y2 = y1*y1 19 | y4 = y2*y2 20 | val = 1._dbl_kind/y4 21 | return 22 | end function exp 23 | 24 | end module newexp 25 | -------------------------------------------------------------------------------- /derived_products/broadband_fluxes/collocate_prtm_profile.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: collocate_prtm_profile.F90 3 | ! 4 | ! Purpose: 5 | ! 6 | ! Inputs: 7 | ! 8 | ! Output: 9 | ! 10 | ! History: 11 | ! xxxx/xx/xx, MC: Initial implementation 12 | ! 13 | ! Bugs: 14 | ! None known. 15 | !------------------------------------------------------------------------------- 16 | 17 | subroutine collocate_prtm_profile(lonval,latval,xdim,ydim,lonarr,latarr,lonid, & 18 | latid) 19 | 20 | implicit none 21 | 22 | ! Input arguments 23 | real, intent(in) :: lonval,latval 24 | integer, intent(in) :: xdim,ydim 25 | real, intent(in), dimension(xdim) :: lonarr 26 | real, intent(in), dimension(ydim) :: latarr 27 | 28 | ! Output arguments 29 | integer, intent(out) :: lonid,latid 30 | 31 | ! Local variables 32 | real, dimension(20) :: all_lonID,all_latID,all_dist 33 | integer :: i,j,ct,minid(1) 34 | 35 | all_lonID(:) = 0.0 36 | all_latID(:) = 0.0 37 | all_dist(:) = 900000. 38 | ct = 1 39 | do i = 1, xdim 40 | if (abs(lonval-lonarr(i)) .lt. 0.5) then 41 | do j = 1, ydim 42 | if (abs(latval-latarr(j)) .lt. 0.5) then 43 | all_lonID(ct) = i 44 | all_latID(ct) = j 45 | all_dist(ct) = sqrt( (lonval-lonarr(i))**2. + (latval-latarr(j))**2.) 46 | ct = ct+1 47 | ! print*,i,j 48 | end if 49 | end do 50 | end if 51 | end do 52 | ! print*,all_lonID(1:ct-1) 53 | ! print*,all_latID(1:ct-1) 54 | ! print*,all_dist(1:ct-1) 55 | minid = minloc(all_dist(1:ct)) 56 | lonid = all_lonID(minid(1)) 57 | latid = all_latID(minid(1)) 58 | 59 | end subroutine collocate_prtm_profile 60 | -------------------------------------------------------------------------------- /derived_products/broadband_fluxes/compute_column_o3.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: compute_column_o3.F90 3 | ! 4 | ! Purpose: 5 | ! Compute column ozone (colO3) from input profile of geopotential height and 6 | ! ozone. The computation is a simple summation of integrated ozone over each 7 | ! layer in the atmosphere. 8 | ! 9 | ! Inputs: 10 | ! geopotential height (km) 11 | ! Ozone (kg/kg) 12 | ! 13 | ! Output: 14 | ! column ozone (DU) 15 | ! 16 | ! History: 17 | ! 2016/02/18, MC: Initial implementation 18 | ! 19 | ! Bugs: 20 | ! None known. 21 | !------------------------------------------------------------------------------- 22 | 23 | subroutine compute_column_o3(nlm,H,O3,colO3) 24 | 25 | implicit none 26 | 27 | ! Input arguments 28 | integer, intent(in) :: nlm 29 | real, intent(in), dimension(nlm+1) :: & 30 | H, & ! height profile at SAT. pixel (hPa). 31 | O3 ! temperature profile at SAT. pixel (kg/kg). 32 | 33 | ! Output arguments 34 | real, intent(out) :: colO3 35 | 36 | ! Local variables 37 | integer :: i 38 | 39 | colO3 = 0. 40 | ! Integrate over each level 41 | do i = 1, nlm-1 42 | ! print*,H(i),H(i)-H(i+1) 43 | colO3 = colO3+((O3(i)+O3(i+1))/2.) * (H(i)-H(i+1))*1000000. 44 | ! print*,((O3(i)+O3(i+1))/2.) * (H(i)-H(i+1)),colO3 45 | end do 46 | 47 | end subroutine compute_column_o3 48 | -------------------------------------------------------------------------------- /derived_products/broadband_fluxes/compute_fth.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: compute_fth.F90 3 | ! 4 | ! Purpose: 5 | ! Compute FTH (free troposphere relative humidity) from input profile of 6 | ! pressure, temperature, and specific humidity. FTH is computed at the 850 hPa 7 | ! level. Vapour pressures for air and saturation are computed from temperature 8 | ! and humidity interpolated to this level. 9 | ! 10 | ! Inputs: 11 | ! temperature (K) 12 | ! pressure (hPa) 13 | ! specific humidity (kg/kg) 14 | ! 15 | ! Output: 16 | ! free troposphere humidity 17 | ! 18 | ! History: 19 | ! 2016/02/18, MC: Initial implementation 20 | ! 21 | ! Bugs: 22 | ! None known. 23 | !------------------------------------------------------------------------------- 24 | 25 | subroutine compute_fth(nlm,P,T,Q,FTH) 26 | 27 | implicit none 28 | 29 | ! Input arguments 30 | integer, intent(in) :: nlm 31 | real, intent(in), dimension(nlm+1) :: & 32 | P, & ! pressure profile at SAT. pixel (hPa). 33 | T, & ! temperature profile at SAT. pixel (K). 34 | Q ! specific humidity profile at SAT. pixel (kg/kg). 35 | 36 | ! Output arguments 37 | real, intent(out) :: FTH 38 | 39 | ! Local variables 40 | real :: m(1),T850(1),Q850(1),Es850(1),E850(1) 41 | integer :: id1(1),id2(1) 42 | real, parameter :: Ep=0.622 43 | 44 | ! Determine Temperature at 850 hPa level 45 | ! Check that the lowest layer pressure > 850 46 | if (maxval(P) .gt. 850.) then 47 | id1 = MINLOC(P,MASK=(P>800)) 48 | id2 = MAXLOC(P,MASK=(P<900)) 49 | 50 | ! Interpolate Temperature 51 | m = (T(id2)-T(id1))/(P(id2)-P(id1)) 52 | T850 = m*850.+T(id1)-m*P(id1) 53 | 54 | ! Interpolate Humidity 55 | m = (Q(id2)-Q(id1))/(P(id2)-P(id1)) 56 | Q850 = m*850.+Q(id1)-m*P(id1) 57 | 58 | E850 = (Q850*850.)/(Ep*(1-Q850)+Q850) 59 | Es850=6.112*EXP( 17.67*(T850-273.) / ( (T850-273.)+243.5 ) ) ![hPa] 60 | FTH = E850(1) / ES850(1) 61 | ! print*,'FTH = ',FTH 62 | end if 63 | 64 | end subroutine compute_fth 65 | -------------------------------------------------------------------------------- /derived_products/broadband_fluxes/compute_lts.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: compute_lts.F90 3 | ! 4 | ! Purpose: 5 | ! Compute LTS (lower troposphere stability) from input profile of pressure, and 6 | ! temperature. LTS is the difference in potential temperature between 700 hPa 7 | ! and the surface. The temperature at 700 hPa level is interpolated using linear 8 | ! slope method (T = mP+b). Surface values are taken to be those at the base 9 | ! level of the profile. 10 | ! 11 | ! Inputs: 12 | ! temperature (K) 13 | ! pressure (hPa) 14 | ! 15 | ! Output: 16 | ! lower troposphere stability (K) 17 | ! 18 | ! History: 19 | ! 2016/02/18, MC: Initial implementation 20 | ! 21 | ! Bugs: 22 | ! None known. 23 | !------------------------------------------------------------------------------- 24 | 25 | subroutine compute_lts(nlm,P,T,LTS) 26 | 27 | implicit none 28 | 29 | ! Input arguments 30 | integer, intent(in) :: nlm 31 | real, intent(in), dimension(nlm+1) :: & 32 | P, & ! pressure profile at SAT. pixel (hPa). 33 | T ! temperature profile at SAT. pixel (K). 34 | 35 | ! Output arguments 36 | real, intent(out) :: LTS 37 | 38 | ! Local variables 39 | real :: m(1),TSFC(1),T700(1),PSFC(1) 40 | real :: thetaSFC(1),theta700(1) 41 | real, parameter :: k=0.286 42 | integer :: id1(1),id2(1) 43 | 44 | PSFC = P(nlm) 45 | TSFC = T(nlm) 46 | 47 | ! Interpolate temperature at 700 hPa level 48 | ! Check that the lowest layer pressure > 850 49 | if (maxval(P) .gt. 850.) then 50 | id1 = MINLOC(P,MASK=(P>600)) 51 | id2 = MAXLOC(P,MASK=(P<800)) 52 | m = (T(id2)-T(id1))/(P(id2)-P(id1)) 53 | T700 = m*700.+T(id1)-m*P(id1) 54 | thetaSFC = TSFC*(1000./PSFC)**k 55 | theta700 = T700*(1000./700.)**k 56 | LTS = theta700(1) - thetaSFC(1) 57 | ! print*,id1,id2,P(id1),P(id2),T(id1),T(id2),m,T700,TSFC,PSFC 58 | ! print*,thetaSFC,theta700,LTS 59 | end if 60 | 61 | end subroutine compute_lts 62 | -------------------------------------------------------------------------------- /derived_products/broadband_fluxes/dependencies.inc: -------------------------------------------------------------------------------- 1 | $(OBJS)/bugs_physconst.o: $(OBJS)/kinds.o 2 | $(OBJS)/continuum.o: $(OBJS)/bugs_physconst.o $(OBJS)/kinds.o 3 | $(OBJS)/bandsolve.o: $(OBJS)/kinds.o 4 | $(OBJS)/bugsrad_planck.o: $(OBJS)/kinds.o 5 | $(OBJS)/gases_ckd.o: $(OBJS)/bugs_physconst.o $(OBJS)/kinds.o 6 | $(OBJS)/rayle.o: $(OBJS)/bugs_physconst.o $(OBJS)/kinds.o 7 | $(OBJS)/bugs_lwr.o: $(OBJS)/bugsrad_planck.o $(OBJS)/continuum.o \ 8 | $(OBJS)/gases_ckd.o $(OBJS)/kinds.o 9 | $(OBJS)/bugs_swr.o: $(OBJS)/gases_ckd.o $(OBJS)/kinds.o $(OBJS)/rayle.o 10 | $(OBJS)/cloud_correlate.o: $(OBJS)/kinds.o 11 | $(OBJS)/cloudg.o: $(OBJS)/kinds.o 12 | $(OBJS)/two_rt_lw.o: $(OBJS)/kinds.o 13 | $(OBJS)/two_rt_lw_iter.o: $(OBJS)/kinds.o 14 | $(OBJS)/two_rt_lw_ocastrndm.o: $(OBJS)/kinds.o 15 | $(OBJS)/two_rt_lw_sel.o: $(OBJS)/kinds.o 16 | $(OBJS)/two_rt_sw_bs.o: $(OBJS)/kinds.o $(OBJS)/bandsolve.o 17 | $(OBJS)/two_rt_sw.o: $(OBJS)/kinds.o 18 | $(OBJS)/two_rt_sw_ocastrndm.o: $(OBJS)/kinds.o 19 | $(OBJS)/comscp1.o: $(OBJS)/kinds.o 20 | $(OBJS)/comscp2.o: $(OBJS)/kinds.o 21 | $(OBJS)/driver_for_bugsrad.o: $(OBJS)/bugs_physconst.o $(OBJS)/kinds.o 22 | $(OBJS)/newexp.o: $(OBJS)/kinds.o 23 | $(OBJS)/bugs_rad.o: $(OBJS)/kinds.o 24 | $(OBJS)/comscp2.o: $(OBJS)/kinds.o 25 | -------------------------------------------------------------------------------- /derived_products/broadband_fluxes/get_modis_aerosol.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: get_modis_aerosol.F90 3 | ! 4 | ! Purpose: 5 | ! 6 | ! Inputs: 7 | ! 8 | ! Output: 9 | ! 10 | ! History: 11 | ! xxxx/xx/xx, MC: Initial implementation 12 | ! 13 | ! Bugs: 14 | ! None known. 15 | !------------------------------------------------------------------------------- 16 | 17 | subroutine get_modis_aerosol(fileIN,Nx,Ny,AREF,AOD550) 18 | 19 | use common_constants_m 20 | 21 | implicit none 22 | 23 | ! Input arguments 24 | character(len=*), intent(in) :: fileIN ! MODIS aerosol file 25 | integer(kind=lint), intent(in) :: Nx,Ny ! Satellite 1-km dimensions 26 | 27 | ! Output arguments 28 | real(kind=sreal), intent(inout) :: AREF(1:Nx,1:Ny) ! MOD04 Aerosol Effective Radius - regrid 29 | real(kind=sreal), intent(inout) :: AOD550(1:Nx,1:Ny) ! MOD04 Aerosol Optical Depth - regrid 30 | 31 | ! Local variables 32 | integer(kind=lint) :: tmpNx,tmpNy 33 | integer(kind=lint) :: ix,jy 34 | integer(kind=lint) :: tmp_ix,tmp_jy 35 | real(kind=sreal) :: xFac,yFac 36 | 37 | real(kind=sreal), allocatable :: pre_AREF(:,:) ! MOD04 Aerosol Effective Radius - orig 38 | real(kind=sreal), allocatable :: pre_AOD550(:,:) ! MOD04 Aerosol Optical Depth - orig 39 | 40 | ! Replace ORAC Aerosol with fill value 41 | AREF = sreal_fill_value 42 | AOD550 = sreal_fill_value 43 | 44 | ! Read dimensions of mod04 45 | call read_hdf_sd_dims(fileIN,'Optical_Depth_Land_And_Ocean',tmpNx,tmpNy) 46 | 47 | !---------------------------------------------------------------------------- 48 | ! MOD04, get MODIS aerosol 49 | !---------------------------------------------------------------------------- 50 | print*,'Fetching MOD04 AEROSOL PROPERTIES' 51 | allocate(pre_AREF(tmpNx,tmpNy)) 52 | allocate(pre_AOD550(tmpNx,tmpNy)) 53 | call read_hdf_sd_data(fileIN,'Optical_Depth_Land_And_Ocean',-1,tmpNx,tmpNy,pre_AOD550) 54 | call read_hdf_sd_data(fileIN,'Effective_Radius_Ocean',1,tmpNx,tmpNy,pre_AREF) 55 | 56 | ! Rebin MOD04 data to match MOD06 resolution 57 | xFac = Nx / (tmpNx-1.) 58 | yFac = Ny / (tmpNy-1.) 59 | do jy=1,nY 60 | do ix=1,nX 61 | tmp_ix=floor((ix+5.)/xFac)+1 62 | tmp_jy=floor((jy+5.)/yFac)+1 63 | AREF(ix,jy)=pre_AREF(tmp_ix,tmp_jy) 64 | AOD550(ix,jy)=pre_AOD550(tmp_ix,tmp_jy) 65 | if (AOD550(ix,jy) .gt. 0. .and. AREF(ix,jy) .le. 0.) AREF(ix,jy)=0.5 66 | end do 67 | end do 68 | 69 | end subroutine get_modis_aerosol 70 | -------------------------------------------------------------------------------- /derived_products/broadband_fluxes/greg2jul.F90: -------------------------------------------------------------------------------- 1 | ! Routines obtained from: 2 | ! www.ccpo.odu.edu/~klinck/SOGOBEC/cruise/timedate/julianday.html 3 | ! Old Dominion University Center for Coastal Physical Oceonography 4 | ! Southern Ocean GLOBE! 5 | ! written by J. Klinck 6 | ! July, 2000. 7 | ! send questions to klinck@ccpo.odu.edu 8 | ! 9 | ! modified to be used in ORAC by Matt Christensen RAL-STFC - 4/11/15 10 | ! 11 | ! convert from gregorian to julian dates 12 | 13 | subroutine greg2jul(year,month,day,jday) 14 | 15 | real jday,jday1,jday2!,fracday,rday 16 | 17 | integer year,month,day!,yearday 18 | ! integer numargs,iargc,ireturn,getarg 19 | 20 | ! character time*8,date*11 21 | ! character string*80 22 | 23 | ! numargs = iargc() 24 | ! 25 | ! if (numargs .ne. 3) then 26 | ! write(*,*) ' incorrect usage. ' 27 | ! write(*,*) ' greg2jul day month year' 28 | ! stop 29 | ! end if 30 | 31 | ! get first command line argument 32 | ! ireturn = getarg(1,string) 33 | ! 34 | ! read(string,*) rday 35 | ! 36 | ! ireturn = getarg(2,string) 37 | ! 38 | ! read(string,*) month 39 | ! 40 | ! ireturn = getarg(3,string) 41 | ! 42 | ! read(string,*) year 43 | ! 44 | ! year = 2008 45 | ! month = 2 46 | ! rday = 10 47 | ! day=ifix(rday) 48 | ! fracday = rday -ifix(rday) 49 | 50 | call modjulianday(day, year, month, 1., jday1) 51 | call modjulianday(0 , year, 1 , 1., jday2) 52 | 53 | ! case study 54 | ! call modjulianday(20, 2008, 12, 1, jday1) 55 | ! call modjulianday(0, 2008, 1, 1, jday2) 56 | jday = jday1-jday2 57 | ! print*,jday 58 | ! write(*,*) day,month,year,jday1,jday2,jday1-jday2 59 | ! 60 | end 61 | 62 | 63 | ! calculate the julian day from day, month, year and fraction of a day 64 | subroutine modjulianday(day, year, month, fracday, jday) 65 | implicit none 66 | ! 67 | real jday, fracday 68 | ! 69 | integer julday,day,month,year,julianday 70 | integer offset 71 | 72 | ! original from HOPS model 73 | data offset /2440000/ 74 | ! 75 | julianday = julday(month, day, year) - offset 76 | ! 77 | jday = julianday + fracday 78 | ! 79 | return 80 | end 81 | 82 | function julday(mm,id,iyyy) 83 | 84 | parameter (igreg=15+31*(10+12*1582)) 85 | 86 | if (iyyy.eq.0) stop 'there is no year zero.' 87 | if (iyyy.lt.0) iyyy=iyyy+1 88 | if (mm.gt.2) then 89 | jy=iyyy 90 | jm=mm+1 91 | else 92 | jy=iyyy-1 93 | jm=mm+13 94 | end if 95 | julday=int(365.25*jy)+int(30.6001*jm)+id+1720995 96 | if (id+31*(mm+12*iyyy).ge.igreg) then 97 | ja=int(0.01*jy) 98 | julday=julday+2-ja+int(0.25*ja) 99 | end if 100 | 101 | return 102 | end 103 | -------------------------------------------------------------------------------- /derived_products/broadband_fluxes/midlatsum1.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: midlatsum1.F90 3 | ! 4 | ! Purpose: 5 | ! 6 | ! Inputs: 7 | ! 8 | ! Output: 9 | ! 10 | ! History: 11 | ! xxxx/xx/xx, MC: Initial implementation 12 | ! 13 | ! Bugs: 14 | ! None known. 15 | !------------------------------------------------------------------------------- 16 | 17 | subroutine midlatsum1(z,P,T,rh2o,ro3,NLS) 18 | 19 | implicit none 20 | 21 | ! Input arguments 22 | integer, intent(in) :: NLS 23 | 24 | ! Output arguments 25 | real, intent(out) :: z(NLS),P(NLS),T(NLS),rh2o(NLS),ro3(NLS) 26 | 27 | ! Local variables 28 | integer :: i 29 | real :: zz(31),PP(31),TT(31),rrho(31),rrh20(31),rrO3(31) 30 | 31 | data zz/0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,& 32 | 12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,& 33 | 22.0,23.0,24.0,25.0,30.0,35.0,40.0,45.0,50.0/ 34 | 35 | data PP/1013.,902.,802.,710.,628.,554.,487.,426.,372.,324.,281.,& 36 | 243.,209.,179.,153.,130.,111.,95.0,81.2,69.5,59.5,51.0,& 37 | 43.7,37.6,32.2,27.7,13.2,6.52,3.33,1.76,.951/ 38 | 39 | data TT/294.,290.,285.,279.,273.,267.,261.,255.,248.,242.,235.,& 40 | 229.,222.,216.,216.,216.,216.,216.,216.,217.,218.,219.,& 41 | 220.,222.,223.,224.,234.,245.,258.,270.,276./ 42 | 43 | data rrho/1.191E+03,1.080E+03,9.757E+02,8.846E+02,7.998E+02,& 44 | 7.211E+02,6.487E+02,5.830E+02,5.225E+02,4.669E+02,& 45 | 4.159E+02,3.693E+02,3.269E+02,2.882E+02,2.464E+02,& 46 | 2.104E+02,1.797E+02,1.535E+02,1.305E+02,1.110E+02,& 47 | 9.453E+01,8.056E+01,6.872E+01,5.867E+01,5.014E+01,& 48 | 4.288E+01,1.322E+01,6.519E+00,3.330E+00,1.757E+00, 9.512E-01/ 49 | 50 | data rrh20/14.,9.3,5.9,3.3,1.9,1.0,.61,.37,.21,.12,.064,.022,.006,& 51 | .0018,.001,7.6E-04,6.4E-04,5.6E-04,5.0E-4,4.9E-04,& 52 | 4.5E-04,5.1E-04,5.1E-04,5.4E-04,6.0E-04,6.7E-04,3.6E-04,& 53 | 1.1E-04,4.3E-05,1.9E-05,6.3E-06/ 54 | 55 | data rrO3/6.0E-05,6.0E-05,6.0E-05,6.2E-05,6.4E-05,6.6E-05,6.9E-05,& 56 | 7.5E-05,7.9E-05,8.6E-05,9.0E-05,1.1E-04,1.2E-04,1.5E-04,& 57 | 1.8E-04,1.9E-04,2.1E-04,2.4E-04,2.8E-04,3.2E-04,3.4E-04,& 58 | 3.6E-04,3.6E-04,3.4E-04,3.2E-04,3.0E-04,2.0E-04,9.2E-05,& 59 | 4.1E-05,1.3E-05,4.3E-06/ 60 | 61 | do i = 1, NLS 62 | z(i) = ZZ(NLS-i+1) 63 | P(i) = PP(NLS-i+1) 64 | T(i) = TT(NLS-i+1) 65 | rh2o(i) = rrh20(NLS-i+1) 66 | ro3(i) = rro3(NLS-i+1) 67 | end do 68 | 69 | end subroutine midlatsum1 70 | -------------------------------------------------------------------------------- /derived_products/broadband_fluxes/read_hdf_sd_dims.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: read_hdf_sd_dims.F90 3 | ! 4 | ! Purpose: 5 | ! 6 | ! Inputs: 7 | ! 8 | ! Output: 9 | ! 10 | ! History: 11 | ! xxxx/xx/xx, MC: Initial implementation 12 | ! 13 | ! Bugs: 14 | ! None known. 15 | !------------------------------------------------------------------------------- 16 | 17 | subroutine read_hdf_sd_dims(filename,SDS_name,nX,nY) 18 | 19 | use common_constants_m 20 | use hdf_m, only: DFACC_READ 21 | 22 | implicit none 23 | 24 | ! Input arguments 25 | character(len=*), intent(in) :: filename 26 | character(len=*), intent(in) :: SDS_name 27 | 28 | ! Output arguments 29 | integer(kind=lint), intent(out) :: nX,nY 30 | 31 | ! Local variables 32 | integer :: fid 33 | integer :: err_code 34 | integer :: var_id 35 | integer(kind=lint) :: dummy_type,dummy_numattrs,dummy_rank 36 | integer, dimension(2) :: dimsizes 37 | character(len=MAX_NC_NAME) :: dummy_name 38 | 39 | integer(kind=4), external :: sfstart,sfselect,sfginfo,sfn2index 40 | integer(kind=4), external :: sfendacc,sfend 41 | 42 | ! Get file id 43 | fid = sfstart(filename,DFACC_READ) 44 | 45 | var_id = sfselect(fid, sfn2index(fid, SDS_name)) 46 | 47 | err_code = sfginfo(var_id,dummy_name,dummy_rank,dimsizes,dummy_type, & 48 | dummy_numattrs) 49 | 50 | ! Read from netCDF file 51 | nX=int(dimsizes(1)) 52 | nY=int(dimsizes(2)) 53 | 54 | err_code=sfendacc(var_id) 55 | 56 | ! End access to hdfile 57 | err_code=sfend(fid) 58 | 59 | ! print*,'var_id: ',var_id 60 | ! print*,'name: ',trim(dummy_name) 61 | ! print*,'rank: ',dummy_rank 62 | ! print*,'dimensions: ',dimsizes 63 | ! print*,'type: ',dummy_type 64 | ! print*,'numattrs: ',dummy_numattrs 65 | 66 | end subroutine read_hdf_sd_dims 67 | -------------------------------------------------------------------------------- /docs/README: -------------------------------------------------------------------------------- 1 | Documentation for ORAC is now managed through a Wiki system, found at: 2 | 3 | http://proj.badc.rl.ac.uk/orac/wiki 4 | -------------------------------------------------------------------------------- /feedstocks/conda_build_config.yaml: -------------------------------------------------------------------------------- 1 | c_compiler: 2 | - gcc 3 | c_compiler_version: 4 | - 11 5 | - 13 6 | # - 12 7 | # HDF4 won't compile with GNU14 8 | cxx_compiler: 9 | - gxx 10 | cxx_compiler_version: 11 | - 11 12 | - 13 13 | # - 12 14 | channel_sources: 15 | - local,conda-forge 16 | fortran_compiler: 17 | - gfortran 18 | fortran_compiler_version: 19 | - 11 20 | - 13 21 | # - 12 22 | 23 | fftw: 24 | - 3 25 | hdf5: 26 | # part of a zip_keys: c_compiler_version, cxx_compiler_version, 27 | # fortran_compiler_version, hdf5, libtiff, netcdf_fortran 28 | - 1.12.1 29 | - 1.12.2 30 | # - 1.12.2 31 | libnetcdf: 32 | - 4.8.1 33 | libtiff: 34 | # part of a zip_keys: c_compiler_version, cxx_compiler_version, 35 | # fortran_compiler_version, hdf5, libtiff, netcdf_fortran 36 | - 4.3.0 37 | - 4.5.0 38 | # - 4.5.0 39 | mpi: 40 | - nompi 41 | - openmpi 42 | netcdf_fortran: 43 | # part of a zip_keys: c_compiler_version, cxx_compiler_version, 44 | # fortran_compiler_version, hdf5, libtiff, netcdf_fortran 45 | - 4.5.4 46 | - 4.6.0 47 | # - 4.6.0 48 | numpy: 49 | # part of a zip_keys: python, numpy, scipy 50 | - 1.21.6 51 | - 1.22.3 52 | - 1.26.4 53 | # - 1.22.3 54 | # - 1.24.4 55 | # - 1.22.3 56 | # - 1.26.4 57 | openmpi: 58 | - 4 59 | perl: 60 | - 5.32.1 61 | python: 62 | # part of a zip_keys: python, numpy, scipy 63 | - 3.7.* *_cpython 64 | - 3.10.* *_cpython 65 | - 3.10.* *_cpython 66 | # - 3.8.* *_cpython 67 | # - 3.8.* *_cpython 68 | # - 3.9.* *_cpython 69 | # - 3.9.* *_cpython 70 | python_impl: 71 | - cpython 72 | scipy: 73 | # part of a zip_keys: python, numpy, scipy 74 | - 1.7.3 75 | - 1.8.1 76 | - 1.14.0 77 | # - 1.8.1 78 | # - 1.10.1 79 | # - 1.8.1 80 | # - 1.13.1 81 | zlib: 82 | - 1.2.11 83 | 84 | # Tie the versions together 85 | zip_keys: 86 | - 87 | - c_compiler_version 88 | - cxx_compiler_version 89 | - fortran_compiler_version 90 | - hdf5 91 | - libtiff 92 | - netcdf_fortran 93 | - 94 | - python 95 | - numpy 96 | - scipy 97 | -------------------------------------------------------------------------------- /feedstocks/dependencies.nompi.yml: -------------------------------------------------------------------------------- 1 | # This file may be used to create an environment using: 2 | # $ conda create --name --file 3 | # platform: linux-64 4 | name: orac_git 5 | channels: 6 | - local 7 | - conda-forge 8 | dependencies: 9 | - gcc_linux-64 10 | - gxx_linux-64 11 | - gfortran_linux-64 12 | - bison 13 | - flex 14 | - fftw * nompi_* 15 | - nr * nompi_* 16 | - epr_api 17 | - fu_liou 18 | - hdfeos2 * fortran_* 19 | - hdf5 * nompi_* 20 | - libnetcdf * nompi_* 21 | - netcdf-fortran * nompi_* 22 | - eccodes 23 | - seviri_util 24 | - hsd_reader * nompi_* 25 | - libemos 26 | - rttov * nompi_* 27 | - numpy 28 | - scipy 29 | - netcdf4 30 | - h5py 31 | - cftime 32 | - opencv 33 | - matplotlib 34 | - cartopy 35 | -------------------------------------------------------------------------------- /feedstocks/dependencies.openmpi.yml: -------------------------------------------------------------------------------- 1 | # This file may be used to create an environment using: 2 | # $ conda create --name --file 3 | # platform: linux-64 4 | name: orac_git 5 | channels: 6 | - local 7 | - conda-forge 8 | dependencies: 9 | - gcc_linux-64 10 | - gxx_linux-64 11 | - gfortran_linux-64 12 | - bison 13 | - flex 14 | - fftw * mpi_openmpi_* 15 | - nr * mpi_openmpi_* 16 | - epr_api 17 | - fu_liou 18 | - hdfeos2 * fortran_* 19 | - hdf5 * mpi_openmpi_* 20 | - libnetcdf * mpi_openmpi_* 21 | - netcdf-fortran * mpi_openmpi_* 22 | - eccodes 23 | - seviri_util 24 | - hsd_reader * mpi_openmpi_* 25 | - libemos 26 | - rttov * mpi_openmpi_* 27 | - numpy 28 | - scipy 29 | - netcdf4 30 | - h5py 31 | - cftime 32 | - opencv 33 | - matplotlib 34 | - cartopy 35 | -------------------------------------------------------------------------------- /feedstocks/epr_api/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Use CMake rather than the default file from the repository 6 | rm -rf makefile 7 | rm -rf build 8 | mkdir -vp build 9 | cd build 10 | 11 | cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ 12 | -DCMAKE_LIBRARY_PATH="${PREFIX}/lib" \ 13 | -DCMAKE_BUILD_TYPE="Release" \ 14 | -DCMAKE_C_FLAGS="-fPIC -w" \ 15 | -DBUILD_TESTS="yes" \ 16 | -G "Unix Makefiles" -Wno-dev ${CMAKE_ARGS} .. 17 | 18 | make -j ${CPU_COUNT} 19 | make test 20 | make install -j ${CPU_COUNT} 21 | -------------------------------------------------------------------------------- /feedstocks/epr_api/makefile.patch: -------------------------------------------------------------------------------- 1 | Subject: Anaconda compilers are defined through environment variables. 2 | diff -upN epr-api_git/makefile epr_api/makefile 3 | --- epr-api_git/makefile 2017-09-22 11:54:53.418131229 +0100 4 | +++ epr_api/makefile 2019-02-04 14:02:32.635636955 +0000 5 | @@ -16,7 +16,7 @@ OUTDIR = ./build/$(CONFIG) 6 | 7 | # for linux 8 | COMPILE = $(CC) $(CFLAGS) -fPIC -ansi -c -I$(SRCDIR) -I$(THISDIR) $(OPTIONS) 9 | -LINK = ld -shared 10 | +LINK = $(LD) -shared 11 | TARGET = $(OUTDIR)/libepr_api.so 12 | 13 | # for Mac OS X 14 | -------------------------------------------------------------------------------- /feedstocks/epr_api/meta.yaml: -------------------------------------------------------------------------------- 1 | {% set version = "2.3" %} 2 | 3 | package: 4 | name: epr_api 5 | version: {{ version }} 6 | 7 | source: 8 | git_url: https://github.com/bcdev/epr-api 9 | patches: 10 | - makefile.patch 11 | 12 | build: 13 | number: 1 14 | run_exports: 15 | - {{ pin_subpackage('epr_api', max_pin='x.x') }} 16 | 17 | requirements: 18 | build: 19 | - {{ compiler('c') }} 20 | - cmake 21 | 22 | test: 23 | requires: 24 | - {{ compiler('c') }} 25 | files: 26 | - write_bands.c 27 | commands: 28 | # TODO: Use epr_api/test.sh 29 | - test -f ${PREFIX}/lib/libepr_api.a 30 | - ${GCC} -o example -I${PREFIX}/include write_bands.c -L${PREFIX}/lib -lepr_api 31 | 32 | about: 33 | home: http://github.com/bcdev/epr-api 34 | license: GPL 35 | summary: 'Library supporting products of the ESA ENVISAT satellite' 36 | 37 | extra: 38 | recipe-maintainers: 39 | - orac_cc 40 | -------------------------------------------------------------------------------- /feedstocks/fu_liou/CERESRadiativeTransferModel-OS.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ORAC-CC/orac/4d55dbb924017fcccbed3c03dd130d0ba9d96f2c/feedstocks/fu_liou/CERESRadiativeTransferModel-OS.pdf -------------------------------------------------------------------------------- /feedstocks/fu_liou/ar.patch: -------------------------------------------------------------------------------- 1 | Subject: Use the conda linker rather than the system's 2 | --- a/Ed4_LaRC_FuLiou/lib/src/Makefile 2014-03-07 14:26:48.000000000 +0000 3 | +++ b/Ed4_LaRC_FuLiou/lib/src/Makefile 2023-02-10 15:59:03.635360677 +0000 4 | @@ -52,7 +52,7 @@ INC_FLAG = 5 | all: $(FULIB) 6 | 7 | $(FULIB): $(OBJS) $(OBJS_F) $(OBJS_C) 8 | - ar -rcv $(FULIB) $(OBJS) $(OBJS_F) $(OBJS_C) 9 | + ${AR} -rcv $(FULIB) $(OBJS) $(OBJS_F) $(OBJS_C) 10 | -\cp *.mod ../mod 11 | -\cp $(FULIB) ../ 12 | tidy: 13 | -------------------------------------------------------------------------------- /feedstocks/fu_liou/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | export F77="${GFORTRAN}" 6 | export F90="${GFORTRAN}" 7 | 8 | # They use a non-standard name for the compilation flags 9 | export F90COMP="${FFLAGS} -c -w" 10 | export FCOMP="${FORTRANFLAGS} -c -w" 11 | 12 | # They use implicit casting, which newer gfortran doesn't allow 13 | cat > optiontest.f90 < /dev/null && FCOMP="${FCOMP} -fallow-argument-mismatch" \ 18 | && F90COMP="${F90COMP} -fallow-argument-mismatch" 19 | rm optiontest.f90 20 | 21 | mkdir "${PREFIX}/include" 22 | 23 | cd Ed4_LaRC_FuLiou 24 | make libsrc 25 | 26 | mv lib/*.a ${PREFIX}/lib 27 | mv lib/mod/*.mod ${PREFIX}/include 28 | -------------------------------------------------------------------------------- /feedstocks/fu_liou/meta.yaml: -------------------------------------------------------------------------------- 1 | {% set version = "4.0.0" %} 2 | 3 | package: 4 | name: fu_liou 5 | version: {{ version }} 6 | 7 | source: 8 | - url: https://cloudsgate2.larc.nasa.gov/fuliou/LFLCODE/Ed4_LaRC_FuLiou201501.tar.gz 9 | sha256: 85840956d4bd70b2c76d50bb795acaa4d9ac4cc92ce517e906928fcbb947bfbc 10 | patches: 11 | - block.patch 12 | - ar.patch 13 | 14 | build: 15 | number: 0 16 | run_exports: 17 | - {{ pin_subpackage('fu_liou', max_pin='x.x.x') }} 18 | 19 | requirements: 20 | build: 21 | - {{ compiler('fortran') }} 22 | - make 23 | 24 | test: 25 | requires: 26 | - {{ compiler('fortran') }} 27 | source_files: 28 | - Ed4_LaRC_FuLiou/testatms 29 | - Ed4_LaRC_FuLiou/src/simple/simple.f90 30 | files: 31 | simple.txt 32 | 33 | about: 34 | home: https://www-cave.larc.nasa.gov/cgi-bin/lflcode/accesslfl.cgi 35 | license: OTHER 36 | license_file: CERESRadiativeTransferModel-OS.pdf 37 | summary: "Computers broadband shortwave and longwave profiles of flux" 38 | 39 | extra: 40 | recipe-maintainers: 41 | - orac_cc 42 | -------------------------------------------------------------------------------- /feedstocks/fu_liou/run_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd Ed4_LaRC_FuLiou/src/simple 5 | ${GFORTRAN} ${FFLAGS} -c -w -I${CONDA_PREFIX}/include simple.f90 6 | ${GFORTRAN} ${FFLAGS} -o simple simple.o ${CONDA_PREFIX}/lib/libEd3Fu_201212.a 7 | ./simple > test_result 8 | cmp -s test_result ../../../simple.txt 9 | -------------------------------------------------------------------------------- /feedstocks/hdfeos2/0001-fix-automake-files-for-linux-compatibility.patch: -------------------------------------------------------------------------------- 1 | From f173ecba7134c10824487edeeb8d28c86cfb64be Mon Sep 17 00:00:00 2001 2 | From: Michael Sarahan 3 | Date: Thu, 30 Nov 2017 22:11:20 -0600 4 | Subject: [PATCH] fix automake files for linux compatibility 5 | 6 | --- 7 | configure.ac | 29 +++++++++++++++++++++++++++++ 8 | src/Makefile.am | 9 ++++++++- 9 | 2 files changed, 37 insertions(+), 1 deletion(-) 10 | 11 | diff --git a/configure.ac b/configure.ac 12 | index 921f90f..aed32b9 100755 13 | --- a/configure.ac 14 | +++ b/configure.ac 15 | @@ -20,6 +20,35 @@ AC_DISABLE_SHARED 16 | AM_PROG_LIBTOOL 17 | 18 | 19 | +# AC_CANONICAL_HOST is needed to access the 'host_os' variable 20 | +AC_CANONICAL_HOST 21 | + 22 | +build_linux=no 23 | +build_windows=no 24 | +build_mac=no 25 | + 26 | +# Detect the target system 27 | +case "${host_os}" in 28 | +linux*) 29 | +build_linux=yes 30 | +;; 31 | +cygwin*|mingw*) 32 | +build_windows=yes 33 | +;; 34 | +darwin*) 35 | +build_mac=yes 36 | +;; 37 | +*) 38 | +AC_MSG_ERROR(["OS $host_os is not supported"]) 39 | +;; 40 | +esac 41 | + 42 | +# Pass the conditionals to automake 43 | +AM_CONDITIONAL([LINUX], [test "$build_linux" = "yes"]) 44 | +AM_CONDITIONAL([WINDOWS], [test "$build_windows" = "yes"]) 45 | +AM_CONDITIONAL([OSX], [test "$build_mac" = "yes"]) 46 | + 47 | + 48 | dnl -------------------------------------------------- 49 | dnl Set prefix default (install directory) to a directory 50 | dnl in the build area. 51 | diff --git a/src/Makefile.am b/src/Makefile.am 52 | index f87d373..65036b8 100755 53 | --- a/src/Makefile.am 54 | +++ b/src/Makefile.am 55 | @@ -6,7 +6,14 @@ include $(top_srcdir)/config/include.am 56 | INCLUDES=-I$(top_srcdir)/include/ 57 | 58 | # Set LDFLAGS to alow the HDF-EOS library to use extern variables from HDF4 59 | -LDFLAGS=-Wl,-single_module 60 | +if LINUX 61 | +LDFLAGS+= -shrext .so 62 | +LIBS+= -lm 63 | +endif 64 | + 65 | +if OSX 66 | +LDFLAGS+= -Wl,-single_module 67 | +endif 68 | 69 | # Build HDF-EOS2 70 | lib_LTLIBRARIES=libhdfeos.la 71 | -- 72 | 2.11.1 73 | -------------------------------------------------------------------------------- /feedstocks/hdfeos2/SWapi.patch: -------------------------------------------------------------------------------- 1 | Subject: Fix use of uninitialised pointer. 2 | diff -upN hdfeos/src/SWapi.c hdfeos2/src/SWapi.c 3 | --- a/src/SWapi.c 2019-02-11 13:01:30.721040054 +0000 4 | +++ b/src/SWapi.c 2019-02-11 12:55:20.371945678 +0000 5 | @@ -13976,7 +13976,7 @@ SWllmapedidxinfo(int32 swathID, const ch 6 | char dimname0[HDFE_DIMBUFSIZE],dimname1[HDFE_DIMBUFSIZE]; 7 | char geodim[256]; /* Geolocation field dimension list */ 8 | char geodimbuf[256];/* Geolocation field dimension list */ 9 | - int32 nDim; /* Number of dimensions */ 10 | + int32 nDim, nDim2; /* Number of dimensions */ 11 | int32 slen[64],slen2[64]; /* String length array */ 12 | char *ptr[64],*ptr2[64]; /* String pointer array */ 13 | int32 dumdims[8]; /* Dimensions from SWfieldinfo */ 14 | @@ -14019,7 +14019,7 @@ SWllmapedidxinfo(int32 swathID, const ch 15 | index[iDim] = 0; 16 | } 17 | 18 | - for(iDim=0; iDim<8; iDim++) 19 | + for(iDim=0; iDim optiontest.f90 < /dev/null && export FFLAGS="${FFLAGS} -fallow-argument-mismatch" 11 | rm optiontest.f90 12 | 13 | mkdir build 14 | cd build 15 | cmake -DCMAKE_PREFIX_PATH:PATH="${PREFIX}" \ 16 | -DCMAKE_INSTALL_PREFIX:PATH="${PREFIX}" \ 17 | -DBUILD_SHARED_LIBS:BOOL=OFF \ 18 | -DUSE_SHARED_LIBS:BOOL=OFF \ 19 | -DBUILD_TESTING:BOOL=ON \ 20 | -DHDFEOS_PACKAGE_EXT:STRING="" \ 21 | -DHDFEOS_BUILD_SAMPLES:BOOL=ON \ 22 | -DHDFEOS_BUILD_TESTDRIVERS:BOOL=ON \ 23 | -DHDFEOS_ENABLE_JPEG_LIB_SUPPORT:BOOL=ON \ 24 | -DHDFEOS_ENABLE_Z_LIB_SUPPORT:BOOL=ON \ 25 | -DHDFEOS_ENABLE_SZIP_SUPPORT:BOOL=ON \ 26 | -DHDFEOS_ENABLE_SZIP_ENCODING:BOOL=ON \ 27 | -DHDFEOS_DISABLE_COMPILER_WARNINGS:BOOL=OFF \ 28 | -DHDFEOS_ENABLE_PARALLEL:BOOL=OFF \ 29 | -DHDFEOS_BUILD_FORTRAN:BOOL=ON \ 30 | -DHDFEOS_PACKAGE_EXTLIBS:BOOL=OFF \ 31 | -DHDFEOS_ALLOW_EXTERNAL_SUPPORT:BOOL=NO \ 32 | -DHDF4_PACKAGE_NAME:STRING="hdf4" \ 33 | -DZLIB_PACKAGE_NAME:STRING="zlib" \ 34 | -DSZIP_PACKAGE_NAME:STRING="sz" \ 35 | -DJPEG_PACKAGE_NAME:STRING="jpeg" \ 36 | -G "Unix Makefiles" -Wno-dev ${CMAKE_ARGS} .. 37 | 38 | make -j ${CPU_COUNT} 39 | make test 40 | make install 41 | -------------------------------------------------------------------------------- /feedstocks/hdfeos2/cacheinit.hdfeos.cmake: -------------------------------------------------------------------------------- 1 | # This is the CMakeCache file. 2 | 3 | ######################## 4 | # EXTERNAL cache entries 5 | ######################## 6 | 7 | SET (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE) 8 | 9 | SET (USE_SHARED_LIBS ON CACHE BOOL "Use Shared Libraries" FORCE) 10 | 11 | SET (BUILD_TESTING ON CACHE BOOL "Build HDFEOS Unit Testing" FORCE) 12 | 13 | SET (HDFEOS_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE) 14 | 15 | SET (HDFEOS_BUILD_SAMPLES ON CACHE BOOL "Build HDFEOS Library Samples" FORCE) 16 | 17 | SET (HDFEOS_BUILD_TESTDRIVERS ON CACHE BOOL "Build HDFEOS Testdrivers" FORCE) 18 | 19 | SET (HDFEOS_ENABLE_JPEG_LIB_SUPPORT ON CACHE BOOL "Enable Jpeg library" FORCE) 20 | 21 | SET (HDFEOS_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE) 22 | 23 | SET (HDFEOS_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE) 24 | 25 | SET (HDFEOS_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE) 26 | 27 | SET (HDFEOS_DISABLE_COMPILER_WARNINGS ON CACHE BOOL "Disable compiler warnings" FORCE) 28 | 29 | SET (HDFEOS_ENABLE_PARALLEL OFF CACHE BOOL "Enable parallel build (requires MPI)" FORCE) 30 | 31 | SET (HDFEOS_BUILD_FORTRAN ON CACHE BOOL "Enable fortran for Programs" FORCE) 32 | 33 | SET (HDFEOS_PACKAGE_EXTLIBS OFF CACHE BOOL "(WINDOWS)CPACK - include external libraries" FORCE) 34 | 35 | SET (HDFEOS_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building" FORCE) 36 | 37 | SET (HDF4_PACKAGE_NAME "hdf4" CACHE STRING "Name of HDF4 package" FORCE) 38 | 39 | SET (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE) 40 | 41 | SET (SZIP_PACKAGE_NAME "sz" CACHE STRING "Name of SZIP package" FORCE) 42 | 43 | SET (JPEG_PACKAGE_NAME "jpeg" CACHE STRING "Name of JPEG package" FORCE) 44 | -------------------------------------------------------------------------------- /feedstocks/hdfeos2/cmake.patch: -------------------------------------------------------------------------------- 1 | Subject: Repairs to the cmake build 2 | --- a/CMakeLists.txt 2014-02-06 16:09:40.000000000 +0000 3 | +++ b/CMakeLists.txt 2019-10-17 17:26:44.410294417 +0100 4 | @@ -480,4 +480,5 @@ 5 | SET (HDF4_INCLUDE_DIR_GEN ${HDF4_INCLUDE_DIR}${HDF_PACKAGE_EXT}) 6 | SET (HDF4_INCLUDE_DIRS ${HDF4_INCLUDE_DIR}) 7 | + SET (HDF4_LIBRARIES "mfhdf;mfhdf_fortran;mfhdf_fcstub;hdf;hdf_fcstub;jpeg;sz;z") 8 | ELSE (HDF4_FOUND) 9 | IF (HDFEOS_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDFEOS_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") 10 | --- a/config/cmake/ConfigureChecks.cmake 2014-02-06 16:09:46.000000000 +0000 11 | +++ b/config/cmake/ConfigureChecks.cmake 2019-10-17 17:23:17.632382556 +0100 12 | @@ -218,5 +218,5 @@ 13 | SET (EOS_EXTRA_FLAGS -D_BSD_SOURCE) 14 | ELSE (CYGWIN) 15 | - SET (EOS_EXTRA_FLAGS -D_POSIX_SOURCE -D_BSD_SOURCE) 16 | + SET (EOS_EXTRA_FLAGS -D_POSIX_SOURCE -D_DEFAULT_SOURCE) 17 | ENDIF (CYGWIN) 18 | OPTION (EOS_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON) 19 | --- a/samples/CMakeLists.txt 2014-02-06 16:10:13.000000000 +0000 20 | +++ b/samples/CMakeLists.txt 2019-10-17 17:09:50.588011736 +0100 21 | @@ -8,4 +8,5 @@ 22 | ${HDFEOS_SRC_BINARY_DIR} 23 | ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} 24 | + $ENV{PREFIX}/lib 25 | ) 26 | 27 | --- a/src/CMakeLists.txt 2014-02-06 16:10:13.000000000 +0000 28 | +++ b/src/CMakeLists.txt 2019-10-17 17:09:50.588011736 +0100 29 | @@ -8,4 +8,5 @@ 30 | ${HDFEOS_SRC_BINARY_DIR} 31 | ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} 32 | + $ENV{PREFIX}/lib 33 | ) 34 | 35 | @@ -32,5 +33,5 @@ 36 | IF (MSVC) 37 | TARGET_LINK_LIBRARIES (${HDFEOS_SRC_LIB_TARGET} "ws2_32.lib") 38 | -ELSE (MSVC) 39 | +ELSEIF (APPLE) 40 | SET_TARGET_PROPERTIES (${HDFEOS_SRC_LIB_TARGET} PROPERTIES LINK_FLAGS "-Wl,-single_module") 41 | ENDIF (MSVC) 42 | --- a/gctp/src/CMakeLists.txt 2014-02-06 16:10:13.000000000 +0000 43 | +++ b/gctp/src/CMakeLists.txt 2019-10-17 17:09:50.588011736 +0100 44 | @@ -8,4 +8,5 @@ 45 | ${GCTP_SRC_BINARY_DIR} 46 | ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} 47 | + $ENV{PREFIX}/lib 48 | ) 49 | 50 | -------------------------------------------------------------------------------- /feedstocks/hdfeos2/meta.yaml: -------------------------------------------------------------------------------- 1 | {% set version = "2.20" %} 2 | {% set build = 1 %} 3 | 4 | package: 5 | name: hdfeos2 6 | version: {{ version }} 7 | 8 | source: 9 | # links can obtained from https://wiki.earthdata.nasa.gov/display/DAS/Toolkit+Downloads 10 | #- url: https://git.earthdata.nasa.gov/rest/git-lfs/storage/DAS/hdfeos/cb0f900d2732ab01e51284d6c9e90d0e852d61bba9bce3b43af0430ab5414903?response-content-disposition=attachment%3B%20filename%3D%22HDF-EOS2.20v1.00.tar.Z%22%3B%20filename*%3Dutf-8%27%27HDF-EOS2.20v1.00.tar.Z 11 | # sha256: cb0f900d2732ab01e51284d6c9e90d0e852d61bba9bce3b43af0430ab5414903 12 | #- url: https://git.earthdata.nasa.gov/rest/git-lfs/storage/DAS/hdfeos/21bdbcd977c11b5a1779a82aebc0338b4adbc94107329e2c917a274924c20c5a?response-content-disposition=attachment%3B%20filename%3D%22HDF-EOS2.20v1.00_TestDriver.tar.Z%22%3B%20filename*%3Dutf-8%27%27HDF-EOS2.20v1.00_TestDriver.tar.Z 13 | # sha256: 21bdbcd977c11b5a1779a82aebc0338b4adbc94107329e2c917a274924c20c5a 14 | # Use my copy to avoid problem patching read-only files 15 | - url: https://eodg.atm.ox.ac.uk/user/povey/HDF-EOS2.20v1.00.tar.Z 16 | sha256: 97c3576067c16ae4f31b5e97d8626b34bfde09b2db55bfa73a9e67ba132d04bf 17 | patches: 18 | - cmake.patch 19 | - string.patch 20 | - SWapi.patch 21 | # https://lists.gnu.org/archive/html/guix-devel/2016-09/msg02110.html 22 | - 0001-fix-automake-files-for-linux-compatibility.patch 23 | - url: https://eodg.atm.ox.ac.uk/user/povey/HDF-EOS2.20v1.00_TestDriver.tar.Z 24 | sha256: 3fbc3197dea1f5e4e57622aa039ad7438bfc15a174a8b71fb1460a58f316d644 25 | patches: 26 | - test.patch 27 | 28 | build: 29 | number: {{ build }} 30 | string: fortran_h{{ PKG_HASH }}_{{ build }} 31 | run_exports: 32 | - {{ pin_subpackage('hdfeos2', max_pin='x.x') }} 33 | 34 | requirements: 35 | build: 36 | - {{ compiler('c') }} 37 | - {{ compiler('cxx') }} 38 | - {{ compiler('fortran') }} 39 | - make # [not win] 40 | - cmake 41 | host: 42 | - hdf4 43 | - hdf4 * fortran_* 44 | - zlib 45 | - libaec 46 | - jpeg 47 | run: 48 | - hdf4 * fortran_* 49 | - zlib 50 | - libaec 51 | - jpeg 52 | 53 | test: 54 | commands: 55 | - test -f ${PREFIX}/lib/libGctp.a # [not win] 56 | - test -f ${PREFIX}/lib/libhdfeos.a # [not win] 57 | 58 | about: 59 | home: http://hdfeos.org/index.php 60 | license: PUBLIC-DOMAIN 61 | summary: 'Earth Observing System HDF' 62 | 63 | extra: 64 | recipe-maintainers: 65 | - ocefpaf 66 | - jhamman 67 | - orac_cc 68 | -------------------------------------------------------------------------------- /feedstocks/hdfeos2/test.patch: -------------------------------------------------------------------------------- 1 | Subject: Repairs to the cmake build 2 | --- a/testdrivers/grid/CMakeLists.txt 2014-02-06 16:10:13.000000000 +0000 3 | +++ b/testdrivers/grid/CMakeLists.txt 2019-10-17 17:09:50.588011736 +0100 4 | @@ -8,4 +8,5 @@ 5 | ${HDFEOS_SRC_BINARY_DIR} 6 | ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} 7 | + $ENV{PREFIX}/lib 8 | ) 9 | 10 | --- a/testdrivers/point/CMakeLists.txt 2014-02-06 16:10:13.000000000 +0000 11 | +++ b/testdrivers/point/CMakeLists.txt 2019-10-17 17:09:50.588011736 +0100 12 | @@ -8,4 +8,5 @@ 13 | ${HDFEOS_SRC_BINARY_DIR} 14 | ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} 15 | + $ENV{PREFIX}/lib 16 | ) 17 | 18 | --- a/testdrivers/swath/CMakeLists.txt 2014-02-06 16:10:13.000000000 +0000 19 | +++ b/testdrivers/swath/CMakeLists.txt 2019-10-17 17:09:50.588011736 +0100 20 | @@ -8,4 +8,5 @@ 21 | ${HDFEOS_SRC_BINARY_DIR} 22 | ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} 23 | + $ENV{PREFIX}/lib 24 | ) 25 | 26 | -------------------------------------------------------------------------------- /feedstocks/hsd_reader/Makefile: -------------------------------------------------------------------------------- 1 | #******************************************************************************% 2 | # * 3 | # * Copyright (C) 2016-2018 Simon Proud 4 | # * 5 | # * This source code is licensed under the GNU General Public License (GPL), 6 | # * Version 3. See the file COPYING for more details. 7 | # * 8 | # ****************************************************************************** 9 | 10 | .SUFFIXES: .c .f90 11 | 12 | include make.inc 13 | 14 | OBJECTS = himawari.o \ 15 | himawari_headerinfo.o \ 16 | himawari_readheader.o \ 17 | himawari_utils.o \ 18 | himawari_nav.o \ 19 | himawari_readwrite.o 20 | 21 | SOLOBS = solpos.o 22 | 23 | 24 | all: solar.a \ 25 | AHI \ 26 | libhimawari_util.a 27 | 28 | solar.a: $(SOLOBS) 29 | $(AR) -rs solar_util.a $(SOLOBS) 30 | 31 | libhimawari_util.a: $(OBJECTS) $(SOLOBS) 32 | $(AR) -rs libhimawari_util.a $(OBJECTS) $(SOLOBS) 33 | 34 | AHI: himawari.o himawari_headerinfo.o himawari_readheader.o himawari_utils.o himawari_nav.o himawari_readwrite.o AHI_Example.o libhimawari_util.a solar_util.a 35 | $(F90) -o AHI himawari.o $(F90FLAGS) himawari_headerinfo.o himawari_readheader.o himawari_utils.o himawari_nav.o himawari_readwrite.o AHI_Example.o libhimawari_util.a solar_util.a $(INCDIRS) $(LIBDIRS) $(LINKS) 36 | 37 | clean: 38 | rm -f *.a *.o *.mod AHI 39 | 40 | .c.o: 41 | $(CC) $(CCFLAGS) $(INCDIRS) -c -o $*.o $< 42 | 43 | %.o : %.mod 44 | 45 | .f90.o: 46 | $(F90) -o $*.o -c $(F90FLAGS) $(INCDIRS) $< 47 | 48 | -------------------------------------------------------------------------------- /feedstocks/hsd_reader/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | export FFLAGS="${FFLAGS} -w -cpp -I. -ffree-line-length-0 -fcheck=bounds" 6 | export F77FLAGS="${FORTRANFLAGS} -w -cpp -I. -ffree-line-length-0 -fcheck=bounds" 7 | export CFLAGS="${CFLAGS} -w -cpp -I." 8 | 9 | # Can't use -j ${CPU_COUNT} as dependencies are incomplete 10 | make 11 | 12 | mv *.a "${PREFIX}/lib" 13 | mv *.mod "${PREFIX}/include" 14 | mv AHI "${PREFIX}/bin" 15 | -------------------------------------------------------------------------------- /feedstocks/hsd_reader/env.patch: -------------------------------------------------------------------------------- 1 | Subject: Switch to conda build environment 2 | --- a/make.inc 2022-07-06 16:06:38.254703392 +0100 3 | +++ b/make.inc 2022-07-06 16:07:14.326134640 +0100 4 | @@ -1,12 +1,12 @@ 5 | # C compiler and C compiler flags 6 | 7 | -#CC = $(CC) 8 | -CCFLAGS = $(CFLAGS) -O3 -cpp -I. -fopenmp 9 | +CC = $(GCC) 10 | +CCFLAGS = $(CFLAGS) -cpp -I. -fopenmp 11 | 12 | # Fortran compiler and Fortan compiler flags (required for the Fortran 13 | # interface) 14 | -F90 = $(FC) 15 | -F90FLAGS = $(FFLAGS) -O3 -I. -ffree-line-length-0 -cpp -fcheck=bounds -fopenmp 16 | +F90 = $(GFORTRAN) 17 | +F90FLAGS = $(FFLAGS) -I. -ffree-line-length-0 -cpp -fcheck=bounds -fopenmp 18 | 19 | LINKS = $(LDFLAGS) -lm -fopenmp 20 | 21 | -------------------------------------------------------------------------------- /feedstocks/hsd_reader/env_nompi.patch: -------------------------------------------------------------------------------- 1 | Subject: Switch to conda build environment 2 | --- a/make.inc 2022-07-06 16:06:38.254703392 +0100 3 | +++ b/make.inc 2022-07-06 16:07:14.326134640 +0100 4 | @@ -1,13 +1,13 @@ 5 | # C compiler and C compiler flags 6 | 7 | -#CC = $(CC) 8 | -CCFLAGS = $(CFLAGS) -O3 -cpp -I. -fopenmp 9 | +CC = $(GCC) 10 | +CCFLAGS = $(CFLAGS) -cpp -I. 11 | 12 | # Fortran compiler and Fortan compiler flags (required for the Fortran 13 | # interface) 14 | -F90 = $(FC) 15 | -F90FLAGS = $(FFLAGS) -O3 -I. -ffree-line-length-0 -cpp -fcheck=bounds -fopenmp 16 | +F90 = $(GFORTRAN) 17 | +F90FLAGS = $(FFLAGS) -I. -ffree-line-length-0 -cpp -fcheck=bounds 18 | 19 | -LINKS = $(LDFLAGS) -lm -fopenmp 20 | +LINKS = $(LDFLAGS) -lm 21 | 22 | # Include and lib directories for non standard locations required by hsd_reader 23 | -------------------------------------------------------------------------------- /feedstocks/hsd_reader/make.inc: -------------------------------------------------------------------------------- 1 | # C compiler and C compiler flags 2 | 3 | #CC = $(CC) 4 | CCFLAGS = $(CFLAGS) -O3 -cpp -I. -fopenmp 5 | 6 | # Fortran compiler and Fortan compiler flags (required for the Fortran 7 | # interface) 8 | F90 = $(FC) 9 | F90FLAGS = $(FFLAGS) -O3 -I. -ffree-line-length-0 -cpp -fcheck=bounds -fopenmp 10 | 11 | LINKS = $(LDFLAGS) -lm -fopenmp 12 | 13 | # Include and lib directories for non standard locations required by hsd_reader 14 | INCDIRS += -I$(PREFIX)/include 15 | LIBDIRS += -L$(PREFIX)/lib 16 | LINKS += -lhdf5 -lhdf5_fortran -lhdf5_hl_fortran -lnetcdff -lnetcdf 17 | -------------------------------------------------------------------------------- /feedstocks/hsd_reader/meta.yaml: -------------------------------------------------------------------------------- 1 | {% set version = "1.13" %} 2 | {% set build = 2 %} 3 | 4 | # recipe-lint fails if mpi is undefined 5 | {% set mpi = mpi or 'nompi' %} 6 | {% if mpi == "nompi" %} 7 | # prioritize nompi via build number 8 | {% set build = build + 100 %} 9 | {% endif %} 10 | 11 | package: 12 | name: hsd_reader 13 | version: {{ version }} 14 | 15 | source: 16 | - git_url: https://github.com/simonrp84/Himawari_HSD_Reader 17 | - path: make.inc 18 | patches: 19 | {% if mpi != "nompi" %} 20 | - env.patch 21 | {% else %} 22 | - env_nompi.patch 23 | {% endif %} 24 | - path: Makefile 25 | 26 | build: 27 | number: {{ build }} 28 | {% if mpi != "nompi" %} 29 | {% set mpi_prefix = "mpi_" + mpi %} 30 | {% else %} 31 | {% set mpi_prefix = "nompi" %} 32 | {% endif %} 33 | # add build string so packages can depend on 34 | # mpi or nompi variants 35 | # dependencies: 36 | # `PKG_NAME * mpi_mpich_*` for mpich 37 | # `PKG_NAME * mpi_*` for any mpi 38 | # `PKG_NAME * nompi_*` for no mpi 39 | string: {{ mpi_prefix }}_h{{ PKG_HASH }}_{{ build }} 40 | 41 | # mpi builds require the right mpi 42 | # non-mpi builds *do not* appear to require non-mpi builds 43 | # at least not always 44 | 45 | {% if mpi != 'nompi' %} 46 | {% set build_pin = mpi_prefix + '_*' %} 47 | {% else %} 48 | {% set build_pin = '' %} 49 | {% endif %} 50 | run_exports: 51 | - {{ pin_subpackage('hsd_reader', max_pin='x.x') }} {{ build_pin }} 52 | 53 | requirements: 54 | build: 55 | - {{ compiler('c') }} 56 | - {{ compiler('fortran') }} 57 | host: 58 | - {{ mpi }} # [mpi != 'nompi'] 59 | - hdf5 60 | - hdf5 * {{ mpi_prefix }}_* 61 | - libnetcdf 62 | - libnetcdf * {{ mpi_prefix }}_* 63 | - netcdf-fortran 64 | - netcdf-fortran * {{ mpi_prefix }}_* 65 | run: 66 | - {{ mpi }} # [mpi != 'nompi'] 67 | - hdf5 * {{ mpi_prefix }}_* 68 | - libnetcdf * {{ mpi_prefix }}_* 69 | - netcdf-fortran * {{ mpi_prefix }}_* 70 | 71 | test: 72 | commands: 73 | - test -f ${PREFIX}/lib/libhimawari_util.a 74 | - test -f ${PREFIX}/lib/solar_util.a 75 | - AHI -h 76 | 77 | about: 78 | home: https://github.com/simonrp84 79 | license: CC 80 | license_file: License.md 81 | summary: "A reader for data from Japan's Himawari satellite" 82 | 83 | extra: 84 | recipe-maintainers: 85 | - orac_cc 86 | -------------------------------------------------------------------------------- /feedstocks/libemos/activate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Variables we need to declare for libemos to work 4 | declare -a VARIABLES=(EMOSLIB_FILES 5 | LOCAL_DEFINITION_TEMPLATES 6 | ECMWF_LOCAL_TABLE_PATH 7 | BUFR_TABLES) 8 | declare -ax EMOSLIB_SET=() 9 | 10 | # Use any variables that are already defined as a default and keep their value 11 | for VAR in "${VARIABLES[@]}"; do 12 | if [ -d "${VAR}" ]; then 13 | DEFAULT="${VAR}" 14 | else 15 | EMOSLIB_SET+=("${VAR}") 16 | fi 17 | done 18 | 19 | # If nothing is set, assume the structure of a conda environment 20 | if [ -z "${DEFAULT}" ]; then 21 | DEFAULT="${CONDA_PREFIX}/share/libemos/tables" 22 | fi 23 | 24 | # Set all remaining variables to the default value 25 | for VAR in "${EMOSLIB_SET[@]}"; do 26 | if [ "${VAR}" == "EMOSLIB_FILES" ]; then 27 | export "${VAR}"="${DEFAULT}/interpol" 28 | else 29 | export "${VAR}"="${DEFAULT}" 30 | fi 31 | done 32 | -------------------------------------------------------------------------------- /feedstocks/libemos/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # They use implicit casting, which newer gfortran doesn't allow 6 | cat > optiontest.f90 < /dev/null && export FFLAGS="${FFLAGS} -fallow-argument-mismatch" 11 | rm optiontest.f90 12 | 13 | rm -rf build 14 | mkdir build 15 | cd build 16 | 17 | cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ 18 | -DCMAKE_LIBRARY_PATH="${PREFIX}/lib" \ 19 | -DENABLE_GRIBEX_ABORT=OFF \ 20 | -DFFTW_PATH="${PREFIX}/lib" \ 21 | -G "Unix Makefiles" -Wno-dev .. 22 | 23 | make -j ${CPU_COUNT} 24 | ctest 25 | make install -j ${CPU_COUNT} 26 | 27 | # Add the [de]activate scripts for the interpolation tables variable 28 | for CHANGE in "activate" "deactivate"; do 29 | mkdir -p "${PREFIX}/etc/conda/${CHANGE}.d" 30 | cp "${RECIPE_DIR}/${CHANGE}.sh" "${PREFIX}/etc/conda/${CHANGE}.d/${CHANGE}-${PKG_NAME}.sh" 31 | done 32 | -------------------------------------------------------------------------------- /feedstocks/libemos/cmake.patch: -------------------------------------------------------------------------------- 1 | Subject: Help cmake find ecCodes 2 | diff -upN libemos-4.4.9-Source/CMakeLists.txt libemos/CMakeLists.txt 3 | --- libemos-4.4.9-Source/CMakeLists.txt 2017-06-27 17:08:16.000000000 +0100 4 | +++ libemos/CMakeLists.txt 2019-01-31 16:58:46.002147315 +0000 5 | @@ -131,9 +131,9 @@ 6 | DEFAULT ON ) 7 | 8 | if( HAVE_ECCODES) 9 | - set( GRIB_API_INCLUDE_DIRS ${ECCODES_INCLUDE_DIRS} ) 10 | - set( GRIB_API_LIBRARIES ${ECCODES_LIBRARIES} ) 11 | - set( GRIB_API_DEFINITIONS ${ECCODES_DEFINITIONS} ) 12 | + set( GRIB_API_INCLUDE_DIRS ${eccodes_BASE_DIR}/include ) 13 | + set( GRIB_API_LIBRARIES "eccodes;eccodes_f90;m;jpeg" ) 14 | + set( GRIB_API_DEFINITIONS "" ) 15 | set( grib_api_BASE_DIR ${eccodes_BASE_DIR} ) 16 | set( grib_handling_pkg eccodes ) 17 | else() 18 | --- libemos-4.4.9-Source/tests/CMakeLists.txt 2024-08-01 11:16:57.408091984 +0100 19 | +++ libemos/tests/CMakeLists.txt 2024-08-01 11:18:28.251940969 +0100 20 | @@ -161,7 +161,7 @@ if( HAVE_LIBEMOS_GRIBEX ) 21 | ecbuild_add_test( TARGET gribex_demo SOURCES gribex_demo.F LIBS emos ENVIRONMENT ${_emos_environment} 22 | ARGS -i "${PROJECT_SOURCE_DIR}/tests/data/msl_regular_ll.grib" ) 23 | 24 | - set_tests_properties( gribex_abort PROPERTIES WILL_FAIL ${HAVE_GRIBEX_ABORT} ) 25 | + set_tests_properties( gribex_abort PROPERTIES WILL_FAIL 1 ) 26 | set_tests_properties( gribex_demo PROPERTIES WILL_FAIL ${HAVE_GRIBEX_ABORT} ) 27 | 28 | endif( HAVE_LIBEMOS_GRIBEX ) 29 | -------------------------------------------------------------------------------- /feedstocks/libemos/deactivate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Remove variables we set 4 | for VAR in "${EMOSLIB_SET[@]}"; do 5 | unset "${VAR}" 6 | done 7 | 8 | # Remove tracking variables 9 | unset EMOSLIB_SET 10 | -------------------------------------------------------------------------------- /feedstocks/libemos/meta.yaml: -------------------------------------------------------------------------------- 1 | {% set version = "4.5.9" %} 2 | # TODO: This can support OMP 3 | 4 | package: 5 | name: libemos 6 | version: {{ version }} 7 | 8 | source: 9 | url: https://confluence.ecmwf.int/download/attachments/3473472/libemos-{{ version }}-Source.tar.gz 10 | sha256: e57e02c636dc8f5ccb862a103789b1e927bc985b1e0f2b05abf4f64e86d2f67f 11 | patches: 12 | - init.patch 13 | - cmake.patch 14 | - tables.patch 15 | 16 | build: 17 | number: 0 18 | skip: True # [win] 19 | detect_binary_files_with_prefix: True 20 | run_exports: 21 | - {{ pin_subpackage('libemos', max_pin='x.x.x') }} 22 | 23 | requirements: 24 | build: 25 | - {{ compiler('c') }} 26 | - {{ compiler('fortran') }} 27 | - cmake 28 | host: 29 | - eccodes <2.28.0 30 | - fftw 31 | - jpeg 32 | - libnetcdf 33 | - netcdf-fortran 34 | - hdf4 35 | - hdf5 36 | run: 37 | - eccodes <2.28.0 38 | - fftw 39 | 40 | test: 41 | commands: 42 | - test -f ${PREFIX}/lib/libemos.a [not win] 43 | - test -f ${PREFIX}/lib/libemosR64.a [not win] 44 | - libemos_version 45 | 46 | about: 47 | doc_url: https://software.ecmwf.int/wiki/display/EMOS/Using+EMOSLIB 48 | home: https://software.ecmwf.int/wiki/display/EMOS/Releases 49 | license: APACHE 50 | license_file: LICENSE 51 | summary: 'Interpolation library' 52 | 53 | extra: 54 | recipe_maintainers: 55 | - orac_cc 56 | -------------------------------------------------------------------------------- /feedstocks/libemos/tables.patch: -------------------------------------------------------------------------------- 1 | Subject: Don't hardcode the Interpolation table path. 2 | diff -upN libemos-4.4.9-Source/libemos-sp/CMakeLists.txt libemos/libemos-dp/CMakeLists.txt 3 | --- libemos-4.4.9-Source/libemos-sp/CMakeLists.txt 2018-02-16 13:29:59.000000000 +0000 4 | +++ libemos/libemos-dp/CMakeLists.txt 2019-01-31 18:06:40.931471207 +0000 5 | @@ -34,7 +34,7 @@ ecbuild_add_library( 6 | TYPE ${LIB_TYPE} 7 | TARGET emos_sp 8 | OUTPUT_NAME "emos" 9 | - DEFINITIONS ${LIBEMOS_DEFINITIONS} ${emos_interpol_tables_def} 10 | + DEFINITIONS ${LIBEMOS_DEFINITIONS} 11 | LIBS "${GRIB_API_LIBRARIES}" "${FFTW_LIB}" "${FORTRAN_LIBRARIES}" 12 | SOURCES ../libemos_version.c ${emos_sp_srcs} 13 | GENERATED ../libemos_version.c ) 14 | diff -upN libemos-4.4.9-Source/libemos-dp/CMakeLists.txt libemos/libemos-dp/CMakeLists.txt 15 | --- libemos-4.4.9-Source/libemos-dp/CMakeLists.txt 2018-02-16 13:29:59.000000000 +0000 16 | +++ libemos/libemos-dp/CMakeLists.txt 2019-01-31 18:05:27.977437881 +0000 17 | @@ -31,7 +31,7 @@ ecbuild_add_library( 18 | TYPE ${LIB_TYPE} 19 | TARGET emos 20 | OUTPUT_NAME "emosR64" 21 | - DEFINITIONS ${LIBEMOS_DEFINITIONS} ${emos_interpol_tables_def} 22 | + DEFINITIONS ${LIBEMOS_DEFINITIONS} 23 | LIBS "${GRIB_API_LIBRARIES}" "${FFTW_LIB}" ${FORTRAN_LIBRARIES} 24 | SOURCES ../libemos_version.c ${emos_dp_srcs} 25 | GENERATED ../libemos_version.c ) 26 | --- libemos-4.4.9-Source/CMakeLists.txt 2017-06-27 17:08:16.000000000 +0100 27 | +++ libemos/CMakeLists.txt 2019-01-31 16:58:46.002147315 +0000 28 | @@ -168,8 +168,6 @@ if( BUFR_TABLES_PATH ) 29 | else() 30 | set( BUFR_TABLES_PATH "${CMAKE_INSTALL_PREFIX}/${INSTALL_DATA_DIR}/../bufrdc_tables/" ) 31 | endif() 32 | -add_definitions( -DBUFR_TABLES_PATH="${BUFR_TABLES_PATH}" ) 33 | -message( STATUS "BUFR_TABLES_PATH: ${BUFR_TABLES_PATH}" ) 34 | 35 | # get_directory_property( LIBEMOS_DEFINITIONS COMPILE_DEFINITIONS ) # don't export libemos definitions 36 | 37 | -------------------------------------------------------------------------------- /feedstocks/nr/Makefile.patch: -------------------------------------------------------------------------------- 1 | Subject: Anaconda compilers are specified by environment variables. 2 | diff -rupN nr/Makefile new/Makefile 3 | --- nr/Makefile 2018-07-25 16:27:23.979202955 +0100 4 | +++ new/Makefile 2019-01-28 11:14:41.782053656 +0000 5 | @@ -1,4 +1,4 @@ 6 | -F77 = gfortran 7 | +F77 = ${GFORTRAN} 8 | F77FLAGS = -O3 -Dfloat=double -std=legacy -Wno-conversion -fno-range-check \ 9 | -Wno-unused-dummy-argument -Wno-unused-function -fopenmp 10 | 11 | @@ -230,3 +230,2 @@ 12 | probks.o \ 13 | - psdes.o \ 14 | pwt.o \ 15 | @@ -362,3 +361,3 @@ 16 | libnr.a: ${OBJECTS} 17 | - ar -r libnr.a ${OBJECTS} 18 | + ${AR} -r libnr.a ${OBJECTS} 19 | 20 | -------------------------------------------------------------------------------- /feedstocks/nr/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | make -j ${CPU_COUNT} 6 | mv libnr.a ${PREFIX}/lib 7 | -------------------------------------------------------------------------------- /feedstocks/nr/data.patch: -------------------------------------------------------------------------------- 1 | Subject: Fix syntax errors in DATA definition for octal numbers. 2 | diff -Ewbur numerical_recipes/psdes.for nr_f/psdes.for 3 | --- numerical_recipes/psdes.for 2002-05-10 10:54:01.000000000 +0100 4 | +++ nr/psdes.for 2017-11-15 11:13:06.404208690 +0000 5 | @@ -3,8 +3,8 @@ 6 | PARAMETER (NITER=4) 7 | INTEGER i,ia,ib,iswap,itmph,itmpl,c1(4),c2(4) 8 | SAVE c1,c2 9 | - DATA c1 /16#BAA96887,16#1E17D32C,16#03BCDC3C,16#0F33D1B2/, c2 10 | - */16#4B0F3B58,16#E874F0C3,16#6955C5A6, 16#55A7CA46/ 11 | + DATA c1 /Z'BAA96887',Z'1E17D32C',Z'03BCDC3C',Z'0F33D1B2'/, c2 12 | + */Z'4B0F3B58',Z'E874F0C3',Z'6955C5A6',Z'55A7CA46'/ 13 | do 11 i=1,NITER 14 | iswap=irword 15 | ia=ieor(irword,c1(i)) 16 | diff -Ewbur numerical_recipes/ran4.for nr_f/ran4.for 17 | --- numerical_recipes/ran4.for 2002-05-10 10:54:05.000000000 +0100 18 | +++ nr/ran4.for 2017-11-15 11:13:30.595763688 +0000 19 | @@ -6,7 +6,7 @@ 20 | REAL ftemp 21 | EQUIVALENCE (itemp,ftemp) 22 | SAVE idums,jflone,jflmsk 23 | - DATA idums /0/, jflone /16#3F800000/, jflmsk /16#007FFFFF/ 24 | + DATA idums /0/, jflone /Z'3F800000'/, jflmsk /Z'007FFFFF'/ 25 | if(idum.lt.0)then 26 | idums=-idum 27 | idum=1 28 | -------------------------------------------------------------------------------- /feedstocks/nr/meta.yaml: -------------------------------------------------------------------------------- 1 | {% set version = "2.0.1" %} 2 | {% set build = 1 %} 3 | 4 | {% set mpi = mpi or 'nompi' %} 5 | {% if mpi == "nompi" %} 6 | # deprioritize nompi via build number 7 | {% set build = build + 100 %} 8 | {% endif %} 9 | 10 | package: 11 | name: nr 12 | version: {{ version }} 13 | 14 | source: 15 | - url: https://eodg.atm.ox.ac.uk/user/povey/nr.tar.gz 16 | sha256: 71d2a21132742b458e05b88dedc4489bb0c160a3d7883add03a18109ed93c25e 17 | patches: 18 | - data.patch 19 | - shoot.patch 20 | - Makefile.patch 21 | {% if mpi == 'nompi' %} 22 | - nompi.patch 23 | {% endif %} 24 | 25 | build: 26 | number: {{ build }} 27 | run_exports: 28 | - {{ pin_subpackage('nr', max_pin='x.x.x') }} 29 | 30 | # add build string so packages can depend on 31 | # mpi or nompi variants explicitly: 32 | # `netcdf-fortran * mpi_mpich_*` for mpich 33 | # `netcdf-fortran * mpi_*` for any mpi 34 | # `netcdf-fortran * nompi_*` for no mpi 35 | 36 | {% if mpi != 'nompi' %} 37 | {% set mpi_prefix = "mpi_" + mpi %} 38 | {% else %} 39 | {% set mpi_prefix = "nompi" %} 40 | {% endif %} 41 | string: {{ mpi_prefix }}_h{{ PKG_HASH }}_{{ build }} 42 | 43 | requirements: 44 | build: 45 | - {{ compiler('fortran') }} 46 | - make 47 | 48 | test: 49 | commands: 50 | - test -f ${PREFIX}/lib/libnr.a 51 | 52 | about: 53 | home: http://numerical.recipes/ 54 | license: PROPRIETARY 55 | license_file: LICENSE 56 | summary: 'Example numerical algorithms' 57 | 58 | extra: 59 | recipe_maintainers: 60 | - orac_cc 61 | -------------------------------------------------------------------------------- /feedstocks/nr/nompi.patch: -------------------------------------------------------------------------------- 1 | Subject: Turn off openmp 2 | diff -rupN nr/Makefile new/Makefile 3 | --- nr/Makefile 2021-11-30 16:40:20.000000000 +0000 4 | +++ new/Makefile 2022-07-06 16:52:13.027626717 +0100 5 | @@ -1,6 +1,6 @@ 6 | F77 = gfortran 7 | F77FLAGS = -O3 -Dfloat=double -std=legacy -Wno-conversion -fno-range-check \ 8 | - -Wno-unused-dummy-argument -Wno-unused-function -fopenmp 9 | + -Wno-unused-dummy-argument -Wno-unused-function 10 | 11 | OBJECTS = addint.o \ 12 | airy.o \ 13 | -------------------------------------------------------------------------------- /feedstocks/nr/shoot.patch: -------------------------------------------------------------------------------- 1 | Subject: Routines need unique names in the library 2 | diff -rupN nr/shootf.for new/shootf.for 3 | --- nr/shootf.for 2020-09-10 11:14:00.758265737 +0100 4 | +++ new/shootf.for 2002-05-10 10:54:13.000000000 +0100 5 | @@ -1,5 +1,5 @@ 6 | -CU SUBROUTINE shootf(n,v,f) is named "funcv" for use with "newt" 7 | - SUBROUTINE funcv(n,v,f) 8 | + SUBROUTINE shootf(n,v,f) 9 | +CU SUBROUTINE funcv(n,v,f) is named "funcv" for use with "newt" 10 | INTEGER n,nvar,nn2,kmax,kount,KMAXX,NMAX 11 | REAL f(n),v(n),x1,x2,xf,dxsav,xp,yp,EPS 12 | PARAMETER (NMAX=50,KMAXX=200,EPS=1.e-6) 13 | diff -rupN nr/shoot.for new/shoot.for 14 | --- nr/shoot.for 2020-09-10 11:13:32.414394352 +0100 15 | +++ new/shoot.for 2002-05-10 10:54:13.000000000 +0100 16 | @@ -1,5 +1,5 @@ 17 | -CU SUBROUTINE shoot(n2,v,f) is named "funcv" for use with "newt" 18 | - SUBROUTINE funcv(n2,v,f) 19 | + SUBROUTINE shoot(n2,v,f) 20 | +CU SUBROUTINE funcv(n2,v,f) is named "funcv" for use with "newt" 21 | INTEGER n2,nvar,kmax,kount,KMAXX,NMAX 22 | REAL f(n2),v(n2),x1,x2,dxsav,xp,yp,EPS 23 | PARAMETER (NMAX=50,KMAXX=200,EPS=1.e-6) 24 | -------------------------------------------------------------------------------- /feedstocks/orac/activate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Put the EMOS temporary file somewhere sensible 4 | if [ -z "${PPDIR}" ]; then 5 | export PPDIR="${CONDA_PREFIX}/share/libemos/tables" 6 | fi 7 | 8 | # Ensure multithreaded packages don't multithread BLAS 9 | if [ -n "${OPENBLAS_NUM_THREADS}" ]; then 10 | export OPENBLAS_NUM_THREADS_SAVE="${OPENBLAS_NUM_THREADS}" 11 | fi 12 | export OPENBLAS_NUM_THREADS=1 13 | -------------------------------------------------------------------------------- /feedstocks/orac/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | export ORAC_LIB=${SRC_DIR}/config/lib.conda.inc 6 | export ORAC_ARCH=${SRC_DIR}/config/arch.conda.inc 7 | 8 | if [ ! -d common/obj ]; then 9 | mkdir common/obj 10 | mkdir pre_processing/obj 11 | mkdir src/obj 12 | mkdir post_processing/obj 13 | mkdir derived_products/broadband_fluxes/obj 14 | mkdir derived_products/broadband_fluxes/obj/bugsrad 15 | mkdir derived_products/broadband_fluxes/obj/fu_liou 16 | fi 17 | 18 | make -j ${CPU_COUNT} 19 | 20 | # "Install" the files in the PREFIX directories 21 | find . -name "*.a" -exec mv {} ${PREFIX}/lib \; 22 | find . -name "*.mod" -exec mv {} ${PREFIX}/include \; 23 | mv common/rttov_version ${PREFIX}/bin 24 | mv pre_processing/orac_preproc ${PREFIX}/bin 25 | mv src/orac ${PREFIX}/bin 26 | mv post_processing/orac_postproc ${PREFIX}/bin 27 | mv derived_products/broadband_fluxes/process_broadband_fluxes ${PREFIX}/bin 28 | 29 | # Add configuration files, as the Python scripts use them to load libraries 30 | mkdir -p ${PREFIX}/share/orac 31 | cp config/arch.conda.inc ${PREFIX}/share/orac/arch.inc 32 | cp config/lib.conda.inc ${PREFIX}/share/orac/lib.inc 33 | sed -i 's/PREFIX/CONDA_PREFIX/g' ${PREFIX}/share/orac/lib.inc 34 | 35 | # Add the [de]activate scripts for environment variables 36 | for CHANGE in "activate" "deactivate"; do 37 | mkdir -p "${PREFIX}/etc/conda/${CHANGE}.d" 38 | cp "${CHANGE}.sh" "${PREFIX}/etc/conda/${CHANGE}.d/${CHANGE}-${PKG_NAME}.sh" 39 | done 40 | -------------------------------------------------------------------------------- /feedstocks/orac/deactivate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "${PPDIR}" == "${CONDA_PREFIX}/share/libemos/tables" ]; then 4 | unset PPDIR 5 | fi 6 | 7 | if [ -n "${OPENBLAS_NUM_THREADS_SAVE}" ]; then 8 | export OPENBLAS_NUM_THREADS="${OPENBLAS_NUM_THREADS_SAVE}" 9 | unset OPENBLAS_NUM_THREADS_SAVE 10 | else 11 | unset OPENBLAS_NUM_THREADS 12 | fi 13 | -------------------------------------------------------------------------------- /feedstocks/orac/make.patch: -------------------------------------------------------------------------------- 1 | Subject: Adapt config files to the anaconda environment. 2 | --- a/config/arch.conda.inc 2022-08-12 13:18:54.203033707 +0100 3 | +++ b/config/arch.conda.inc 2022-08-12 16:30:41.874308585 +0100 4 | @@ -17,10 +17,10 @@ 5 | 6 | # Set Fortran 77 compiler flags 7 | -F77FLAGS = -O3 -cpp -ffree-line-length-0 -g -fcheck=bounds -fallow-argument-mismatch 8 | +F77FLAGS = -O3 -cpp -ffree-line-length-0 -fcheck=bounds -fallow-argument-mismatch 9 | # Uncomment if extra warnings are required. Take out -Werror if that annoys you. 10 | #FF77LAGS += -Wall -Werror -Wno-conversion -Wno-uninitialized -Wno-unused-dummy-argument -Wtabs 11 | 12 | # Set Fortran 90 compiler flags 13 | -FFLAGS = -O3 -cpp -ffree-line-length-0 -g -fcheck=bounds -fallow-argument-mismatch 14 | +FFLAGS = -O3 -cpp -ffree-line-length-0 -fcheck=bounds -fallow-argument-mismatch 15 | # Uncomment if OpenMP support is desired. Highly recommented. 16 | FFLAGS += -fopenmp 17 | @@ -31,5 +31,5 @@ 18 | 19 | # Set C compiler flags 20 | -CFLAGS = -O3 -g 21 | +CFLAGS = -O3 22 | # Uncomment if extra warnings are required. 23 | #CFLAGS += -Wall -Werror 24 | --- a/config/lib.conda.inc 2022-08-12 13:18:54.203033707 +0100 25 | +++ b/config/lib.conda.inc 2022-08-12 16:33:53.728790339 +0100 26 | @@ -1,8 +1,8 @@ 27 | # Base directory for all libraries and include files taken from the 28 | -# environmental variable CONDA_PREFIX. 29 | +# environmental variable PREFIX. 30 | 31 | # Set up libraries and includes 32 | -LIBS = -L$(CONDA_PREFIX)/lib \ 33 | +LIBS = -L$(PREFIX)/lib \ 34 | -lemosR64 -lemos -lfftw3 \ 35 | -lhdfeos -lGctp \ 36 | -leccodes_f90 -leccodes \ 37 | @@ -16,11 +16,11 @@ 38 | -ljpeg -lm -lz -lstdc++ -lblas -llapack 39 | 40 | INC = -I./ \ 41 | - -I$(CONDA_PREFIX)/include \ 42 | - -I$(CONDA_PREFIX)/mod 43 | + -I$(PREFIX)/include \ 44 | + -I$(PREFIX)/mod 45 | 46 | CINC = -I./ \ 47 | - -I$(CONDA_PREFIX)/include 48 | + -I$(PREFIX)/include 49 | 50 | 51 | # Configuration options 52 | -------------------------------------------------------------------------------- /feedstocks/orac/nompi.patch: -------------------------------------------------------------------------------- 1 | Subject: Adapt config files to the anaconda environment without openmp. 2 | --- a/config/arch.conda.inc 2022-08-12 13:18:54.203033707 +0100 3 | +++ b/config/arch.conda.inc 2022-08-12 16:30:41.874308585 +0100 4 | @@ -17,19 +17,19 @@ 5 | 6 | # Set Fortran 77 compiler flags 7 | -F77FLAGS = -O3 -cpp -ffree-line-length-0 -g -fcheck=bounds -fallow-argument-mismatch 8 | +F77FLAGS = -O3 -cpp -ffree-line-length-0 -fcheck=bounds -fallow-argument-mismatch 9 | # Uncomment if extra warnings are required. Take out -Werror if that annoys you. 10 | #FF77LAGS += -Wall -Werror -Wno-conversion -Wno-uninitialized -Wno-unused-dummy-argument -Wtabs 11 | 12 | # Set Fortran 90 compiler flags 13 | -FFLAGS = -O3 -cpp -ffree-line-length-0 -g -fcheck=bounds -fallow-argument-mismatch 14 | +FFLAGS = -O3 -cpp -ffree-line-length-0 -fcheck=bounds -fallow-argument-mismatch 15 | # Uncomment if OpenMP support is desired. Highly recommented. 16 | -FFLAGS += -fopenmp 17 | +#FFLAGS += -fopenmp 18 | # Uncomment if extra warnings are required. Take out -Werror if that annoys you. 19 | #FFLAGS += -Wall -Werror -Wno-conversion -Wno-uninitialized -Wno-unused-dummy-argument -Wtabs 20 | 21 | -LFLAGS = -fopenmp 22 | +LFLAGS = 23 | 24 | # Set C compiler flags 25 | -CFLAGS = -O3 -g 26 | +CFLAGS = -O3 27 | # Uncomment if extra warnings are required. 28 | #CFLAGS += -Wall -Werror 29 | --- a/config/lib.conda.inc 2022-08-12 13:18:54.203033707 +0100 30 | +++ b/config/lib.conda.inc 2022-08-12 16:31:17.946772047 +0100 31 | @@ -1,8 +1,8 @@ 32 | # Base directory for all libraries and include files taken from the 33 | -# environmental variable CONDA_PREFIX. 34 | +# environmental variable PREFIX. 35 | 36 | # Set up libraries and includes 37 | -LIBS = -L$(CONDA_PREFIX)/lib \ 38 | +LIBS = -L$(PREFIX)/lib \ 39 | -lemosR64 -lemos -lfftw3 \ 40 | -lhdfeos -lGctp \ 41 | -leccodes_f90 -leccodes \ 42 | @@ -16,17 +16,17 @@ 43 | -ljpeg -lm -lz -lstdc++ -lblas -llapack 44 | 45 | INC = -I./ \ 46 | - -I$(CONDA_PREFIX)/include \ 47 | - -I$(CONDA_PREFIX)/mod 48 | + -I$(PREFIX)/include \ 49 | + -I$(PREFIX)/mod 50 | 51 | CINC = -I./ \ 52 | - -I$(CONDA_PREFIX)/include 53 | + -I$(PREFIX)/include 54 | 55 | 56 | # Configuration options 57 | 58 | # Uncomment if you want to enable OpenMP for RTTOV computations. 59 | -INC += -DINCLUDE_RTTOV_OPENMP 60 | +#INC += -DINCLUDE_RTTOV_OPENMP 61 | 62 | # Uncomment if ATSR support is desired. 63 | LIBS += -lepr_api 64 | -------------------------------------------------------------------------------- /feedstocks/pyorac/meta.yaml: -------------------------------------------------------------------------------- 1 | {% set version = "3.02" %} 2 | 3 | package: 4 | name: pyorac 5 | version: {{ version }} 6 | 7 | source: 8 | - git_url: https://github.com/ORAC-CC/orac 9 | - path: local_defaults.py 10 | folder: tools/pyorac/local_defaults.py 11 | 12 | build: 13 | number: 2 14 | script: cd tools && {{ PYTHON }} -m pip install . -vv 15 | run_exports: 16 | - {{ pin_subpackage('pyorac', max_pin='x.x') }} 17 | 18 | requirements: 19 | host: 20 | - python 21 | - cartopy 22 | - cftime 23 | - h5py 24 | - matplotlib 25 | - netcdf4 26 | - numpy 27 | - opencv 28 | - orac 4.11 29 | - scipy 30 | run: 31 | - python 32 | - cartopy 33 | - cftime 34 | - h5py 35 | - matplotlib 36 | - netcdf4 37 | - {{ pin_compatible('numpy') }} 38 | - opencv 39 | - orac 4.11 40 | - scipy 41 | 42 | test: 43 | commands: 44 | - orac.py -h 45 | - regression.py -h 46 | - single_process.py -h 47 | 48 | about: 49 | home: https://github.com/ORAC-CC/orac/wiki 50 | license: CC 51 | license_file: COPYING 52 | summary: 'Scripts to call the Optimal Retrieval of Aerosol and Cloud' 53 | 54 | extra: 55 | recipe-maintainers: 56 | - orac_cc 57 | -------------------------------------------------------------------------------- /feedstocks/rttov/arch.patch: -------------------------------------------------------------------------------- 1 | Subject: Anaconda compilers are called from environment variables. 2 | diff -rupN rttov121/build/arch/gfortran rttov/build/arch/gfortran 3 | --- rttov121/build/arch/gfortran 2017-02-16 12:00:26.000000000 +0000 4 | +++ rttov/build/arch/gfortran 2019-01-24 16:00:39.661079562 +0000 5 | @@ -1,10 +1,10 @@ 6 | -FC=gfortran 7 | -FC77=gfortran 8 | -CC=gcc 9 | +FC=${GFORTRAN} 10 | +FC77=${GFORTRAN} 11 | +CC=${GCC} 12 | LDFLAGS_ARCH= 13 | CFLAGS_ARCH= 14 | FFLAGS_ARCH=-fPIC -O3 -ffree-line-length-none 15 | -AR=ar r 16 | +AR=${CONDA_AR} r 17 | 18 | F2PY=f2py --fcompiler=gnu95 19 | F2PYFLAGS_ARCH="-fPIC" 20 | diff -rupN rttov121/build/arch/gfortran-openmp rttov/build/arch/gfortran-openmp 21 | --- rttov121/build/arch/gfortran-openmp 2017-02-16 12:00:26.000000000 +0000 22 | +++ rttov/build/arch/gfortran-openmp 2019-01-24 16:00:39.661079562 +0000 23 | @@ -1,10 +1,10 @@ 24 | -FC=gfortran 25 | -FC77=gfortran 26 | -CC=gcc 27 | +FC=${GFORTRAN} 28 | +FC77=${GFORTRAN} 29 | +CC=${GCC} 30 | LDFLAGS_ARCH=-fopenmp 31 | CFLAGS_ARCH= 32 | FFLAGS_ARCH=-fPIC -O3 -fopenmp -ffree-line-length-none 33 | -AR=ar r 34 | +AR=${CONDA_AR} r 35 | 36 | F2PY=f2py --fcompiler=gnu95 37 | F2PYFLAGS_ARCH="-fPIC" 38 | -------------------------------------------------------------------------------- /feedstocks/rttov/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ -n "$(conda list -p $PREFIX | grep openmpi)" ]; then 6 | ARCH=gfortran-openmp 7 | else 8 | ARCH=gfortran 9 | fi 10 | REL_PATH=`python -c "import os.path; print(os.path.relpath('$PREFIX', '$PWD'))"` 11 | 12 | cd src 13 | ../build/Makefile.PL RTTOV_HDF=1 RTTOV_F2PY=1 RTTOV_USER_LAPACK=1 14 | CONDA_AR=${AR} make ARCH=$ARCH INSTALLDIR=$REL_PATH 15 | 16 | # Extremely lazy installation of pyRTTOV 17 | # NOTE: should do something like HDF5 and make multiple outs to minimise builds 18 | cp -r ../wrapper/pyrttov ${PREFIX}/lib/ 19 | -------------------------------------------------------------------------------- /feedstocks/rttov/conda.patch: -------------------------------------------------------------------------------- 1 | Subject: Adapt the Makefile to the conda environment, with optional features. 2 | --- rttov13.0/build/Makefile.local 2020-11-30 15:56:52.756666069 +0000 3 | +++ rttov/build/Makefile.local 2019-01-24 14:32:12.251215319 +0000 4 | @@ -37,12 +37,12 @@ 5 | # $ ../build/Makefile.PL RTTOV_HDF=1 6 | # ------------------------------------------------------------------------------ 7 | 8 | -HDF5_PREFIX = path-to-hdf-install 9 | +HDF5_PREFIX = $(PREFIX) 10 | 11 | # --- Uncomment one FFLAGS_HDF5 line: 12 | 13 | # For most compilers: 14 | -# FFLAGS_HDF5 = -D_RTTOV_HDF $(FFLAG_MOD)$(HDF5_PREFIX)/include 15 | +FFLAGS_HDF5 = -D_RTTOV_HDF $(FFLAG_MOD)$(HDF5_PREFIX)/include 16 | 17 | # For xlf on AIX: 18 | # FFLAGS_HDF5 = -WF,-D_RTTOV_HDF $(FFLAG_MOD)$(HDF5_PREFIX)/include 19 | @@ -54,7 +54,7 @@ 20 | 21 | # But you may find that you must also specify libz: 22 | # (NB for NAG Fortran you may also need to add -ldl) 23 | -# LDFLAGS_HDF5 = -L$(HDF5_PREFIX)/lib -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lz 24 | +LDFLAGS_HDF5 = -L$(HDF5_PREFIX)/lib -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lz 25 | 26 | 27 | 28 | @@ -68,12 +68,12 @@ 29 | # the HDF5 library as above. 30 | # ------------------------------------------------------------------------------ 31 | 32 | -NETCDF_PREFIX = path-to-netcdf-install 33 | +NETCDF_PREFIX = $(PREFIX) 34 | 35 | # --- Uncomment one FFLAGS_NETCDF line: 36 | 37 | # For most compilers: 38 | -# FFLAGS_NETCDF = -D_RTTOV_NETCDF -I$(NETCDF_PREFIX)/include 39 | +FFLAGS_NETCDF = -D_RTTOV_NETCDF -I$(NETCDF_PREFIX)/include 40 | 41 | # For xlf on AIX: 42 | # FFLAGS_NETCDF = -WF,-D_RTTOV_NETCDF -I$(NETCDF_PREFIX)/include 43 | @@ -84,7 +84,7 @@ 44 | # LDFLAGS_NETCDF = -L$(NETCDF_PREFIX)/lib -lnetcdff -lnetcdf 45 | 46 | # For NetCDF v4.2 and later: 47 | -# LDFLAGS_NETCDF = -L$(NETCDF_PREFIX)/lib -lnetcdff 48 | +LDFLAGS_NETCDF = -L$(NETCDF_PREFIX)/lib -lnetcdff 49 | 50 | 51 | 52 | @@ -98,13 +98,13 @@ 53 | # RTTOV_USER_LAPACK=1 to exclude lapack.f from the Makefiles. 54 | # ------------------------------------------------------------------------------ 55 | 56 | -LAPACK_PREFIX = path-to-lapack-install 57 | +LAPACK_PREFIX = $(PREFIX) 58 | 59 | # --- Uncomment the FFLAGS_LAPACK and LDFLAGS_LAPACK lines and edit as 60 | # required for your installation: 61 | 62 | -# FFLAGS_LAPACK = $(FFLAG_MOD)$(LAPACK_PREFIX)/include 63 | -# LDFLAGS_LAPACK = -L$(LAPACK_PREFIX)/lib -llapack 64 | +FFLAGS_LAPACK = $(FFLAG_MOD)$(LAPACK_PREFIX)/include 65 | +LDFLAGS_LAPACK = -L$(LAPACK_PREFIX)/lib -llapack 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /feedstocks/rttov/local.patch: -------------------------------------------------------------------------------- 1 | --- rttov13.0/build/Makefile.local 2020-11-30 15:56:52.756666069 +0000 2 | +++ rttov/build/Makefile.local 2019-01-24 14:32:12.251215319 +0000 3 | @@ -37,12 +37,12 @@ 4 | # $ ../build/Makefile.PL RTTOV_HDF=1 5 | # ------------------------------------------------------------------------------ 6 | 7 | -HDF5_PREFIX = path-to-hdf-install 8 | +HDF5_PREFIX = $(PREFIX) 9 | 10 | # --- Uncomment one FFLAGS_HDF5 line: 11 | 12 | # For most compilers: 13 | -# FFLAGS_HDF5 = -D_RTTOV_HDF $(FFLAG_MOD)$(HDF5_PREFIX)/include 14 | +FFLAGS_HDF5 = -D_RTTOV_HDF $(FFLAG_MOD)$(HDF5_PREFIX)/include/shared 15 | 16 | # For xlf on AIX: 17 | # FFLAGS_HDF5 = -WF,-D_RTTOV_HDF $(FFLAG_MOD)$(HDF5_PREFIX)/include 18 | @@ -54,7 +54,7 @@ 19 | 20 | # But you may find that you must also specify libz: 21 | # (NB for NAG Fortran you may also need to add -ldl) 22 | -# LDFLAGS_HDF5 = -L$(HDF5_PREFIX)/lib -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lz 23 | +LDFLAGS_HDF5 = -L$(HDF5_PREFIX)/lib -lhdf5_hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lz 24 | 25 | 26 | 27 | @@ -68,12 +68,12 @@ 28 | # the HDF5 library as above. 29 | # ------------------------------------------------------------------------------ 30 | 31 | -NETCDF_PREFIX = path-to-netcdf-install 32 | +NETCDF_PREFIX = $(PREFIX) 33 | 34 | # --- Uncomment one FFLAGS_NETCDF line: 35 | 36 | # For most compilers: 37 | -# FFLAGS_NETCDF = -D_RTTOV_NETCDF -I$(NETCDF_PREFIX)/include 38 | +FFLAGS_NETCDF = -D_RTTOV_NETCDF -I$(NETCDF_PREFIX)/include 39 | 40 | # For xlf on AIX: 41 | # FFLAGS_NETCDF = -WF,-D_RTTOV_NETCDF -I$(NETCDF_PREFIX)/include 42 | @@ -84,7 +84,7 @@ 43 | # LDFLAGS_NETCDF = -L$(NETCDF_PREFIX)/lib -lnetcdff -lnetcdf 44 | 45 | # For NetCDF v4.2 and later: 46 | -# LDFLAGS_NETCDF = -L$(NETCDF_PREFIX)/lib -lnetcdff 47 | +LDFLAGS_NETCDF = -L$(NETCDF_PREFIX)/lib -lnetcdff 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /feedstocks/rttov/loop.patch: -------------------------------------------------------------------------------- 1 | Subject: gfortran v10+ takes a very long time with these 2 | --- a/src/other/rttov_bpr_init.F90 2020-09-17 17:42:27.000000000 +0100 3 | +++ b/src/other/rttov_bpr_init.F90 2022-08-04 16:38:10.218427096 +0100 4 | @@ -96,9 +96,20 @@ SUBROUTINE RTTOV_BPR_INIT( ERR, PHANGLE 5 | ! 10-6 cos=0.999920, 0.992500 ~angle 0.70, 7.00 degree 6 | ! 10-7 cos=0.999999, 0.999920 ~angle 0.08, 0.70 degree 7 | ! 10-8 cos=1.000000, 0.999999 ~angle 0.00, 0.08 degree 8 | - TACOS1 = ACOS( (/ (I, I= 0, 6400) /) /10000.0_JPRB) 9 | - TACOS2 = ACOS( (/ (I, I= 64000, 99250) /) /100000.0_JPRB) 10 | - TACOS3 = ACOS( (/ (I, I= 992500, 999920) /) /1000000.0_JPRB) 11 | + 12 | + ! TACOS1 = ACOS( (/ (I, I= 0, 6400) /) /10000.0_JPRB) 13 | + ! TACOS2 = ACOS( (/ (I, I= 64000, 99250) /) /100000.0_JPRB) 14 | + ! TACOS3 = ACOS( (/ (I, I= 992500, 999920) /) /1000000.0_JPRB) 15 | + ! gfortran v10 takes a very long time to compile the above lines 16 | + DO I = 0, 6400 17 | + TACOS1(I) = ACOS(REAL(I, KIND=JPRB) / 10000.0_JPRB) 18 | + ENDDO 19 | + DO I = 64000, 99250 20 | + TACOS2(I-64000) = ACOS(REAL(I, KIND=JPRB) / 100000.0_JPRB) 21 | + ENDDO 22 | + DO I = 992500, 999920 23 | + TACOS3(I-992500) = ACOS(REAL(I, KIND=JPRB) / 1000000.0_JPRB) 24 | + ENDDO 25 | TACOS4 = ACOS( (/ (I, I= 9999200, 9999990) /) /10000000.0_JPRB) 26 | TACOS5 = ACOS( (/ (I, I=99999900,100000000) /) /100000000.0_JPRB) 27 | 28 | -------------------------------------------------------------------------------- /feedstocks/rttov/meta.yaml: -------------------------------------------------------------------------------- 1 | {% set version = "13.1" %} 2 | {% set build = 2 %} 3 | 4 | {% set mpi = mpi or 'nompi' %} 5 | 6 | package: 7 | name: rttov 8 | version: {{ version }} 9 | 10 | source: 11 | # Can't use this as the contents change with each download 12 | #url: https://www.nwpsaf.eu/site/user/acpovey/?profiletab=downloadtab&fn=download&fname=RTTOV%20v12 13 | url: http://eodg.atm.ox.ac.uk/user/povey/rttov{{ version|replace('.','') }}.tar.xz 14 | sha256: f3bec1ca3ba952bc49e19d851144f9d51126bfe59f473be4992eac0b3366dbb2 15 | patches: 16 | - conda.patch 17 | - arch.patch 18 | - loop.patch 19 | - tests.patch 20 | 21 | build: 22 | number: {{ build }} 23 | {% if mpi != 'nompi' %} 24 | {% set mpi_prefix = "mpi_" + mpi %} 25 | {% else %} 26 | {% set mpi_prefix = "nompi" %} 27 | {% endif %} 28 | # add build string so packages can depend on 29 | # mpi or nompi variants explicitly: 30 | # `rttov * mpi_mpich_*` for mpich 31 | # `rttov * mpi_*` for any mpi 32 | # `rttov * nompi_*` for no mpi 33 | string: {{ mpi_prefix }}_h{{ PKG_HASH }}_{{ build }} 34 | 35 | # mpi builds require the right mpi 36 | # non-mpi builds *do not* appear to require non-mpi builds 37 | # at least not always 38 | {% if mpi != 'nompi' %} 39 | {% set build_pin = mpi_prefix + '_*' %} 40 | {% else %} 41 | {% set build_pin = '' %} 42 | {% endif %} 43 | 44 | run_exports: 45 | - {{ pin_subpackage('rttov', max_pin='x.x') }} {{ build_pin }} 46 | 47 | requirements: 48 | build: 49 | - {{ compiler('c') }} 50 | - {{ compiler('fortran') }} 51 | - python 52 | - numpy 53 | - make 54 | - perl 55 | host: 56 | - python 57 | - numpy 58 | # need to list hdf5 and libnetcdf twice to get version pinning from 59 | # conda_build_config and build pinning from {{ mpi_prefix }} 60 | - {{ mpi }} # [mpi != 'nompi'] 61 | - hdf5 62 | - hdf5 * {{ mpi_prefix }}_* 63 | - libnetcdf 64 | - libnetcdf * {{ mpi_prefix }}_* 65 | - netcdf-fortran 66 | - netcdf-fortran * {{ mpi_prefix }}_* 67 | - libxcrypt 68 | run: 69 | - python 70 | - {{ pin_compatible('numpy') }} 71 | - {{ mpi }} # [mpi != 'nompi'] 72 | - hdf5 * {{ mpi_prefix }}_* 73 | - libnetcdf * {{ mpi_prefix }}_* 74 | - netcdf-fortran * {{ mpi_prefix }}_* 75 | 76 | test: 77 | requires: 78 | - perl 79 | script_env: 80 | - RTTOV_FILES 81 | 82 | about: 83 | home: https://www.nwpsaf.eu/site/software/rttov/ 84 | license: PROPRIETARY 85 | summary: 'A very fast radiative transfer model for spectrometers and interferometers' 86 | 87 | extra: 88 | recipe-maintainers: 89 | - orac_cc 90 | -------------------------------------------------------------------------------- /feedstocks/rttov/run_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # Check libraries are present 5 | test -f ${PREFIX}/lib/librttov13_brdf_atlas.a 6 | test -f ${PREFIX}/lib/librttov13_coef_io.a 7 | test -f ${PREFIX}/lib/librttov13_emis_atlas.a 8 | test -f ${PREFIX}/lib/librttov13_main.a 9 | 10 | if [ -n "$(conda list -p $PREFIX | grep openmpi)" ]; then 11 | ARCH=gfortran-openmp 12 | else 13 | ARCH=gfortran 14 | fi 15 | REL_PATH=`python -c "import os.path; print(os.path.relpath('$PREFIX', '$PWD'))"` 16 | 17 | # Point to local copies of coefficients directory and test inputs 18 | rm -rf rtcoef_rttov13 19 | ln -s $RTTOV_FILES/rtcoef_rttov13 rtcoef_rttov13 20 | rm -rf rttov_test 21 | cp -r $RTTOV_FILES/rttov_test . 22 | 23 | export LD_LIBRARY_PATH="${PREFIX}/lib:${LD_LIBRARY_PATH}" 24 | cd rttov_test 25 | ./test_fwd.sh ARCH=$ARCH BIN=$REL_PATH/bin 26 | ./test_rttov13.sh ARCH=$ARCH BIN=$REL_PATH/bin 27 | ./test_solar.sh ARCH=$ARCH BIN=$REL_PATH/bin 28 | #./test_coef_io.sh ARCH=$ARCH BIN=$REL_PATH/bin 29 | #./test_coef_io_hdf.sh ARCH=$ARCH BIN=$REL_PATH/bin 30 | 31 | # Check pyRTTOV loads 32 | PYTHONPATH=$PREFIX/lib python -c "import pyrttov" 33 | -------------------------------------------------------------------------------- /feedstocks/rttov/tests.patch: -------------------------------------------------------------------------------- 1 | Remove tests for instruments that ORAC doesn't run 2 | --- a/rttov_test/test_fwd.sh 2021-11-09 13:30:18.000000000 +0000 3 | +++ b/rttov_test/test_fwd.sh 2024-08-14 13:16:32.819196558 +0100 4 | @@ -24,20 +24,8 @@ 5 | ./rttov_test.pl SESSION=$SESSION $WHAT $CHECK ARCH=$ARCH $OPTS -- << EOF 6 | TEST_LIST=abi/501 SOLAR=1 7 | TEST_LIST=ahi/501 SOLAR=1 8 | - TEST_LIST=airs/401,airs/561 SOLAR=1 9 | - TEST_LIST=amsre/301 10 | - TEST_LIST=amsua/301,amsua/321clw,amsua/399 11 | - TEST_LIST=amsub/301 12 | TEST_LIST=atsr/501,atsr/502,atsr/503s SOLAR=1 13 | TEST_LIST=avhrr/416,avhrr/417,avhrr/418 SOLAR=1 14 | - TEST_LIST=hirs/417,hirs/517 15 | - TEST_LIST=iasi/401,iasi/561 16 | - TEST_LIST=mhs/301 17 | TEST_LIST=modis/401,modis/521 SOLAR=1 18 | - TEST_LIST=msu/301 19 | TEST_LIST=seviri/404,seviri/524,seviri/599 SOLAR=1 20 | - TEST_LIST=ssmi/308 21 | - TEST_LIST=ssmis/303,ssmis/321 22 | - TEST_LIST=tmi/301 23 | - TEST_LIST=windsat/301,windsat/321 24 | EOF 25 | --- a/rttov_test/test_rttov13.sh 2021-11-09 13:30:18.000000000 +0000 26 | +++ b/rttov_test/test_rttov13.sh 2024-08-14 13:16:50.943161403 +0100 27 | @@ -22,13 +22,6 @@ 28 | CHECK="CHECK=1 TEST_REF=$SESSION.2" 29 | 30 | ./rttov_test.pl SESSION=$SESSION $WHAT $CHECK ARCH=$ARCH $OPTS -- << EOF 31 | - TEST_LIST=amsre/301 32 | - TEST_LIST=amsua/301,amsua/321clw 33 | - TEST_LIST=amsub/301 34 | - TEST_LIST=msu/301 35 | - TEST_LIST=ssmis/301,ssmis/321 36 | - TEST_LIST=windsat/301 37 | - TEST_LIST=hirs/517 APPLY_REG_LIMITS=1 38 | TEST_LIST=modis/401 SOLAR=1 39 | TEST_LIST=seviri/524 SOLAR=1 40 | EOF 41 | -------------------------------------------------------------------------------- /feedstocks/seviri_ml/__init__.py: -------------------------------------------------------------------------------- 1 | __author__ = "Daniel Philipp" 2 | __version__ = "1.0" 3 | __website__ = "https://github.com/danielphilipp/seviri_ml" 4 | -------------------------------------------------------------------------------- /feedstocks/seviri_ml/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Work out which version of Python we're linking against 4 | # numpy include folder 5 | NPINC=$(find ${PREFIX} -type d -wholename "*/numpy/core/include/numpy" -print -quit) 6 | # Directory for Python libraries 7 | NPDIR=${NPINC%%/numpy/core/include/numpy} 8 | # Python linking library 9 | PYLIB=$(find ${PREFIX} -type f -name "libpython*.*.so*" -print -quit) 10 | PYLIB_PATH=${PYLIB%.so*} 11 | if [ -z "$PYLIB_PATH" ]; then 12 | PYLIB=$(find ${PREFIX} -type f -name "libpython*.*.a" -print -quit) 13 | PYLIB_PATH=${PYLIB%.a} 14 | if [ -z "$PYLIB_PATH" ]; then 15 | echo "Cannot locate libpython" 16 | exit 2 17 | fi 18 | fi 19 | PYVER=${PYLIB_PATH##*/libpython} 20 | # Include directory for Python 21 | PYINC=${PREFIX}/include/python${PYVER} 22 | 23 | make NUMPYINCLUDE=${NPINC} PYINCLUDE=${PYINC} 24 | 25 | # Copy over compiled libraries 26 | cp libsevann.a ${PREFIX}/lib 27 | cp seviri_neural_net_m.mod ${PREFIX}/include 28 | 29 | # Install Python code 30 | NEW_DIR=${NPDIR}/seviri_ml 31 | mkdir ${NEW_DIR} 32 | mv *py ${NEW_DIR} 33 | mv modis_like_rgb ${NEW_DIR} 34 | mv sba ${NEW_DIR} 35 | mv nn_driver.txt ${NEW_DIR} 36 | mkdir ${NEW_DIR}/data 37 | mv data/v{1,2,3} ${NEW_DIR}/data 38 | #"${PYTHON}" -m pip install seviri_ml --no-deps --ignore-installed --no-cache-dir -vv 39 | 40 | # Compile tests 41 | cd test 42 | make PY_VER=${PYVER} NUMPYINCLUDE=${NPINC} PYINCLUDE=${PYINC} 43 | cp ctestexe ${PREFIX}/bin/seviri-ml_ctest 44 | cp fort90testexe ${PREFIX}/bin/seviri-ml_ftest 45 | -------------------------------------------------------------------------------- /feedstocks/seviri_ml/init_numpy.patch: -------------------------------------------------------------------------------- 1 | Prevent double definition of init_numpy() by moving out of header 2 | diff --git a/py2c.c b/py2c.c 3 | --- a/py2c.c 4 | +++ b/py2c.c 5 | @@ -9,9 +9,27 @@ 6 | #include 7 | #include 8 | #include 9 | -#include 10 | #include 11 | 12 | +#if(PY_MAJOR_VERSION >=3) 13 | +int init_numpy() 14 | +{ 15 | + if(PyArray_API == NULL) 16 | + { 17 | + import_array1(0); 18 | + } 19 | + return 0; 20 | +} 21 | +#else 22 | +void init_numpy() 23 | +{ 24 | + if(PyArray_API == NULL) 25 | + { 26 | + import_array(); 27 | + } 28 | +} 29 | +#endif 30 | + 31 | 32 | void py_ann_mlay(void *vis006, void *vis008, void *nir016, void *ir039, 33 | void *ir062, void *ir073, void *ir087, void *ir108, 34 | --- a/py2c.h 35 | +++ b/py2c.h 36 | @@ -2,22 +2,10 @@ 37 | #ifndef PY2C_H 38 | #define PY2C_H 39 | 40 | -#if PY_MAJOR_VERSION >=3 41 | -int init_numpy() 42 | -{ 43 | - if(PyArray_API == NULL) 44 | - { 45 | - import_array(); 46 | - } 47 | -} 48 | +#if(PY_MAJOR_VERSION >=3) 49 | +int init_numpy(); 50 | #else 51 | -void init_numpy() 52 | -{ 53 | - if(PyArray_API == NULL) 54 | - { 55 | - import_array(); 56 | - } 57 | -} 58 | +void init_numpy(); 59 | #endif 60 | 61 | void py_ann_mlay(void *vis006, void *vis008, void *nir016, void *ir039, 62 | -------------------------------------------------------------------------------- /feedstocks/seviri_ml/meta.yaml: -------------------------------------------------------------------------------- 1 | {% set version = "1.0" %} 2 | {% set build = 0 %} 3 | 4 | {% set mpi = mpi or 'nompi' %} 5 | 6 | package: 7 | name: seviri_ml 8 | version: {{ version }} 9 | 10 | source: 11 | - git_url: https://github.com/danielphilipp/seviri_ml 12 | patches: 13 | - make.patch 14 | - tensor_import.patch 15 | - test.patch 16 | - module.patch 17 | - path: __init__.py 18 | - path: setup.py 19 | - path: run_test.sh 20 | 21 | build: 22 | number: {{ build }} 23 | {% if mpi != 'nompi' %} 24 | {% set mpi_prefix = "mpi_" + mpi %} 25 | {% else %} 26 | {% set mpi_prefix = "nompi" %} 27 | {% endif %} 28 | # add build string so packages can depend on 29 | # mpi or nompi variants explicitly: 30 | # `rttov * mpi_mpich_*` for mpich 31 | # `rttov * mpi_*` for any mpi 32 | # `rttov * nompi_*` for no mpi 33 | string: {{ mpi_prefix }}_h{{ PKG_HASH }}_{{ build }} 34 | 35 | # mpi builds require the right mpi 36 | # non-mpi builds *do not* appear to require non-mpi builds 37 | # at least not always 38 | {% if mpi != 'nompi' %} 39 | {% set build_pin = mpi_prefix + '_*' %} 40 | {% else %} 41 | {% set build_pin = '' %} 42 | {% endif %} 43 | 44 | run_exports: 45 | - {{ pin_subpackage('seviri_ml', max_pin='x.x') }} 46 | 47 | requirements: 48 | build: 49 | - {{ compiler('c') }} 50 | - {{ compiler('fortran') }} 51 | - python 52 | - make 53 | host: 54 | - {{ mpi }} # [mpi != 'nompi'] 55 | - python 56 | - numpy 57 | - libnetcdf 58 | - libnetcdf * {{ mpi_prefix }}_* 59 | - netcdf-fortran 60 | - netcdf-fortran * {{ mpi_prefix }}_* 61 | - libxcrypt 62 | run: 63 | - {{ mpi }} # [mpi != 'nompi'] 64 | - python 65 | - {{ pin_compatible('numpy') }} 66 | - libnetcdf * {{ mpi_prefix }}_* 67 | - netcdf-fortran * {{ mpi_prefix }}_* 68 | - dask 69 | - joblib 70 | - scikit-learn 71 | - scipy 72 | - tensorflow >=2.4.1,<2.13.0 73 | 74 | test: 75 | source_files: 76 | - test/py_test.py 77 | - test/seviri_ml_test_201907011200.nc 78 | requires: 79 | - cartopy 80 | - hdf5 81 | - matplotlib 82 | - netcdf4 83 | - xarray 84 | 85 | about: 86 | home: https://github.com/danielphilipp/seviri_ml 87 | license: CC 88 | summary: 'Machine learning module to derive cloud properties from SEVIRI' 89 | 90 | extra: 91 | recipe-maintainers: 92 | - orac_cc 93 | - adamcpovey -------------------------------------------------------------------------------- /feedstocks/seviri_ml/run_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | test -f ${PREFIX}/lib/libsevann.a 6 | 7 | # Do tests 8 | export SEVIRI_ML_BACKEND="TENSORFLOW2" 9 | cd test 10 | seviri-ml_ctest 11 | seviri-ml_ftest 12 | ${PYTHON} py_test.py 13 | -------------------------------------------------------------------------------- /feedstocks/seviri_ml/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | from __init__ import __version__, __website__ 3 | 4 | dependencies = ["dask", 5 | "joblib", 6 | "numpy>=1.16", 7 | "satpy"] 8 | 9 | optional_dependencies = {"TensorFlow": ["tensorflow"], 10 | "Theano": ["theano"]} 11 | 12 | test_dependencies = ["xarray", 13 | "matplotlib" 14 | "cartopy"] 15 | 16 | 17 | setup( 18 | name='seviri_ml', 19 | version='1.0', 20 | description='Machine learning module to derive cloud properties from SEVIRI', 21 | maintainer='Daniel Philipp', 22 | url=__website__, 23 | install_requires=dependencies 24 | ) 25 | -------------------------------------------------------------------------------- /feedstocks/seviri_ml/tensor_import.patch: -------------------------------------------------------------------------------- 1 | Workaround an old tensorflow import problem 2 | --- a/helperfuncs.py 2024-08-16 12:19:16.469006627 +0100 3 | +++ b/helperfuncs.py 2024-08-16 12:26:53.504298121 +0100 4 | @@ -130,6 +130,9 @@ 5 | Check if installed Tensorflow version matches the 6 | Tensorflow version used for training. 7 | """ 8 | + import sys 9 | + if not hasattr(sys, "argv") or not sys.argv: 10 | + sys.argv = [""] 11 | import tensorflow 12 | cot_version = modelpath.split('__')[1] 13 | curr_version = tensorflow.__version__ 14 | -------------------------------------------------------------------------------- /feedstocks/seviri_ml/test.patch: -------------------------------------------------------------------------------- 1 | The test environment doesn't compile 2 | diff --git a/py2c.h b/py2c.h 3 | --- a/py2c.h 4 | +++ b/py2c.h 5 | @@ -2,24 +2,11 @@ 6 | #ifndef PY2C_H 7 | #define PY2C_H 8 | 9 | -#if PY_MAJOR_VERSION >=3 10 | -int init_numpy() 11 | -{ 12 | - if(PyArray_API == NULL) 13 | - { 14 | - import_array(); 15 | - } 16 | -} 17 | +#if(PY_MAJOR_VERSION >=3) 18 | +int init_numpy(); 19 | #else 20 | -void init_numpy() 21 | -{ 22 | - if(PyArray_API == NULL) 23 | - { 24 | - import_array(); 25 | - } 26 | -} 27 | +void init_numpy(); 28 | #endif 29 | - 30 | void py_ann_mlay(void *vis006, void *vis008, void *nir016, void *ir039, 31 | void *ir062, void *ir073, void *ir087, void *ir108, 32 | void *ir120, void *ir134, void *lsm, void *skt, 33 | diff --git a/py2c.c b/py2c.c 34 | --- a/py2c.c 35 | +++ b/py2c.c 36 | @@ -9,9 +9,27 @@ 37 | #include 38 | #include 39 | #include 40 | -#include 41 | #include 42 | 43 | +#if(PY_MAJOR_VERSION >=3) 44 | +int init_numpy() 45 | +{ 46 | + if(PyArray_API == NULL) 47 | + { 48 | + import_array1(0); 49 | + } 50 | + return 0; 51 | +} 52 | +#else 53 | +void init_numpy() 54 | +{ 55 | + if(PyArray_API == NULL) 56 | + { 57 | + import_array(); 58 | + } 59 | +} 60 | +#endif 61 | + 62 | 63 | void py_ann_mlay(void *vis006, void *vis008, void *nir016, void *ir039, 64 | void *ir062, void *ir073, void *ir087, void *ir108, 65 | diff --git a/test/py2c.h b/test/py2c.h 66 | --- a/test/c_test.c 67 | +++ b/test/c_test.c 68 | @@ -28,7 +28,7 @@ int main() { 69 | int nx = NX, ny = NY; 70 | int retval; 71 | bool undo_true_refl=false; 72 | - float meanval; 73 | + float meanval=0.0; 74 | 75 | /* Open netCDF file */ 76 | if ((retval = nc_open(FILE_NAME, NC_NOWRITE, &ncid))) 77 | -------------------------------------------------------------------------------- /feedstocks/seviri_util/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | make -j ${CPU_COUNT} all 6 | 7 | mv libseviri_util.a ${PREFIX}/lib 8 | mv seviri_util.mod ${PREFIX}/include 9 | -------------------------------------------------------------------------------- /feedstocks/seviri_util/make.inc: -------------------------------------------------------------------------------- 1 | # C compiler and C compiler flags 2 | 3 | #CC = $(CC) 4 | CCFLAGS = $(CFLAGS) -O2 5 | 6 | # Fortran compiler and Fortan compiler flags (required for the Fortran 7 | # interface) 8 | F90 = $(FC) 9 | F90FLAGS = $(FFLAGS) -O2 10 | 11 | LINKS = -lm 12 | 13 | # Uncomment to compile the Fortran interface and examples 14 | OBJECTS += seviri_util_f90.o 15 | OPTIONAL_TARGETS += example_f90 16 | 17 | # Include and lib directories for non standard locations required by SEVIRI_util 18 | INCDIRS += -I${PREFIX}/include 19 | LIBDIRS += -L${PREFIX}/lib 20 | LINKS += $(LDFLAGS) -lhdf5 -lnetcdf -ltiff -lm 21 | -------------------------------------------------------------------------------- /feedstocks/seviri_util/make.patch: -------------------------------------------------------------------------------- 1 | # Subject: Use conda's ar not the system's 2 | --- a/Makefile 2022-08-12 13:29:36.975770552 +0100 3 | +++ b/Makefile 2023-02-13 10:01:32.181740803 +0000 4 | @@ -24,7 +24,7 @@ 5 | $(OPTIONAL_TARGETS) 6 | 7 | libseviri_util.a: $(OBJECTS) 8 | - ar -rs libseviri_util.a $(OBJECTS) 9 | + $(AR) -rs libseviri_util.a $(OBJECTS) 10 | 11 | seviri_util_f90.o: seviri_util_f90.f90 12 | 13 | -------------------------------------------------------------------------------- /feedstocks/seviri_util/meta.yaml: -------------------------------------------------------------------------------- 1 | {% set version = "1.0.2" %} 2 | 3 | package: 4 | name: seviri_util 5 | version: {{ version }} 6 | 7 | source: 8 | - git_url: https://github.com/gmcgarragh/seviri_util 9 | patches: make.patch 10 | - path: make.inc 11 | 12 | build: 13 | number: 1 14 | run_exports: 15 | - {{ pin_subpackage('seviri_util', max_pin='x.x.x') }} 16 | 17 | requirements: 18 | build: 19 | - {{ compiler('c') }} 20 | - {{ compiler('fortran') }} 21 | host: 22 | - hdf5 23 | - libnetcdf 24 | - libtiff 25 | run: 26 | - hdf5 27 | - libnetcdf 28 | - libtiff 29 | 30 | test: 31 | commands: 32 | - test -f ${PREFIX}/lib/libseviri_util.a # [not win] 33 | 34 | about: 35 | home: http://github.com/gmcgarragh/seviri_util 36 | license: GNU 37 | license_family: GPL 38 | license_file: COPYING 39 | summary: 'Utility to read, write and pre-process SEVIRI data.' 40 | 41 | extra: 42 | recipe-maintainers: 43 | - orac_cc 44 | -------------------------------------------------------------------------------- /patches/epr-api-2.3/src/README: -------------------------------------------------------------------------------- 1 | These files have been changed to enable ATSR-2 data to be read in. They should 2 | replace the files that are in: epr-api-2.3/include/src 3 | -------------------------------------------------------------------------------- /patches/nr/README: -------------------------------------------------------------------------------- 1 | A makefile for the standard Numerical Recipes Fortran 77 distribution since it does not seem to come with one. It is set up for gfortran but can easily be set up for other compilers by setting the F77 and F77FLAGS variables in the Makefile. 2 | -------------------------------------------------------------------------------- /post_processing/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for ORAC post processing 2 | # 3 | # Pre 2012/08/24, CP and MJ: Provide initial version 4 | # 2012/08/24, MJ: creates adds "includes" for better configurability 5 | # 2014/10/09, AP: homogenise with other Makefile layouts 6 | # 2014/02/12, CP: added link to common libraries still need alot of tidying 7 | # though. 8 | # 2015/07/16, GM: Many files removed from the object file list due to a major 9 | # cleanup of the code. 10 | # 11 | # Notes: 12 | # 13 | 14 | # Set files from which compiler, flags, and libraries are set. archfile also 15 | # defines the "$(OBJS)" variable, which places object and module files in a 16 | # subdirectory 17 | include $(ORAC_LIB) 18 | include $(ORAC_ARCH) 19 | 20 | ORAC_COMMON = ../common 21 | 22 | 23 | # Define object files to be linked. 24 | POSTPROC_OBJ = $(OBJS)/orac_input.o \ 25 | $(OBJS)/postproc_constants.o \ 26 | $(OBJS)/postproc_utils.o \ 27 | $(OBJS)/prepare_output_pp.o \ 28 | $(OBJS)/correct_parallax.o \ 29 | 30 | POSTPROC_OBJ_MAIN = $(OBJS)/orac_postproc.o 31 | 32 | 33 | # Compilation rules 34 | $(OBJS)/%.o: %.f90 $(ORAC_COMMON)/liborac_common.a 35 | $(F90) -o $@ -c $(FFLAGS) $(INC) -I$(ORAC_COMMON)/obj $(AUXFLAGS) $< 36 | 37 | $(OBJS)/%.o: %.F90 $(ORAC_COMMON)/liborac_common.a 38 | $(F90) -o $@ -c $(FFLAGS) $(INC) -I$(ORAC_COMMON)/obj $(AUXFLAGS) $< 39 | 40 | # Rule to prevent make from identifying Fortran .mod files as Modula2 source 41 | # files 42 | %.o : %.mod 43 | 44 | 45 | # Main target list 46 | all: orac_postproc 47 | 48 | # Main program build 49 | orac_postproc: $(POSTPROC_OBJ_MAIN) libpostproc.a $(ORAC_COMMON)/liborac_common.a Makefile 50 | $(F90) -o orac_postproc $(LFLAGS) $(POSTPROC_OBJ_MAIN) libpostproc.a $(ORAC_COMMON)/liborac_common.a -I./$(OBJS) $(LIBS) 51 | 52 | # Main library build 53 | libpostproc.a: $(POSTPROC_OBJ) Makefile 54 | $(AR) -rs libpostproc.a $(POSTPROC_OBJ) 55 | 56 | # Rebuild dependencies housed in dependencies.inc 57 | depend: 58 | @../tools/make_depend.pl $(POSTPROC_OBJ) $(POSTPROC_OBJ_MAIN) > dependencies.inc 59 | 60 | clean tidy: 61 | rm -f $(OBJS)/*.o $(OBJS)/*.mod *.a orac_postproc 62 | 63 | 64 | # Object/source dependencies 65 | include dependencies.inc 66 | -------------------------------------------------------------------------------- /post_processing/dependencies.inc: -------------------------------------------------------------------------------- 1 | $(OBJS)/orac_input.o: alloc_input_data.F90 dealloc_input_data.F90 \ 2 | read_input_dimensions.F90 read_input_primary.F90 \ 3 | read_input_secondary.F90 4 | $(OBJS)/postproc_utils.o: $(OBJS)/orac_input.o $(OBJS)/postproc_constants.o 5 | $(OBJS)/prepare_output_pp.o: $(OBJS)/orac_input.o $(OBJS)/postproc_constants.o \ 6 | prepare_output_primary_pp.F90 prepare_output_secondary_pp.F90 7 | $(OBJS)/correct_parallax.o: $(OBJS)/orac_input.o $(OBJS)/postproc_constants.o 8 | $(OBJS)/orac_postproc.o: $(OBJS)/correct_parallax.o $(OBJS)/orac_input.o \ 9 | $(OBJS)/postproc_constants.o $(OBJS)/postproc_utils.o \ 10 | $(OBJS)/prepare_output_pp.o 11 | -------------------------------------------------------------------------------- /post_processing/postproc_constants.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: postproc_constants.F90 3 | ! 4 | ! Purpose: F90 Module file which declares variable types and some parameters. 5 | ! 6 | ! Description and Algorithm details: 7 | ! 8 | ! Arguments: 9 | ! Name Type In/Out/Both Description 10 | ! 11 | ! History: 12 | ! 2012/02/03, MJ: Cleans out prototype code to prepare repository upload. 13 | ! 2012/03/06, CP: Modified to produce post processed files 14 | ! 2012/07/06, MJ: Extensively overhauls and restructures the code 15 | ! 2014/04/01, MJ: Fixes some problems/cleanup with illumination 16 | ! 2014/11/10, OS: Very minor edit 17 | ! 2014/12/03, CP: Removed variables duplicated in common_constants 18 | ! 2015/02/05, OS: Some cleanup; changed nint to lint 19 | ! 2015/02/07, CP: Removed all variables common to common_constants 20 | ! 2015/04/23, OS: Added variables related to NETCDF4 compression 21 | ! 2015/07/16, GM: Major cleanup. 22 | ! 2015/07/26, GM: Changed type specific deflate levels and shuffling flags to 23 | ! just one. 24 | ! 2015/07/26, GM: Removed unused constants. 25 | ! 2017/01/09, CP: ML additions. 26 | ! 27 | ! Bugs: 28 | ! None known. 29 | !------------------------------------------------------------------------------- 30 | 31 | module postproc_constants_m 32 | 33 | use common_constants_m 34 | 35 | implicit none 36 | 37 | ! NetCDF deflate level 38 | integer, parameter :: deflate_level=5 39 | 40 | ! Shuffling to improve compression 41 | logical, parameter :: shuffle_flag=.TRUE. 42 | 43 | ! Values of phase_pavolonis 44 | integer(byte), parameter :: IPhaseClU = 0 ! clear/unknown 45 | integer(byte), parameter :: IPhaseWat = 1 ! Water 46 | integer(byte), parameter :: IPhaseIce = 2 ! Ice 47 | integer(byte), parameter :: IPhaseMul = 3 ! Multi layer 48 | 49 | end module postproc_constants_m 50 | -------------------------------------------------------------------------------- /post_processing/prepare_output_pp.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: prepare_output.F90 3 | ! 4 | ! Purpose: 5 | ! 6 | ! Description and Algorithm details: 7 | ! 8 | ! Arguments: 9 | ! Name Type In/Out/Both Description 10 | ! 11 | ! History: 12 | ! 2015/09/06, GM: Original version created for the parts of output_routines.F90 13 | ! that were not moved into common/ including the prepare routines. 14 | ! 2015/10/07, OS: Renamed to *_pp.F90, as we have to avoid duplicate subroutine 15 | ! names for wrapper. 16 | ! 17 | ! Bugs: 18 | ! None known. 19 | !------------------------------------------------------------------------------- 20 | 21 | module prepare_output_pp_m 22 | 23 | implicit none 24 | 25 | contains 26 | 27 | #include "prepare_output_primary_pp.F90" 28 | #include "prepare_output_secondary_pp.F90" 29 | 30 | end module prepare_output_pp_m 31 | -------------------------------------------------------------------------------- /post_processing/read_input_dimensions.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: read_input_dimensions.F90 3 | ! 4 | ! Purpose: 5 | ! The file contains a collection of subroutines which define netcdf output for 6 | ! different attribute/variable type combinations. 7 | ! 8 | ! Description and Algorithm details: 9 | ! 10 | ! Arguments: 11 | ! Name Type In/Out/Both Description 12 | ! 13 | ! History: 14 | ! 2014/06/04, MJ: Changes routine names to "*_pp" to avoid confusion when 15 | ! building libraries. 16 | ! 2014/12/03, CP: Added in common_constants should eventually remove 17 | ! postproc_constants 18 | ! 2015/02/05, OS: Changed nint to lint 19 | ! 2015/02/05, CP: Updated constants file 20 | ! 2015/07/10, GM: Major cleanup and made use of the NetCDF interface in the 21 | ! common library. 22 | ! 2016/03/03, AP: Homogenisation of I/O modules. 23 | ! 2017/01/02, AP: filename read more robust 24 | ! 25 | ! Bugs: 26 | ! None known. 27 | !------------------------------------------------------------------------------- 28 | 29 | subroutine read_input_dimensions(fname, indexing, verbose) 30 | 31 | use orac_ncdf_m 32 | 33 | implicit none 34 | 35 | character(len=*), intent(in) :: fname 36 | type(input_indices_t), intent(out) :: indexing 37 | logical, intent(in) :: verbose 38 | 39 | integer :: ncid, ierr 40 | 41 | ! Open file 42 | 43 | call ncdf_open(ncid, fname, 'read_input_dimensions()') 44 | call nullify_indexing(indexing) 45 | 46 | indexing%Xdim = ncdf_dim_length(ncid, 'across_track', 'read_input_dimensions()') 47 | indexing%Ydim = ncdf_dim_length(ncid, 'along_track', 'read_input_dimensions()') 48 | indexing%Ny = ncdf_dim_length(ncid, 'channels', 'read_input_dimensions()') 49 | indexing%NViews = ncdf_dim_length(ncid, 'views', 'read_input_dimensions()') 50 | 51 | ! Read attributes that should eventually be dimensions 52 | ierr = nf90_get_att(ncid, NF90_GLOBAL, 'NState', indexing%Nx) 53 | if (ierr /= NF90_NOERR) then 54 | write(*,*) 'ERROR: read_input_dimensions(), ', trim(nf90_strerror(ierr)), & 55 | ', name: NState' 56 | stop error_stop_code 57 | end if 58 | 59 | ! Close msi file 60 | call ncdf_close(ncid, 'read_input_dimensions()') 61 | 62 | end subroutine read_input_dimensions 63 | -------------------------------------------------------------------------------- /pre_processing/create_time_for_pixel.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: create_time_for_pixel.F90 3 | ! 4 | ! Purpose: 5 | ! Compute time for each pixel from AVHRR start and end time of orbit 6 | ! 7 | ! Description and Algorithm details: 8 | ! 1) Assume each across track row is observed at once and each has the same 9 | ! duration. 10 | ! 2) Convert into a Julian date and output. 11 | ! 12 | ! Arguments: 13 | ! Name Type In/Out/Both Description 14 | ! ------------------------------------------------------------------------------ 15 | ! ixstart lint in First pixel to read across track 16 | ! ixstop lint in Last pixel to read across track 17 | ! iystart lint in First pixel to read along track 18 | ! iystop lint in Last pixel to read along track 19 | ! n_along_track lint in Number of pixels available in the 20 | ! startepochs lint in Start time for the orbit, in seconds 21 | ! endepochs lint in End time for the orbit, in seconds 22 | ! imager_time struct both Summary of pixel observation time 23 | ! refjulianday dreal in Julian day number for reference date 24 | ! 25 | ! History: 26 | ! 2012/06/14, MJ: produces draft code 27 | ! 2013/09/06, AP: tidying 28 | ! 29 | ! Bugs: 30 | ! None known. 31 | !------------------------------------------------------------------------------- 32 | 33 | subroutine create_time_for_pixel(ixstart,ixstop,iystart,iystop,n_along_track, & 34 | startepochs,endepochs,imager_time,refjulianday) 35 | 36 | use imager_structures_m 37 | use preproc_constants_m 38 | 39 | implicit none 40 | 41 | integer(kind=lint), intent(in) :: ixstart,ixstop,iystart,iystop 42 | integer(kind=lint), intent(in) :: n_along_track 43 | integer(kind=lint), intent(in) :: startepochs,endepochs 44 | type(imager_time_t), intent(inout) :: imager_time 45 | real(kind=dreal), intent(in) :: refjulianday 46 | 47 | integer(kind=lint) :: jy 48 | real(kind=dreal) :: deltime 49 | real(kind=dreal) :: temp(ixstart:ixstop,iystart:iystop) 50 | 51 | deltime=(endepochs-startepochs)/real(n_along_track,kind=dreal) 52 | 53 | do jy=iystart,iystop 54 | temp(:,jy)=real(startepochs,kind=dreal)+(jy-1)*deltime 55 | end do 56 | 57 | ! Divide TAI seconds since 1/1/1970 by 86400 (every day has in the TAI system 58 | ! precisely this amount of seconds) and add to Julian date of 1/1/1970. 59 | ! This gives the Julian date of the observation for each pixel. 60 | temp=refjulianday+temp/real(86400,kind=dreal) 61 | 62 | imager_time%time=temp 63 | 64 | end subroutine create_time_for_pixel 65 | -------------------------------------------------------------------------------- /pre_processing/deallocate_channel_info.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: deallocate_channel_info.F90 3 | ! 4 | ! Purpose: 5 | ! Deallocate the array parts of the types defined in channel_info.F90 6 | ! 7 | ! Description and Algorithm details: 8 | ! 1) Deallocate all fields of structure. 9 | ! 10 | ! Arguments: 11 | ! Name Type In/Out/Both Description 12 | ! ------------------------------------------------------------------------------ 13 | ! channel_info struct both Summary of imager channel properties 14 | ! 15 | ! History: 16 | ! 2012/06/04, MJ: produces draft code- 17 | ! 2014/10/15, GM: Added deallocation of map_ids_abs_to_ref_band_land and 18 | ! map_ids_abs_to_ref_band_sea and removed deallocation of channel_proc_flag. 19 | ! 2015/01/15, AP: Eliminate channel_ids_abs. 20 | ! 2015/03/04, GM: Added map_ids_abs_to_snow_and_ice. 21 | ! 2016/07/01, GT: Added map_ids_sw_to_channel and map_ids_lw_to_channel. 22 | ! 2016/08/04, GM: Added map_ids_channel_to_sw and map_ids_channel_to_lw. 23 | ! 24 | ! Bugs: 25 | ! None known. 26 | !------------------------------------------------------------------------------- 27 | 28 | subroutine deallocate_channel_info(channel_info) 29 | 30 | implicit none 31 | 32 | type(channel_info_t), intent(inout) :: channel_info 33 | 34 | deallocate(channel_info%channel_ids_instr) 35 | deallocate(channel_info%channel_wl_abs) 36 | deallocate(channel_info%map_ids_sw_to_channel) 37 | deallocate(channel_info%map_ids_lw_to_channel) 38 | deallocate(channel_info%map_ids_channel_to_sw) 39 | deallocate(channel_info%map_ids_channel_to_lw) 40 | deallocate(channel_info%channel_view_ids) 41 | deallocate(channel_info%channel_sw_flag) 42 | deallocate(channel_info%channel_lw_flag) 43 | deallocate(channel_info%channel_ids_rttov_coef_sw) 44 | deallocate(channel_info%channel_ids_rttov_coef_lw) 45 | deallocate(channel_info%map_ids_abs_to_ref_band_land) 46 | deallocate(channel_info%map_ids_abs_to_ref_band_sea) 47 | deallocate(channel_info%map_ids_abs_to_snow_and_ice) 48 | deallocate(channel_info%channel_fractional_uncertainty) 49 | deallocate(channel_info%channel_minimum_uncertainty) 50 | deallocate(channel_info%channel_fm_lnd_uncertainty) 51 | deallocate(channel_info%channel_fm_sea_uncertainty) 52 | deallocate(channel_info%sw_rttov_viewone_id) 53 | deallocate(channel_info%sw_view_ids) 54 | deallocate(channel_info%lw_rttov_viewone_id) 55 | deallocate(channel_info%lw_view_ids) 56 | 57 | end subroutine deallocate_channel_info 58 | -------------------------------------------------------------------------------- /pre_processing/deallocate_ecmwf_structures.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: deallocate_ecmwf_structures.F90 3 | ! 4 | ! Purpose: 5 | ! Deallocate the array parts of the types defined in ecmwf_structures.F90 6 | ! 7 | ! Description and Algorithm details: 8 | ! 1) Deallocate all arrays. 9 | ! 10 | ! Arguments: 11 | ! Name Type In/Out/Both Description 12 | ! ------------------------------------------------------------------------------ 13 | ! ecmwf struct both Structure summarising contents of ECMWF files. 14 | ! 15 | ! History: 16 | ! 2012/01/13, MJ: produces draft code for ERA Interim grib 1 parameters required 17 | ! 2014/05/07, AP: new version of structures 18 | ! 2014/11/04, OS: added deallocation of skin temperature 19 | ! 2014/11/04, OS: added deallocation of snow_depth and sea_ice_cover 20 | ! 2015/12/17, OS: Added low_res flag. 21 | ! 22 | ! Bugs: 23 | ! None known. 24 | !------------------------------------------------------------------------------- 25 | 26 | subroutine deallocate_ecmwf_structures(ecmwf) 27 | 28 | use preproc_constants_m 29 | 30 | implicit none 31 | 32 | type(ecmwf_t), intent(inout) :: ecmwf 33 | 34 | deallocate(ecmwf%lon) 35 | deallocate(ecmwf%lat) 36 | deallocate(ecmwf%avec) 37 | deallocate(ecmwf%bvec) 38 | deallocate(ecmwf%u10) 39 | deallocate(ecmwf%v10) 40 | deallocate(ecmwf%skin_temp) 41 | deallocate(ecmwf%snow_depth) 42 | deallocate(ecmwf%sea_ice_cover) 43 | 44 | end subroutine deallocate_ecmwf_structures 45 | -------------------------------------------------------------------------------- /pre_processing/deallocate_surface_structures.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: deallocate_surface_structures.F90 3 | ! 4 | ! Purpose: 5 | ! Deallocate the array parts of the types defined in surface_structures.F90 6 | ! 7 | ! Description and Algorithm details: 8 | ! 1) Deallocate all fields of structure. 9 | ! 10 | ! Arguments: 11 | ! Name Type In/Out/Both Description 12 | ! ------------------------------------------------------------------------------ 13 | ! surface struct both Summary of surface properties 14 | ! 15 | ! History: 16 | ! 2012/05/01, GT: First version 17 | ! 2014/08/10, GM: Changes related to new BRDF support. 18 | ! 2014/10/23, OS: added deallocation of nise_mask 19 | ! 2014/12/02, GM: Remove unused surface%albedo_chan and surface%emissivity_chan. 20 | ! 2016/03/31, GM: Changes to support processing only SW or only LW channels. 21 | ! 22 | ! Bugs: 23 | ! None known. 24 | !------------------------------------------------------------------------------- 25 | 26 | subroutine deallocate_surface_structures(surface,channel_info,include_full_brdf) 27 | 28 | use channel_structures_m 29 | use preproc_constants_m 30 | 31 | implicit none 32 | 33 | type(surface_t), intent(inout) :: surface 34 | type(channel_info_t), intent(in) :: channel_info 35 | logical, intent(in) :: include_full_brdf 36 | 37 | deallocate(surface%nise_mask) 38 | 39 | if (channel_info%nchannels_sw .ne. 0) then 40 | deallocate(surface%albedo) 41 | 42 | if (include_full_brdf) then 43 | deallocate(surface%rho_0v) 44 | deallocate(surface%rho_0d) 45 | deallocate(surface%rho_dv) 46 | deallocate(surface%rho_dd) 47 | end if 48 | end if 49 | 50 | if (channel_info%nchannels_lw .ne. 0) then 51 | deallocate(surface%emissivity) 52 | end if 53 | 54 | end subroutine deallocate_surface_structures 55 | -------------------------------------------------------------------------------- /pre_processing/fundamental_constants.inc: -------------------------------------------------------------------------------- 1 | !----------------------------------------------------------------------- 2 | ! This code is part of the International MODIS/AIRS Processing Package 3 | ! (IMAPP) licensed under the GNU General Public License (GPL), Version 4 | ! 3, and available at http://cimss.ssec.wisc.edu/imapp/. 5 | !----------------------------------------------------------------------- 6 | 7 | !----------------------------------------------------------------------- 8 | ! !F77-INC 9 | ! 10 | ! !DESCRIPTION: 11 | ! Fundamental constants for Planck functions. 12 | ! 13 | ! !INPUT PARAMETERS: 14 | ! None 15 | ! 16 | ! !OUTPUT PARAMETERS: 17 | ! None 18 | ! 19 | ! !REVISION HISTORY: 20 | ! 21 | ! !TEAM-UNIQUE HEADER: 22 | ! Developed by the MODIS Group, CIMSS/SSEC, UW-Madison. 23 | ! 24 | ! !END 25 | !----------------------------------------------------------------------- 26 | 27 | ! Fundamental constants required for the monochromatic 28 | ! Planck function routines PLANCK_M, PLANC_M, BRIGHT_M, BRITE_M 29 | ! 30 | ! Taken from the NIST Reference on Constants, Units, and Uncertainty 31 | ! 32 | ! http://physics.nist.gov/cuu/Constants/ 33 | ! 34 | ! See also: 35 | ! 36 | ! Mohr, P.J. and B.N. Taylor, "CODATA recommended values of the 37 | ! fundamental physical constants: 1998", Reviews of Modern Physics, 38 | ! Vol.72, No.2, 2000. 39 | 40 | ! ... Planck constant (Joule second) 41 | double precision h 42 | parameter (h = 6.62606876d-34) 43 | 44 | ! ... Speed of light in vacuum (meters per second) 45 | double precision c 46 | parameter (c = 2.99792458d+08) 47 | 48 | ! ... Boltzmann constant (Joules per Kelvin) 49 | double precision k 50 | parameter (k = 1.3806503d-23) 51 | 52 | ! ... Derived constants 53 | double precision c1, c2 54 | parameter (c1 = 2.0d+0 * h * c * c) 55 | parameter (c2 = (h * c) / k) 56 | -------------------------------------------------------------------------------- /pre_processing/netcdf_output_close.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: netcdf_output_close.F90 3 | ! 4 | ! Purpose: 5 | ! Close netcdf output files 6 | ! 7 | ! Description and Algorithm details: 8 | ! 1) Call NF90_CLOSE several times. 9 | ! 10 | ! Arguments: 11 | ! Name Type In/Out/Both Description 12 | ! ------------------------------------------------------------------------------ 13 | ! netcdf_info struct In Summary of output file details 14 | ! 15 | ! History: 16 | ! 2011/12/12, MJ: produces draft code which creates dummy output files 17 | ! 2013/11/06, MJ: adds config file to preprocessing output which holds all 18 | ! relevant dimensional information. 19 | ! 2014/02/06, AP: removing unnecessary NCDF routines 20 | ! 2015/02/04, GM: Terminate on error like all the other NetCDF calls. 21 | ! 2015/07/03, OS: Corrected error message for clf.nc file 22 | ! 23 | ! Bugs: 24 | ! None known. 25 | !------------------------------------------------------------------------------- 26 | 27 | subroutine netcdf_output_close(netcdf_info, use_seviri_ann_ctp_fg) 28 | 29 | use orac_ncdf_m, only: ncdf_close 30 | use preproc_constants_m 31 | 32 | implicit none 33 | 34 | type(netcdf_output_info_t), intent(in) :: netcdf_info 35 | logical, intent(in) :: use_seviri_ann_ctp_fg 36 | 37 | call ncdf_close(netcdf_info%ncid_alb, 'netcdf_create_config(): ".alb.nc"') 38 | call ncdf_close(netcdf_info%ncid_clf, 'netcdf_create_config(): ".clf.nc"') 39 | call ncdf_close(netcdf_info%ncid_config, 'netcdf_create_config(): ".config.nc"') 40 | call ncdf_close(netcdf_info%ncid_geo, 'netcdf_create_config(): ".geo.nc"') 41 | call ncdf_close(netcdf_info%ncid_loc, 'netcdf_create_config(): ".loc.nc"') 42 | call ncdf_close(netcdf_info%ncid_lsf, 'netcdf_create_config(): ".lsf.nc"') 43 | call ncdf_close(netcdf_info%ncid_lwrtm, 'netcdf_create_config(): ".lwrtm.nc"') 44 | call ncdf_close(netcdf_info%ncid_msi, 'netcdf_create_config(): ".msi.nc"') 45 | call ncdf_close(netcdf_info%ncid_prtm, 'netcdf_create_config(): ".prtm.nc"') 46 | call ncdf_close(netcdf_info%ncid_swrtm, 'netcdf_create_config(): ".swrtm.nc"') 47 | #ifdef INCLUDE_SEVIRI_NEURALNET 48 | if (use_seviri_ann_ctp_fg) then 49 | call ncdf_close(netcdf_info%ncid_ctp, 'netcdf_create_config(): ".ctp.nc"') 50 | end if 51 | #endif 52 | 53 | end subroutine netcdf_output_close 54 | -------------------------------------------------------------------------------- /pre_processing/nsidc_nise.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: nise.F90 3 | ! 4 | ! Purpose: 5 | ! Module for NISE sea ice data read routines. 6 | ! 7 | ! History: 8 | ! 2014/05/23, GM: First version. 9 | ! 10 | ! Bugs: 11 | ! None known. 12 | !------------------------------------------------------------------------------- 13 | 14 | module nsidc_nise_m 15 | 16 | implicit none 17 | 18 | type nise_grid_t 19 | integer(kind=4) :: nx, ny 20 | real(kind=4) :: res 21 | real(kind=4) :: REarth 22 | real(kind=4), dimension(2) :: grid_centre 23 | integer(kind=2), allocatable, dimension(:,:) :: age 24 | integer(kind=2), allocatable, dimension(:,:) :: extent 25 | end type nise_grid_t 26 | 27 | type nise_t 28 | type(nise_grid_t) :: north 29 | type(nise_grid_T) :: south 30 | end type nise_t 31 | 32 | contains 33 | 34 | #include "read_nsidc_nise.F90" 35 | 36 | end module nsidc_nise_m 37 | -------------------------------------------------------------------------------- /pre_processing/preproc_constants.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: preproc_constants.F90 3 | ! 4 | ! Purpose: 5 | ! Module defining data types, string lengths, constants etc. 6 | ! 7 | ! History: 8 | ! 2011/12/09, MJ: produces draft code with basic data types and lengths 9 | ! 2012/04/19, GT: Added value of pi. 10 | ! 2013/11/27, MJ: adds parameters for netcdf4 compression 11 | ! 2014/01/23, MJ: switches nc4 shuffling off. 12 | ! 2014/01/30, MJ: removes parameters for chunking. 13 | ! 2014/03/11, MJ: introduces variable for file chunking. 14 | ! 2014/07/11, AP: Removing unnecessary fields. Shortening date_length. 15 | ! 2014/08/05, AP: Adding missing fill value. 16 | ! 2014/08/06, GM: Corrected the value for Pi. 17 | ! 2014/08/06, GM: d2r is a derived constant. It should be computed. 18 | ! 2014/08/30, GM: Removed pi and d2r as they are in common_constants_m. 19 | ! 2014/08/31, GM: Removed unused lengths and made compress_level_* and 20 | ! shuffle_* names consistent with their ORAC type names. 21 | ! 2014/09/16, GM: Rename the deflate_level_* and shuffle_* parameters to be 22 | ! consistent with ORAC kinds. 23 | ! 2015/07/26, GM: Changed type specific deflate levels and shuffling flags to 24 | ! just one. 25 | ! 26 | ! Bugs: 27 | ! None known. 28 | !------------------------------------------------------------------------------- 29 | 30 | module preproc_constants_m 31 | 32 | use common_constants_m 33 | 34 | implicit none 35 | 36 | 37 | real(kind=sreal), parameter :: dither=1.0E-3 38 | real(kind=sreal), parameter :: dither_more=1.0E-7 39 | 40 | 41 | ! Physical constants 42 | real(kind=sreal), parameter :: pa2hpa=0.01 43 | 44 | ! Specific gas constants of dry air and water vapor 45 | real(kind=sreal), parameter :: r_dry_air=287.05 46 | real(kind=sreal), parameter :: r_water_vap=461.51 47 | 48 | 49 | real(kind=sreal), parameter :: maxsza_day=80.0 50 | real(kind=sreal), parameter :: maxsza_twi=110.0 51 | 52 | 53 | ! Some NetCDF related parameters 54 | 55 | ! NetCDF deflate level 56 | integer(kind=lint), parameter :: deflate_level=0 57 | 58 | ! Shuffling to improve compression 59 | logical, parameter :: shuffle_flag=.FALSE. 60 | 61 | end module preproc_constants_m 62 | -------------------------------------------------------------------------------- /pre_processing/read_aatsr.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: read_aatsr.F90 3 | ! 4 | ! Purpose: 5 | ! Module for AATSR read routines. 6 | ! 7 | ! History: 8 | ! 2014/05/23, GM: First version. 9 | ! 10 | ! Bugs: 11 | ! None known. 12 | !------------------------------------------------------------------------------- 13 | 14 | module read_aatsr_m 15 | 16 | implicit none 17 | 18 | contains 19 | 20 | #include "read_aatsr_dimensions.F90" 21 | #include "read_aatsr_l1b.F90" 22 | 23 | end module read_aatsr_m 24 | -------------------------------------------------------------------------------- /pre_processing/read_abi.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: read_abi.F90 3 | ! 4 | ! Purpose: 5 | ! Module for GOES-16 series read routines. 6 | ! 7 | ! History: 8 | ! 2018/02/10, SP: First version. 9 | ! 2018/10/26, SP: Rename to prevent clashes with GOES-Imager reader 10 | ! 2018/11/19, SP: Remove C version of solar position calculator, replace with F 11 | ! 12 | ! Bugs: 13 | ! None known. 14 | !------------------------------------------------------------------------------- 15 | 16 | module read_abi_m 17 | 18 | implicit none 19 | 20 | contains 21 | 22 | #include "read_abi_main.F90" 23 | #include "read_abi_funcs.F90" 24 | 25 | end module read_abi_m 26 | -------------------------------------------------------------------------------- /pre_processing/read_avhrr.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: read_avhrr.F90 3 | ! 4 | ! Purpose: 5 | ! Module for AVHRR read routines. 6 | ! 7 | ! History: 8 | ! 2014/05/23, GM: First version. 9 | ! 10 | ! Bugs: 11 | ! None known. 12 | !------------------------------------------------------------------------------- 13 | 14 | module read_avhrr_m 15 | 16 | implicit none 17 | 18 | contains 19 | 20 | #include "create_time_for_pixel.F90" 21 | #include "read_avhrr_angles.F90" 22 | #include "read_avhrr_dimensions.F90" 23 | #include "read_avhrr_l1b_radiances.F90" 24 | #include "read_avhrr_l1b_radiances_2.F90" 25 | #include "read_avhrr_land_sea_mask.F90" 26 | #include "read_avhrr_land_sea_mask_2.F90" 27 | #include "read_avhrr_lat_lon.F90" 28 | #include "read_avhrr_time.F90" 29 | #include "read_avhrr_time_lat_lon_angles.F90" 30 | 31 | end module read_avhrr_m 32 | -------------------------------------------------------------------------------- /pre_processing/read_avhrr_time.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: read_avhrr_time.F90 3 | ! 4 | ! Purpose: 5 | ! Read AVHRR time geolocation data 6 | ! 7 | ! Description and Algorithm details: 8 | ! 1) Open the attribute group. 9 | ! 2) Read the attributes. 10 | ! 3) Close the file. 11 | ! 12 | ! Arguments: 13 | ! Name Type In/Out/Both Description 14 | ! ------------------------------------------------------------------------------ 15 | ! fid HID_T in HDF file ID from H5Fopen_f 16 | ! attrgroup string in Group in which 17 | ! startepochs lint out Start time for the orbit, in seconds 18 | ! endepochs lint out End time for the orbit, in seconds 19 | ! 20 | ! History: 21 | ! 2012/01/24, MJ: adds code to read AVHRR HDF5 file. 22 | ! 2013/09/06, AP: tidying 23 | ! 24 | ! Bugs: 25 | ! None known. 26 | !------------------------------------------------------------------------------- 27 | 28 | subroutine read_avhrr_time(fid, attrgroup, startepochs, endepochs) 29 | 30 | use hdf5 31 | use preproc_constants_m 32 | 33 | implicit none 34 | 35 | integer(kind=HID_T), intent(in) :: fid 36 | character(len=*), intent(in) :: attrgroup 37 | integer(kind=lint), intent(out) :: startepochs,endepochs 38 | 39 | integer :: err_code 40 | 41 | integer(kind=HID_T) :: dset_id2,attr_id 42 | 43 | integer(kind=HSIZE_T) :: adims(1) 44 | 45 | !open data group where attributes are stored 46 | call h5gopen_f(fid,attrgroup,dset_id2,err_code) 47 | !because those are all scalar attributes 48 | adims(1)=1 49 | 50 | !startepochs 51 | !get attribute id 52 | call h5aopen_name_f(dset_id2,'startepochs',attr_id,err_code) 53 | !read now the attribute 54 | call h5aread_f(attr_id,H5T_NATIVE_INTEGER,startepochs,adims,err_code) 55 | !close attribute 56 | call h5aclose_f(attr_id,err_code) 57 | 58 | !startepochs 59 | !get attribute id 60 | call h5aopen_name_f(dset_id2,'endepochs',attr_id,err_code) 61 | !read now the attribute 62 | call h5aread_f(attr_id,H5T_NATIVE_INTEGER,endepochs,adims,err_code) 63 | !close attribute 64 | call h5aclose_f(attr_id,err_code) 65 | 66 | !close attribute group 67 | call h5gclose_f(dset_id2, err_code) 68 | 69 | end subroutine read_avhrr_time 70 | -------------------------------------------------------------------------------- /pre_processing/read_modis.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: read_modis.F90 3 | ! 4 | ! Purpose: 5 | ! Module for MODIS read routines. 6 | ! 7 | ! History: 8 | ! 2014/05/15, GM: First version. 9 | ! 10 | ! Bugs: 11 | ! None known. 12 | !------------------------------------------------------------------------------- 13 | 14 | module read_modis_m 15 | 16 | implicit none 17 | 18 | contains 19 | 20 | #include "get_modis_time.F90" 21 | #include "map_time_to_pixel.F90" 22 | #include "modis_bright.F90" 23 | #include "read_modis_l1b_radiances.F90" 24 | #include "read_modis_l1b_radiances_2.F90" 25 | #include "read_modis_angles.F90" 26 | #include "read_modis_dimensions.F90" 27 | #include "read_modis_land_sea_mask.F90" 28 | #include "read_modis_lat_lon.F90" 29 | #include "read_modis_time.F90" 30 | #include "read_modis_time_lat_lon_angles.F90" 31 | 32 | end module read_modis_m 33 | -------------------------------------------------------------------------------- /pre_processing/read_modis_dimensions.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: read_modis_dimensions.F90 3 | ! 4 | ! Purpose: 5 | ! Open geo input file to determine the size of the data array for the purposes 6 | ! of dynamic array allocation. 7 | ! 8 | ! Description and Algorithm details: 9 | ! 1) Open geolocation file 10 | ! 2) Access the Latitude field and output its dimensions 11 | ! 3) Close file 12 | ! 13 | ! Arguments: 14 | ! Name Type In/Out/Both Description 15 | ! ------------------------------------------------------------------------------ 16 | ! path_to_geo_file string in Full path to geolocation file 17 | ! n_across_track lint out Number of pixels available perpendicular to the 18 | ! direction of travel 19 | ! n_along_track lint out Number of pixels in the direction of travel 20 | ! 21 | ! History: 22 | ! 2011/12/12, MJ: produces draft code which opens and reads MODIS geo hdf files 23 | ! 2013/09/11, AP: tidying, removed path_to_l1b_file 24 | ! 25 | ! Bugs: 26 | ! None known. 27 | !------------------------------------------------------------------------------- 28 | 29 | subroutine read_modis_dimensions(path_to_geo_file, n_across_track, n_along_track) 30 | 31 | use preproc_constants_m 32 | use hdf_m, only: DFACC_READ 33 | 34 | implicit none 35 | 36 | character(len=*), intent(in) :: path_to_geo_file 37 | integer(kind=lint), intent(out) :: n_across_track, n_along_track 38 | 39 | integer :: geo_id, dims(2), err_code 40 | integer :: dummy_var_id, dummy_rank, dummy_type, & 41 | dummy_numattrs 42 | character(len=MAX_NC_NAME) :: dummy_name 43 | 44 | integer(kind=4), external :: sfstart, sfselect, sfn2index, sfginfo 45 | integer(kind=4), external :: sfendacc, sfend 46 | 47 | ! this only serves to get us the dimensions of the granule 48 | geo_id = sfstart(path_to_geo_file, DFACC_READ) 49 | dummy_var_id = sfselect(geo_id, sfn2index(geo_id, "Latitude")) 50 | err_code = sfginfo(dummy_var_id, dummy_name, dummy_rank, dims, dummy_type, & 51 | dummy_numattrs) 52 | 53 | n_across_track = dims(1) 54 | n_along_track = dims(2) 55 | 56 | err_code = sfendacc(dummy_var_id) 57 | err_code = sfend(geo_id) 58 | 59 | end subroutine read_modis_dimensions 60 | -------------------------------------------------------------------------------- /pre_processing/read_modis_land_sea_mask.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: read_modis_land_sea_mask.F90 3 | ! 4 | ! Purpose: 5 | ! Open and read L1b and geo input files 6 | ! 7 | ! Description and Algorithm details: 8 | ! 1) Set start, end, and stride of data read. 9 | ! 2) Read data with SFRDATA. 10 | ! 3) Set all fill values to -1. 11 | ! 12 | ! Arguments: 13 | ! Name Type In/Out/Both Description 14 | ! ------------------------------------------------------------------------------ 15 | ! fid int in A file ID returned by SFSTART 16 | ! SDS_name string in Name of the data field to read 17 | ! ixstart lint in First pixel to read across track 18 | ! ixstop lint in Last pixel to read across track 19 | ! iystart lint in First pixel to read along track 20 | ! iystop lint in Last pixel to read along track 21 | ! btemp byte both Initialised array into which data is stored 22 | ! 23 | ! History: 24 | ! 2011/12/15, MJ: produces draft code which opens and reads MODIS ls flag 25 | ! 2013/09/06, AP: tidying, fixed bug where uninitialised array temp was used, 26 | ! added where statement (if desired) 27 | ! 28 | ! Bugs: 29 | ! None known. 30 | !------------------------------------------------------------------------------- 31 | 32 | subroutine read_modis_land_sea_mask(fid,SDS_name,ixstart,ixstop,iystart,iystop,btemp) 33 | 34 | use preproc_constants_m 35 | 36 | implicit none 37 | 38 | integer, intent(in) :: fid 39 | character(len=*), intent(in) :: SDS_name 40 | integer, intent(in) :: ixstart, ixstop, iystart, iystop 41 | integer(kind=byte), intent(out) :: btemp(ixstart:ixstop,iystart:iystop) 42 | 43 | integer :: err_code 44 | integer :: file_id, var_id, attr_id 45 | integer :: start(2), stride(2), edge(2) 46 | 47 | integer(kind=byte) :: fv 48 | 49 | integer(kind=4), external :: sfselect, sfn2index, sffattr, sfrattr, sfrdata 50 | integer(kind=4), external :: sfendacc 51 | 52 | start(1) = ixstart-1 53 | start(2) = iystart-1 54 | stride = 1 55 | edge(1) = ixstop-ixstart+1 56 | edge(2) = iystop-iystart+1 57 | 58 | file_id = fid 59 | var_id = sfselect(file_id, sfn2index(file_id, SDS_name)) 60 | 61 | ! read data into array 62 | btemp = -1 63 | err_code = sfrdata(var_id, start, stride, edge, btemp) 64 | 65 | attr_id=sffattr(var_id, "_FillValue") 66 | err_code=sfrattr(var_id, attr_id, fv) 67 | 68 | ! overwrite fill value with ORAC value 69 | where(btemp .eq. fv) btemp=-1 70 | 71 | err_code=sfendacc(var_id) 72 | 73 | end subroutine read_modis_land_sea_mask 74 | -------------------------------------------------------------------------------- /pre_processing/read_modis_time.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: read_modis_time.F90 3 | ! 4 | ! Purpose: 5 | ! Read MODIS time data from hdf file 6 | ! 7 | ! Description and Algorithm details: 8 | ! 1) Set start, end, and stride of data read. 9 | ! 2) Read data with SFRDATA. 10 | ! 11 | ! Arguments: 12 | ! Name Type In/Out/Both Description 13 | ! ------------------------------------------------------------------------------ 14 | ! fid int in A file ID returned by SFSTART 15 | ! SDS_name string in Name of the data field to read 16 | ! startyy lint in First pixel to read across track 17 | ! stopyy lint in Last pixel to read across track 18 | ! temp dreal both Initialised array into which data is stored 19 | ! 20 | ! History: 21 | ! 2011/12/16, MJ: produces draft code 22 | ! 2013/09/11, AP: tidying, removed fv 23 | ! 24 | ! Bugs: 25 | ! None known. 26 | !------------------------------------------------------------------------------- 27 | 28 | subroutine read_modis_time(fid,SDS_name,startyy,stopyy,temp) 29 | 30 | use preproc_constants_m 31 | 32 | implicit none 33 | 34 | integer, intent(in) :: fid 35 | character(len=*), intent(in) :: SDS_name 36 | integer(kind=lint), intent(in) :: startyy, stopyy 37 | real(kind=dreal), intent(out) :: temp(startyy:stopyy-1) 38 | 39 | integer :: err_code 40 | 41 | integer :: file_id, var_id !, attr_id 42 | integer :: start(1), stride(1), edge(1) 43 | 44 | integer(kind=4), external :: sfselect, sfn2index, sfrdata, sfendacc 45 | 46 | start(1) = startyy-1 47 | stride = 1 48 | edge(1) = stopyy-startyy+1 49 | 50 | file_id = fid 51 | var_id = sfselect(file_id, sfn2index(file_id, SDS_name)) 52 | 53 | err_code = sfrdata(var_id, start, stride, edge, temp) 54 | 55 | ! no need for fill value so commented out (assumes all data fine) 56 | ! attr_id=sffattr(var_id, "_FillValue") 57 | ! err_code=sfrattr(var_id, attr_id, fv) 58 | 59 | err_code=sfendacc(var_id) 60 | 61 | end subroutine read_modis_time 62 | -------------------------------------------------------------------------------- /pre_processing/read_slstr.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: read_slstr.F90 3 | ! 4 | ! Purpose: 5 | ! Module for SLSTR read routines. 6 | ! 7 | ! History: 8 | ! 2016/06/14, SP: First version. 9 | ! 2020/05/22, AP: Moved definition of constants here. 10 | ! 11 | ! Bugs: 12 | ! None known. 13 | !------------------------------------------------------------------------------- 14 | 15 | module read_slstr_m 16 | 17 | implicit none 18 | 19 | ! The calibration of SLSTR is under ongoing revisions, such that the 20 | ! application of empirical correction factors is currently required. 21 | ! These are taken from personal communications and the SLSTR Vicarious 22 | ! calibration adjustments document: S3MPC.RAL.TN.020, Issue 2.0, Sep 2020. 23 | 24 | real, parameter :: slstr_correction_factor(18) = [ & 25 | 0.97, & ! Ch1 26 | 0.98, & ! Ch2 27 | 0.98, & ! Ch3 28 | -1.0, & ! Ch4 29 | 1.11, & ! Ch5 30 | 1.13, & ! Ch6 31 | -1.0, & ! Ch7 32 | -1.0, & ! Ch8 33 | -1.0, & ! Ch9 34 | 0.94, & ! Ch10 35 | 0.95, & ! Ch11 36 | 0.95, & ! Ch12 37 | -1.0, & ! Ch13 38 | 1.04, & ! Ch14 39 | 1.07, & ! Ch15 40 | -1.0, & ! Ch16 41 | -1.0, & ! Ch17 42 | -1.0 ] ! Ch18 43 | 44 | contains 45 | 46 | #include "read_slstr_main.F90" 47 | #include "read_slstr_funcs.F90" 48 | 49 | end module read_slstr_m 50 | -------------------------------------------------------------------------------- /pre_processing/remove_rayleigh.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: remove_rayleigh.F90 3 | ! 4 | ! Purpose: 5 | ! Removes the Rayleigh scattering component from a transmittance profile and a 6 | ! total transmittance from TOA to the surface. 7 | ! (Phillip Watts, personal communication, June, 2015.) 8 | ! 9 | ! History: 10 | ! 2015/06/30, GM: First version. 11 | ! 12 | ! Bugs: 13 | ! None known. 14 | !------------------------------------------------------------------------------- 15 | 16 | module remove_rayleigh_m 17 | 18 | implicit none 19 | 20 | private 21 | 22 | public :: remove_rayleigh 23 | 24 | contains 25 | 26 | subroutine remove_rayleigh(n_channels, n_levels, lambda, satza, p, & 27 | transmittance, transmittance_total) 28 | 29 | use preproc_constants_m 30 | 31 | implicit none 32 | 33 | integer, intent(in) :: n_channels 34 | integer, intent(in) :: n_levels 35 | real, intent(in) :: lambda(:) 36 | real(8), intent(in) :: satza 37 | real(8), intent(in) :: p(:) 38 | real(8), intent(inout) :: transmittance(:,:) 39 | real(8), intent(inout) :: transmittance_total(:) 40 | 41 | integer :: i, j 42 | real :: p_0 43 | real :: sec_vza 44 | real :: tau_ray_0 45 | real :: tau_ray_p 46 | 47 | p_0 = 1013. 48 | 49 | sec_vza = 1. / cos(satza * d2r) 50 | 51 | do i = 1, n_channels 52 | ! Rayleigh optical thickness for the atmosphere down to 1013 53 | ! hPa (Hansen and Travis, 1974) 54 | tau_ray_0 = .008569 * lambda(i)**(-4) * & 55 | (1. + .0113 * lambda(i)**(-2) + .00013 * lambda(i)**(-4)) 56 | 57 | do j = 1, n_levels 58 | ! Pressure and path dependent Rayleigh optical thickness 59 | tau_ray_p = tau_ray_0 * p(j) / p_0 * & 60 | sec_vza 61 | 62 | ! Corrected level transmittances 63 | transmittance(j, i) = & 64 | transmittance(j, i) / exp(-tau_ray_p) 65 | end do 66 | 67 | ! Corrected total transmittances 68 | transmittance_total(i) = & 69 | transmittance_total(i) / exp(-tau_ray_p) 70 | end do 71 | 72 | end subroutine remove_rayleigh 73 | 74 | end module remove_rayleigh_m 75 | -------------------------------------------------------------------------------- /pre_processing/surface_emissivity.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: surface_emissivity.F90 3 | ! 4 | ! Purpose: 5 | ! Module for surface emissivity routines. 6 | ! 7 | ! History: 8 | ! 2014/05/23, GM: First version. 9 | ! 10 | ! Bugs: 11 | ! None known. 12 | !------------------------------------------------------------------------------- 13 | 14 | module surface_emissivity_m 15 | 16 | implicit none 17 | 18 | contains 19 | 20 | #include "get_surface_emissivity.F90" 21 | #include "select_modis_emiss_file.F90" 22 | #include "select_camel_emiss_file.F90" 23 | 24 | end module surface_emissivity_m 25 | -------------------------------------------------------------------------------- /pre_processing/surface_structures.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: surface_structures.F90 3 | ! 4 | ! Purpose: 5 | ! Module defining variables types which hold the surface reflectance and 6 | ! emissivity data on the instrument data-grid. 7 | ! 8 | ! History: 9 | ! 2012/02/13, GT: First version. 10 | ! 2014/08/10, GM: Changes related to new BRDF support. 11 | ! 2014/09/17, CS: Added surface%nise_mask. 12 | ! 2014/11/19, GM: C #includes should use double quotes. 13 | ! 2014/12/02, GM: Remove unused surface%albedo_chan and surface%emissivity_chan. 14 | ! 15 | ! Bugs: 16 | ! None known. 17 | !------------------------------------------------------------------------------- 18 | 19 | module surface_structures_m 20 | 21 | use preproc_constants_m 22 | 23 | implicit none 24 | 25 | type surface_t 26 | 27 | ! ice/snow mask based on NISE aux. data 28 | integer(kind=byte), dimension(:,:), pointer :: nise_mask 29 | 30 | real(kind=sreal), dimension(:,:,:), pointer :: albedo 31 | 32 | real(kind=sreal), dimension(:,:,:), pointer :: rho_0v 33 | real(kind=sreal), dimension(:,:,:), pointer :: rho_0d 34 | real(kind=sreal), dimension(:,:,:), pointer :: rho_dv 35 | real(kind=sreal), dimension(:,:,:), pointer :: rho_dd 36 | 37 | real(kind=sreal), dimension(:,:,:), pointer :: emissivity 38 | end type surface_t 39 | 40 | contains 41 | 42 | #include "allocate_surface_structures.F90" 43 | #include "deallocate_surface_structures.F90" 44 | 45 | end module surface_structures_m 46 | -------------------------------------------------------------------------------- /src/check_value.inc: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: check_value.inc 3 | ! 4 | ! Purpose: 5 | ! Code shared by all version of check_value function. See check_value.F90 for 6 | ! detailed header information. 7 | ! 8 | ! History: 9 | ! 2014/07/25, AP: Original version. 10 | ! 2014/08/01, GM: Comment out zeroing of SPixel%Mask. 11 | ! 2014/11/04, AP: Remove undefined variables. 12 | ! 13 | ! Bugs: 14 | ! None known 15 | !------------------------------------------------------------------------------- 16 | 17 | ! flag pixel as bad and specify reason in quality control flag 18 | SPixel%QC = ibset(SPixel%QC, flag_bit) 19 | 20 | #ifdef DEBUG 21 | write(*, *) 'WARNING: check_value(), Found '//trim(name)// ' out of ' // & 22 | & 'range in pixel at:', SPixel%Loc%X0, SPixel%Loc%Y0 23 | #endif 24 | -------------------------------------------------------------------------------- /src/cholesky.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: cholesky.F90 3 | ! 4 | ! Purpose: 5 | ! Module encapsulating the linear algebra for a Cholesky decomposition. 6 | ! 7 | ! History: 8 | ! 2015/01/18, GM: Original version. 9 | ! 10 | ! Bugs: 11 | ! None known. 12 | !--------------------------------------------------------------------- 13 | 14 | module Cholesky_m 15 | 16 | implicit none 17 | 18 | contains 19 | 20 | #include "invert_cholesky.F90" 21 | #include "solve_cholesky.F90" 22 | 23 | end module Cholesky_m 24 | -------------------------------------------------------------------------------- /src/dealloc_ctrl.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: dealloc_ctrl.F90 3 | ! 4 | ! Purpose: 5 | ! Deallocate the Ctrl at end of ORAC execution. 6 | ! 7 | ! Description and Algorithm details: 8 | ! Deallocates all arrays in the Ctrl structure 9 | ! 10 | ! Arguments: 11 | ! Name Type In/Out/Both Description 12 | ! ------------------------------------------------------------------------------ 13 | ! Ctrl struct In Control structure 14 | ! 15 | ! History: 16 | ! 2011/12/13, CP: Original version 17 | ! 2011/12/20, CP: Changed Ctrl to be inout (from in) 18 | ! 2014/01/12, GM: Added some missing deallocates. 19 | ! 2014/05/27, GM: Some cleanup. 20 | ! 2014/12/19, AP: Removing ysolar_msi, ythermal_msi. 21 | ! 2015/01/12, AP: Adding Ch_Is, YMixed. 22 | ! 2015/02/04, GM: Add sabotage_inputs flag and retrieval channel requirements 23 | ! arrays. 24 | ! 2015/02/04, GM: Add ReChans array. 25 | ! 26 | ! Bugs: 27 | ! None known. 28 | !------------------------------------------------------------------------------- 29 | 30 | subroutine Dealloc_Ctrl(Ctrl) 31 | 32 | use orac_indexing_m, only: dealloc_common_indices 33 | 34 | implicit none 35 | 36 | ! Declare arguments 37 | 38 | type(Ctrl_t), intent(inout) :: Ctrl 39 | 40 | call dealloc_common_indices(Ctrl%Ind%common_indices_t) 41 | 42 | deallocate(Ctrl%Ind%WvlIdx) 43 | deallocate(Ctrl%Ind%ICh) 44 | if (associated(Ctrl%Ind%YMixed)) deallocate(Ctrl%Ind%YMixed) 45 | deallocate(Ctrl%Ind%channel_proc_flag) 46 | 47 | if (associated(Ctrl%RS%B)) deallocate(Ctrl%RS%B) 48 | if (associated(Ctrl%RS%Sb)) deallocate(Ctrl%RS%Sb) 49 | 50 | deallocate(Ctrl%Sy) 51 | 52 | deallocate(Ctrl%tau_chans) 53 | deallocate(Ctrl%r_e_chans) 54 | deallocate(Ctrl%ir_chans) 55 | 56 | if (associated(Ctrl%ReChans)) deallocate(Ctrl%ReChans) 57 | 58 | end subroutine Dealloc_Ctrl 59 | -------------------------------------------------------------------------------- /src/dealloc_rtm.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: dealloc_rtm.F90 3 | ! 4 | ! Purpose: 5 | ! Deallocate the RTM arrays at end of ORAC execution. 6 | ! 7 | ! Description and Algorithm details: 8 | ! 1) Deallocates all arrays in the RTM structure 9 | ! 2) If any solar channels were requested 10 | ! - Deallocates arrays in the SW sub-structure 11 | ! 3) If any thermal channels were requested 12 | ! - Deallocates arrays in the LW sub-structure 13 | ! 14 | ! Arguments: 15 | ! Name Type In/Out/Both Description 16 | ! ------------------------------------------------------------------------------ 17 | ! Ctrl struct In Control structure 18 | ! RTM alloc struct In RTM structure 19 | ! 20 | ! History: 21 | ! 2001/10/24, AS: original version 22 | ! **************** ECV work starts here ************************************* 23 | ! 2011/02/21, AS: Re-introducing changes made in late 2001/2002. 24 | ! 2012/12/12, CP: Added geopotential height 25 | ! 2011/09/22, CP: Remove SW%P as now the same as LW%P 26 | ! 2011/12/13, CP: Deallocated RTM%SW%Lon 27 | ! 2013/12/16, GM: Add deallocation of RTM%LW%skint and RTM%LW%sp and a bit of 28 | ! cleanup. 29 | ! 2014/05/27, GM: Some more cleanup. 30 | ! 2015/01/30, AP: Eliminate redundant fields. 31 | ! 32 | ! Bugs: 33 | ! None known. 34 | !------------------------------------------------------------------------------- 35 | 36 | subroutine Dealloc_RTM(Ctrl, RTM) 37 | 38 | use Ctrl_m 39 | 40 | implicit none 41 | 42 | ! Declare arguments 43 | type(Ctrl_t), intent(in) :: Ctrl 44 | type(RTM_t), intent(inout) :: RTM 45 | 46 | deallocate(RTM%Lat) 47 | deallocate(RTM%Lon) 48 | deallocate(RTM%P) 49 | deallocate(RTM%T) 50 | deallocate(RTM%H) 51 | 52 | ! Deallocate SW sub-structure arrays 53 | if (Ctrl%Ind%NSolar > 0) then 54 | deallocate(RTM%SW%Tac) 55 | deallocate(RTM%SW%Tbc) 56 | end if 57 | 58 | ! Deallocate LW sub-structure arrays 59 | if (Ctrl%Ind%NThermal > 0) then 60 | deallocate(RTM%LW%Ems) 61 | deallocate(RTM%LW%Tac) 62 | deallocate(RTM%LW%Tbc) 63 | deallocate(RTM%LW%Rac_up) 64 | deallocate(RTM%LW%Rac_dwn) 65 | deallocate(RTM%LW%Rbc_up) 66 | end if 67 | 68 | end subroutine Dealloc_RTM 69 | -------------------------------------------------------------------------------- /src/dealloc_rtm_pc.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: dealloc_rtm_pc.F90 3 | ! 4 | ! Purpose: 5 | ! Deallocate the RTM_Pc arrays at end of ORAC execution. 6 | ! 7 | ! Description and Algorithm details: 8 | ! 1) Deallocates all arrays in the RTM_Pc structure 9 | ! 2) If any solar channels were requested 10 | ! - Deallocates arrays in the SW sub-structure 11 | ! 3) If any thermal channels were requested 12 | ! - Deallocates arrays in the LW sub-structure 13 | ! 14 | ! Arguments: 15 | ! Name Type In/Out/Both Description 16 | ! ------------------------------------------------------------------------------ 17 | ! Ctrl struct In Control structure 18 | ! RTM_Pc alloc struct In RTM_Pc structure 19 | ! 20 | ! History: 21 | ! 2001/10/22, AS: Original version 22 | ! 2014/05/27, GM: Some cleanup. 23 | ! 2015/01/07, AP: Eliminate write to RTM_Pc%Tac, Tbc. 24 | ! 25 | ! Bugs: 26 | ! None known. 27 | !------------------------------------------------------------------------------- 28 | 29 | subroutine Dealloc_RTM_Pc(Ctrl, RTM_Pc) 30 | 31 | use Ctrl_m 32 | 33 | implicit none 34 | 35 | ! Declare arguments 36 | 37 | type(Ctrl_t), intent(in) :: Ctrl 38 | type(RTM_Pc_t), intent(inout) :: RTM_Pc 39 | 40 | ! Deallocate sizes of SW sub-structure arrays 41 | 42 | if (Ctrl%Ind%NSolar > 0) then 43 | deallocate(RTM_Pc%SW%Tac) 44 | deallocate(RTM_Pc%SW%Tbc) 45 | deallocate(RTM_Pc%SW%dTac_dPc) 46 | deallocate(RTM_Pc%SW%dTbc_dPc) 47 | end if 48 | 49 | ! Deallocate sizes of LW sub-structure arrays 50 | 51 | if (Ctrl%Ind%NThermal > 0) then 52 | deallocate(RTM_Pc%LW%Tac) 53 | deallocate(RTM_Pc%LW%Tbc) 54 | deallocate(RTM_Pc%LW%B) 55 | deallocate(RTM_Pc%LW%Rac_up) 56 | deallocate(RTM_Pc%LW%Rac_dwn) 57 | deallocate(RTM_Pc%LW%Rbc_up) 58 | deallocate(RTM_Pc%LW%dTac_dPc) 59 | deallocate(RTM_Pc%LW%dTbc_dPc) 60 | deallocate(RTM_Pc%LW%dB_dPc) 61 | deallocate(RTM_Pc%LW%dRac_up_dPc) 62 | deallocate(RTM_Pc%LW%dRac_dwn_dPc) 63 | deallocate(RTM_Pc%LW%dRbc_up_dPc) 64 | end if 65 | 66 | end subroutine Dealloc_RTM_Pc 67 | -------------------------------------------------------------------------------- /src/find_in_array.inc: -------------------------------------------------------------------------------- 1 | integer function FIND_IN_ARRAY_NAME(arr, val) result(i) 2 | implicit none 3 | FIND_IN_ARRAY_TYPE(kind=FIND_IN_ARRAY_KIND), intent(in) :: arr(:) ! Array to be searched 4 | FIND_IN_ARRAY_TYPE(kind=FIND_IN_ARRAY_KIND), intent(in) :: val ! Value to find in that array 5 | integer :: n 6 | n = size(arr) 7 | do i = 1, n 8 | if (arr(i) == val) return 9 | end do 10 | ! Failed to locate value 11 | i=0 12 | return 13 | end function FIND_IN_ARRAY_NAME 14 | -------------------------------------------------------------------------------- /src/find_lun.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: find_lun.F90 3 | ! 4 | ! Purpose: 5 | ! Subroutine to find a free logical unit number for file handling 6 | ! 7 | ! Description and Algorithm details: 8 | ! Uses the inquire function to find a free logical unit number in the range 9 | ! 20 to 100. 10 | ! 11 | ! for i=20, 200 (until free unit is found) 12 | ! inquire whether unit number exists and is in use 13 | ! 14 | ! Arguments: 15 | ! Name Type In/Out/Both Description 16 | ! ------------------------------------------------------------------------------ 17 | ! lun int Out Free unit number 18 | ! 19 | ! History: 20 | ! 2000/08/17, AS: Original version 21 | ! 22 | ! Bugs: 23 | ! None known. 24 | !------------------------------------------------------------------------------- 25 | 26 | subroutine Find_Lun(lun) 27 | 28 | implicit none 29 | 30 | integer, intent(out) :: lun 31 | 32 | integer :: i 33 | logical :: found_lun 34 | logical :: lun_exists 35 | logical :: lun_used 36 | 37 | found_lun = .false. 38 | 39 | do i = 20, 100 40 | if (found_lun) exit 41 | inquire(unit=i, exist=lun_exists, opened=lun_used) 42 | if (lun_exists .and. (.not. lun_used)) then 43 | found_lun = .true. 44 | lun = i 45 | end if 46 | end do 47 | 48 | if (.not. found_lun) then 49 | write(*,*) 'ERROR: Find_Lun(): Could not find free LUN in range 20 to 100' 50 | lun = -1 51 | end if 52 | 53 | end subroutine Find_Lun 54 | -------------------------------------------------------------------------------- /src/fm_routines.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: fm_routines.F90 3 | ! 4 | ! Purpose: 5 | ! This module contains a set of interface definitions for ORAC subroutines. 6 | ! Not all subroutines are included. These interface definitions are required 7 | ! in order that passed-length arrays can be used as subroutine arguments. 8 | ! 9 | ! History: 10 | ! 2001/01/19, AS: original version 11 | ! 2001/01/23, AS: SetCRPSolar/Thermal interfaces updated to cope with new 12 | ! routine SetGZero. 13 | ! 2001/02/16, AS: New argument SPixel for SetCRPSolar. 14 | ! 2001/02/20, AS: SetCRPSolar SPixel argument replaced by Ind (sub-struct of 15 | ! SPixel). Same change applied to SetCRPThermal. 16 | ! 2001/02/27, AS: Set_CRP_Thermal no longer requires argument First. 17 | ! 2013/12/20, GM: Cleaned up code. 18 | ! 2013/12/24, GM: Some intent changes. 19 | ! 2014/12/16, GM: Added LUT name mapping: IR_0v = IRbd, etc. 20 | ! 2015/01/09, CP: Added LUT name mapping: IR_0d = IRfbd. 21 | ! 22 | ! Bugs: 23 | ! None known. 24 | !------------------------------------------------------------------------------- 25 | 26 | module FM_Routines_m 27 | 28 | use ORAC_Constants_m 29 | 30 | implicit none 31 | 32 | integer, parameter :: IR_0v = IRbd 33 | integer, parameter :: IR_0d = IRfbd 34 | integer, parameter :: IR_dv = IRd 35 | integer, parameter :: IR_dd = IRfd 36 | integer, parameter :: IT_00 = ITb 37 | integer, parameter :: IT_vv = ITb_u 38 | integer, parameter :: IT_0d = ITfbd 39 | integer, parameter :: IT_vd = ITfbd_u 40 | integer, parameter :: IT_dv = ITd 41 | integer, parameter :: IT_dd = ITfd 42 | 43 | integer, parameter :: ISv = 3 44 | integer, parameter :: IPv = 4 45 | integer, parameter :: IGv = 5 46 | 47 | contains 48 | 49 | #include "fm.F90" 50 | #include "fm_solar.F90" 51 | #include "fm_thermal.F90" 52 | #include "set_crp_solar.F90" 53 | #include "set_crp_thermal.F90" 54 | 55 | end module FM_Routines_m 56 | -------------------------------------------------------------------------------- /src/get_location.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: get_location.F90 3 | ! 4 | ! Purpose: 5 | ! 6 | ! Description and Algorithm details: 7 | ! 8 | ! Arguments: 9 | ! Name Type In/Out/Both Description 10 | ! ------------------------------------------------------------------------------ 11 | ! Ctrl struct In Control structure 12 | ! SPixel struct Both Super-pixel structure 13 | ! MSI_Data struct In Data structure. Contains the multi-spectral 14 | ! image measurements, location values, geometry 15 | ! etc for the current image segment, from which 16 | ! the current SPixel values will be extracted. 17 | ! status integer Out Error status 18 | ! 19 | ! History: 20 | ! 2015/08/04, GM: Original version. 21 | ! 22 | ! Bugs: 23 | ! None known. 24 | !------------------------------------------------------------------------------- 25 | 26 | subroutine Get_Location(Ctrl, SPixel, MSI_Data, status) 27 | 28 | use Ctrl_m 29 | use Data_m 30 | use ORAC_Constants_m 31 | 32 | implicit none 33 | 34 | ! Define arguments 35 | 36 | type(Ctrl_t), intent(in) :: Ctrl 37 | type(SPixel_t), intent(inout) :: SPixel 38 | type(Data_t), intent(in) :: MSI_Data 39 | integer, intent(out) :: status 40 | 41 | 42 | status = 0 43 | 44 | SPixel%Loc%Lat = MSI_Data%Location%Lat(SPixel%Loc%X0, SPixel%Loc%Y0) 45 | SPixel%Loc%Lon = MSI_Data%Location%Lon(SPixel%Loc%X0, SPixel%Loc%Y0) 46 | 47 | ! Set status non-zero if lat/lon is outside the allowed range specified in 48 | ! Ctrl. 49 | if (SPixel%Loc%Lat < LatMin .or. SPixel%Loc%Lat > LatMax) then 50 | #ifdef DEBUG 51 | write(*, *) 'Get_Location: Latitude out of range at: ', & 52 | SPixel%Loc%X0, SPixel%Loc%Y0 53 | #endif 54 | status = SPixelLocLat 55 | end if 56 | if (SPixel%Loc%Lon < LonMin .or. SPixel%Loc%Lon > LonMax) then 57 | #ifdef DEBUG 58 | write(*, *) 'Get_Location: Longitude out of range at: ', & 59 | SPixel%Loc%X0, SPixel%Loc%Y0 60 | #endif 61 | status = SPixelLocLon 62 | end if 63 | 64 | end subroutine Get_Location 65 | -------------------------------------------------------------------------------- /src/get_lsf.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: get_lsf.F90 3 | ! 4 | ! Purpose: 5 | ! Sets the land sea flag if no visible channels are present. 6 | ! REDUNDANT due to GetSurface. 7 | ! 8 | ! Description and Algorithm details: 9 | ! 10 | ! Arguments: 11 | ! Name Type In/Out/Both Description 12 | ! ------------------------------------------------------------------------------ 13 | ! Ctrl struct In Control structure 14 | ! SAD_Chan struct In SAD channel structure 15 | ! SPixel alloc struct Both Super-pixel structure 16 | ! MSI_Data struct In Data structure. Contains the multi- 17 | ! spectral image measurements, location 18 | ! values, geometry etc for the current 19 | ! image segment, from which the current 20 | ! SPixel values will be extracted. 21 | ! status integer Out Error status 22 | ! 23 | ! History: 24 | ! 2012/02/08, CP: Original version 25 | ! 2014/07/30, GM: Cleaned up the code. 26 | ! 2015/01/30, AP: Replace YSeg0 with Y0 as superpixeling removed. 27 | ! 2015/12/30, AP: Add surfaces_to_skip. 28 | ! 29 | ! Bugs: 30 | ! None known. 31 | !------------------------------------------------------------------------------- 32 | 33 | subroutine Get_LSF(Ctrl, SPixel, MSI_Data, status) 34 | 35 | use Ctrl_m 36 | use Data_m 37 | use ORAC_Constants_m 38 | 39 | implicit none 40 | 41 | ! Define arguments 42 | 43 | type(Ctrl_t), intent(in) :: Ctrl 44 | type(SPixel_t), intent(inout) :: SPixel 45 | type(Data_t), intent(in) :: MSI_Data 46 | integer, intent(out) :: status 47 | 48 | 49 | status = 0 50 | 51 | select case (MSI_Data%LSFlags(SPixel%Loc%X0, SPixel%Loc%Y0)) 52 | case(1) 53 | SPixel%Surface%Land = .true. 54 | case(0) 55 | SPixel%Surface%Land = .false. 56 | case default 57 | #ifdef DEBUG 58 | write(*, *) 'WARNING: Get_Surface(): pixel contains mixed surface types' 59 | #endif 60 | status = SPixelInvalid 61 | end select 62 | 63 | if (SPixel%Surface%Land .and. Ctrl%Surfaces_to_skip == ILand .or. & 64 | .not. SPixel%Surface%Land .and. Ctrl%Surfaces_to_skip == ISea) & 65 | status = SPixelSkip 66 | 67 | end subroutine Get_LSF 68 | -------------------------------------------------------------------------------- /src/inversion.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: inversion.F90 3 | ! 4 | ! Purpose: 5 | ! Module of functions used by Invert_Marquardt. 6 | ! 7 | ! History: 8 | ! 2015/01/18, GM: Original version. 9 | ! 10 | ! Bugs: 11 | ! None known. 12 | !--------------------------------------------------------------------- 13 | 14 | module Inversion_m 15 | 16 | implicit none 17 | 18 | contains 19 | 20 | #include "calc_cwp.F90" 21 | #include "calc_corrected_ctx.F90" 22 | #include "check_limits.F90" 23 | #include "invert_marquardt.F90" 24 | #include "set_kx.F90" 25 | #include "set_sy.F90" 26 | 27 | end module Inversion_m 28 | -------------------------------------------------------------------------------- /src/invert_cholesky.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: invert_cholesky.F90 3 | ! 4 | ! Purpose: 5 | ! Given a positive definite matrix A of dimension n * n, returns its inverse 6 | ! in D. This function makes approximately n^3 / 2 multiplications. 7 | ! 8 | ! Description and Algorithm details: 9 | ! Calls SLATEC or LAPACK. 10 | ! 11 | ! Arguments: 12 | ! Name Type In/Out/Both Description 13 | ! ------------------------------------------------------------------------------ 14 | ! A float array In Positive definite matrix to be inverted 15 | ! D float array Out Inverse of positive definite matrix 16 | ! n integer In Dimensions of A, D, p; loop limit 17 | ! status integer Out Status flag: 0 = Success, 1 = Not positive 18 | ! definite 19 | ! 20 | ! History: 21 | ! 2001/04/27, TN: Original version. 22 | ! 2001/05/17, TN: Add Decompose_Cholesky to subroutine as decomposition is only 23 | ! used once. 24 | ! 2001/06/05, TN: Return if decomposition fails. 25 | ! 2017/10/24, GN: Change to use SLATEC or LAPACK. 26 | ! 27 | ! Bugs: 28 | ! None known. 29 | !------------------------------------------------------------------------------- 30 | 31 | subroutine Invert_Cholesky(A, D, n, status) 32 | 33 | implicit none 34 | 35 | real, dimension(:,:), intent(in) :: A 36 | real, dimension(:,:), intent(inout) :: D 37 | integer, intent(in) :: n 38 | integer, intent(out) :: status 39 | 40 | integer :: i 41 | #ifdef USE_SLATEC 42 | real :: det(2) 43 | #endif 44 | status = 0 45 | 46 | D = A 47 | #ifdef USE_SLATEC 48 | call spofa(D, n, n, status) 49 | if (status /= 0) return 50 | 51 | call spodi(D, n, n, det, 01) 52 | #else 53 | call spotrf("u", n, D, n, status) 54 | if (status /= 0) return 55 | 56 | call spotri("u", n, D, n, status) 57 | if (status /= 0) return 58 | #endif 59 | do i = 2, n 60 | D(i,1:i-1) = D(1:i-1,i) 61 | end do 62 | end subroutine Invert_Cholesky 63 | -------------------------------------------------------------------------------- /src/nullify_data.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: nullify_data.F90 3 | ! 4 | ! Purpose: 5 | ! Nullify all pointers in Ctrl and MSI_Data structures. 6 | ! 7 | ! Description and Algorithm details: 8 | ! Many calls to nullify. 9 | ! 10 | ! Arguments: 11 | ! Name Type In/Out/Both Description 12 | ! ------------------------------------------------------------------------------ 13 | ! Ctrl struct In Control structure 14 | ! MSI_Data struct Both Imager data structure 15 | ! 16 | ! History: 17 | ! 2014/09/10, GM: Original version 18 | ! 2015/12/19, GM: Added nullifications for recently added variables. 19 | ! 2015/01/30, AP: Remove uscan and vscan as unnecessary. 20 | ! 2015/07/03, OS: Added cldmask_uncertainty 21 | ! 2015/08/10, AP: Additional surface uncs. 22 | ! 2017/06/21, OS: Added ANN phase variables. 23 | ! 24 | ! Bugs: 25 | ! None known. 26 | !------------------------------------------------------------------------------- 27 | 28 | subroutine Nullify_Data(Ctrl, MSI_Data) 29 | 30 | use Ctrl_m 31 | 32 | implicit none 33 | 34 | ! Declare arguments 35 | type(Ctrl_t), intent(in) :: Ctrl 36 | type(Data_t), intent(inout) :: MSI_Data 37 | 38 | nullify(MSI_Data%ALB) 39 | 40 | if (Ctrl%RS%read_full_brdf) then 41 | nullify(MSI_Data%rho_0v) 42 | nullify(MSI_Data%rho_0d) 43 | nullify(MSI_Data%rho_dv) 44 | nullify(MSI_Data%rho_dd) 45 | end if 46 | 47 | nullify(MSI_Data%Type) 48 | nullify(MSI_Data%cldtype) 49 | nullify(MSI_Data%cldmask) 50 | nullify(MSI_Data%cldmask_uncertainty) 51 | nullify(MSI_Data%cccot_pre) 52 | nullify(MSI_Data%ann_phase) 53 | nullify(MSI_Data%ann_phase_uncertainty) 54 | nullify(MSI_Data%cphcot) 55 | 56 | nullify(MSI_Data%Geometry%Sol) 57 | nullify(MSI_Data%Geometry%Sat) 58 | nullify(MSI_Data%Geometry%Azi) 59 | nullify(MSI_Data%Geometry%Saz) 60 | 61 | nullify(MSI_Data%Location%Lat) 62 | nullify(MSI_Data%Location%Lon) 63 | 64 | nullify(MSI_Data%LSFlags) 65 | 66 | nullify(MSI_Data%lusflags) 67 | nullify(MSI_Data%dem) 68 | nullify(MSI_Data%nisemask) 69 | 70 | nullify(MSI_Data%time) 71 | 72 | nullify(MSI_Data%MSI) 73 | nullify(MSI_Data%SD) 74 | nullify(MSI_Data%cal_gain) 75 | nullify(MSI_Data%rho_dd_cor) 76 | nullify(MSI_Data%rho_dd_unc) 77 | nullify(MSI_Data%svd_unc) 78 | nullify(MSI_Data%veg_unc) 79 | nullify(MSI_Data%bare_unc) 80 | nullify(MSI_Data%snow_unc) 81 | 82 | nullify(MSI_Data%illum) 83 | nullify(MSI_Data%State%CTP) 84 | nullify(MSI_Data%State%CTP_var) 85 | 86 | end subroutine Nullify_Data 87 | -------------------------------------------------------------------------------- /src/planck.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: planck.F90 3 | ! 4 | ! Purpose: 5 | ! Module for routines converting brightness temperature to radiance and back. 6 | ! 7 | ! History: 8 | ! 2015/01/18, GM: Original version. 9 | ! 10 | ! Bugs: 11 | ! None known. 12 | !--------------------------------------------------------------------- 13 | 14 | module planck_m 15 | 16 | implicit none 17 | 18 | contains 19 | 20 | #include "t2r.F90" 21 | #include "r2t.F90" 22 | 23 | end module planck_m 24 | -------------------------------------------------------------------------------- /src/read_ctp.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: read_ctp.F90 3 | ! 4 | ! Purpose: 5 | ! Controls the reading a priori cloud-top pressure values from an auxiliary data 6 | ! file into the MSI_Data%State structure. 7 | ! 8 | ! Description and Algorithm details: 9 | ! if (MSI files are not yet open) 10 | ! Open CTP file 11 | ! If open error 12 | ! Write error message to screen and log file 13 | ! else 14 | ! allocate MSI image segment array in Data_MSI struct. 15 | ! 16 | ! If (no error opening files) 17 | ! Read header (not used further) 18 | ! If read error 19 | ! Write error message to screen and log file 20 | ! Else 21 | ! Read byte array of size defined by Ctrl structure 22 | ! If read error 23 | ! Write error message to log file 24 | ! Close CTP file 25 | ! 26 | ! Arguments: 27 | ! Name Type In/Out/Both Description 28 | ! ------------------------------------------------------------------------------ 29 | ! Ctrl struct Both Control structure 30 | ! MSI_Data struct Both Data structure: contains the cloud flag array 31 | ! to be populated with data from the file. This 32 | ! is overwritten as successive segments of data 33 | ! are read in. 34 | ! 35 | ! History: 36 | ! 2022/01/22, GT: New, based off of existing Read routines. 37 | ! 38 | ! Bugs: 39 | ! None known. 40 | !------------------------------------------------------------------------------- 41 | 42 | subroutine Read_CTP(Ctrl, MSI_Data) 43 | 44 | use Ctrl_m 45 | use orac_ncdf_m 46 | 47 | implicit none 48 | 49 | ! Argument declarations 50 | 51 | type(Ctrl_t), intent(in) :: Ctrl 52 | type(Data_t), intent(inout) :: MSI_Data 53 | 54 | integer :: ncid 55 | 56 | ! Open CTP file 57 | if (Ctrl%verbose) write(*,*) 'CTP file: ', trim(Ctrl%FID%CTP) 58 | call ncdf_open(ncid, Ctrl%FID%CTP, 'Read_CTP_nc()') 59 | 60 | allocate(MSI_Data%State%CTP(Ctrl%Ind%Xmax, Ctrl%Ind%Ymax)) 61 | allocate(MSI_Data%State%CTP_var(Ctrl%Ind%Xmax, Ctrl%Ind%Ymax)) 62 | 63 | call ncdf_read_array(ncid, "ctp", MSI_Data%State%CTP) 64 | call ncdf_read_array(ncid, "ctp_var", MSI_Data%State%CTP_var) 65 | 66 | ! Close CTP file 67 | call ncdf_close(ncid, 'read_location_nc()') 68 | 69 | end subroutine Read_CTP 70 | -------------------------------------------------------------------------------- /src/read_ctrl.def: -------------------------------------------------------------------------------- 1 | // Define constant values 2 | int nsurf = MAXSURF_TOKEN; 3 | int three = 3; 4 | int two = 2; 5 | 6 | #define COMMON_INDICES_T_Y_Id_DIMS COMMON_INDICES_T_VARIABLE.Ny 7 | #define COMMON_INDICES_T_YSolar_DIMS COMMON_INDICES_T_VARIABLE.NSolar 8 | #define COMMON_INDICES_T_YThermal_DIMS COMMON_INDICES_T_VARIABLE.NThermal 9 | #define COMMON_INDICES_T_View_Id_DIMS COMMON_INDICES_T_VARIABLE.Ny 10 | #define COMMON_INDICES_T_Ch_Is_DIMS COMMON_INDICES_T_VARIABLE.Ny 11 | #define COMMON_INDICES_T_rho_terms_DIMS COMMON_INDICES_T_VARIABLE.NSolar, &nsurf 12 | #define COMMON_INDICES_T_ss_terms_DIMS COMMON_INDICES_T_VARIABLE.NSolar 13 | #define COMMON_INDICES_T_alb_terms_DIMS COMMON_INDICES_T_VARIABLE.NSolar 14 | #define COMMON_INDICES_T_cee_terms_DIMS COMMON_INDICES_T_VARIABLE.NThermal 15 | #define IND_T_ICh_DIMS COMMON_INDICES_T_VARIABLE.Ny 16 | #define IND_T_YMixed_DIMS IND_T_VARIABLE.NMixed 17 | #define IND_T_WvlIdx_DIMS COMMON_INDICES_T_VARIABLE.Ny 18 | #define IND_T_channel_proc_flag_DIMS IND_T_VARIABLE.NAvail 19 | #define SURFREF_T_B_DIMS COMMON_INDICES_T_VARIABLE.NSolar, &nsurf 20 | #define SURFREF_T_Sb_DIMS COMMON_INDICES_T_VARIABLE.NSolar, &nsurf 21 | #define CTRL_T_tau_chans_DIMS &three 22 | #define CTRL_T_r_e_chans_DIMS &two 23 | #define CTRL_T_ir_chans_DIMS &three 24 | #define CTRL_T_ReChans_DIMS &two 25 | #define CTRL_T_Sy_DIMS COMMON_INDICES_T_VARIABLE.Ny, COMMON_INDICES_T_VARIABLE.Ny 26 | -------------------------------------------------------------------------------- /src/read_utils.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: read_utils.F90 3 | ! 4 | ! Purpose: 5 | ! Module wrapping some read routines. 6 | ! 7 | ! History: 8 | ! 2015/01/19, GM: Original version. 9 | ! 10 | ! Bugs: 11 | ! None known. 12 | !--------------------------------------------------------------------- 13 | 14 | module read_utils_m 15 | 16 | implicit none 17 | 18 | contains 19 | 20 | #include "read_config_file.F90" 21 | #include "read_input_dimensions.F90" 22 | 23 | end module read_utils_m 24 | -------------------------------------------------------------------------------- /src/set_kx.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: set_kx.F90 3 | ! 4 | ! Purpose: 5 | ! Set up the gradient matrices Kx and Kj from the forward model return. 6 | ! 7 | ! Description and Algorithm details: 8 | ! Copy dY_dX into Kx for each active variable, appyling the appropriate scale 9 | ! factors. Copy dY_dX into Kj for each parameter. 10 | ! 11 | ! Arguments: 12 | ! Name Type In/Out/Both Description 13 | ! ------------------------------------------------------------------------------ 14 | ! Ctrl struct In Control structure 15 | ! SPixel struct In Super-pixel structure (required for array 16 | ! sizing) 17 | ! dY_dX real arr In Gradients from forward model 18 | ! Kx real arr Out Scaled FM gradients (w.r.t state variables) 19 | ! Kj real arr Out Scaled FM gradients w.r.t. model parameters 20 | ! (only Rs at present). 21 | ! 22 | ! History: 23 | ! 2001/01/30, KS: Original version 24 | ! 2001/04/27, AS: Now uses SPixel instead of Ctrl for active state variable 25 | ! indices and channels. 26 | ! 2001/06/06, AS: Implicit none statement was wrongly placed. 27 | ! 2012/01/20, CP: Bug fix: Changed dy_dx array changed spixe%nx to MaxStateVar 28 | ! definition. 29 | ! 2012/01/01, MJ: Changes Kx assignment 30 | ! 2014/05/21, GM: Cleaned up the code. 31 | ! 2015/01/15, AP: Facilitate channel indexing in arbitrary order. 32 | ! 2015/08/21, AP: Variables to include in Jacobian (but not retrieve) now listed 33 | ! in SPixel%XJ. 34 | ! 35 | ! Bugs: 36 | ! None known. 37 | !------------------------------------------------------------------------------- 38 | 39 | subroutine Set_Kx(Ctrl, SPixel, dY_dX, Kx, Kj) 40 | 41 | use Ctrl_m 42 | use ORAC_Constants_m 43 | use SPixel_m 44 | 45 | implicit none 46 | 47 | ! Declare arguments 48 | 49 | type(Ctrl_t), intent(in) :: Ctrl 50 | type(SPixel_t), intent(in) :: SPixel 51 | real, intent(in) :: dY_dX(:,:) 52 | real, intent(out) :: Kx(:,:) 53 | real, intent(out) :: Kj(:,:) 54 | 55 | ! Declare local variables 56 | 57 | integer :: i 58 | 59 | ! Set values in Kx for the active state variables. 60 | do i = 1, SPixel%Nx 61 | Kx(:,i) = dY_dX(:, SPixel%X(i)) / Ctrl%Invpar%XScale(SPixel%X(i)) 62 | end do 63 | 64 | ! Set Jacobian for requested parameter errors 65 | if (SPixel%NXJ > 0) then 66 | do i = 1, SPixel%NXJ 67 | Kj(:,i) = dY_dX(:, SPixel%XJ(i)) / Ctrl%Invpar%XScale(SPixel%XJ(i)) 68 | end do 69 | end if 70 | 71 | end subroutine Set_Kx 72 | -------------------------------------------------------------------------------- /src/set_sy.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: set_sy.F90 3 | ! 4 | ! Purpose: 5 | ! Sets up the state dependent part of the error covariance matrix Sy (errors 6 | ! in the measurements Y). SPixel%Sy is already populated with instrument 7 | ! dependent data and pixel dependent data. This routine adds the state 8 | ! dependent terms. Currently only Rs is supported. SPixel%Sy is not 9 | ! overwritten as the current state vector might not be kept (if the step 10 | ! takes the inversion away from convergence). 11 | ! 12 | ! Description and Algorithm details: 13 | ! If Ctrl flag indicates that Rs errors should be included in Sy: 14 | ! - calculate Syb = Kbj * Sb * transpose(Kbj) 15 | ! - Sy = scene Sy + Syb 16 | ! 17 | ! Arguments: 18 | ! Name Type In/Out/Both Description 19 | ! ------------------------------------------------------------------------------ 20 | ! Ctrl struct In Control structure 21 | ! SPixel struct In Info on the current super-pixel 22 | ! Kj real array In Gradients in measurements calculated by the 23 | ! forward model w.r.t. model parameters. 24 | ! Sj real array In Covariance matrix for parameters. 25 | ! Sy real array Out The local (to Invert_Marquardt) error covariance 26 | ! in the measurements. Set to the sum of the scene 27 | ! Sy (from SPixel) and the requested model 28 | ! parameter values. 29 | ! 30 | ! History: 31 | ! 2001/05/16, AS: Original version 32 | ! 2001/06/06, AS: Implicit none statement was wrongly placed. Ctrl argument 33 | ! added. 34 | ! 2001/07/05, AS: Added test for NSolar > 0 before adding Kbj terms. 35 | ! 2014/05/21, GM: Cleaned up the code. 36 | ! 2015/08/21, AP: Variables to include in Jacobian (but not retrieve) now listed 37 | ! in SPixel%XJ. 38 | ! 39 | ! Bugs: 40 | ! None known. 41 | !------------------------------------------------------------------------------- 42 | 43 | subroutine Set_Sy(Ctrl, SPixel, Kj, Sj, Sy) 44 | 45 | use Ctrl_m 46 | use SPixel_m 47 | 48 | implicit none 49 | 50 | ! Declare arguments 51 | 52 | type(Ctrl_t), intent(in) :: Ctrl 53 | type(SPixel_t), intent(in) :: SPixel 54 | real, intent(in) :: Kj(:,:) 55 | real, intent(in) :: Sj(:,:) 56 | real, intent(out) :: Sy(:,:) 57 | 58 | 59 | Sy = SPixel%Sy 60 | 61 | ! Include forward model parameter errors, Syb = Kj * Sj * Kj^T. 62 | if (SPixel%NXJ > 0) & 63 | Sy = Sy + matmul(Kj, matmul(Sj, transpose(Kj))) 64 | 65 | end subroutine Set_Sy 66 | -------------------------------------------------------------------------------- /src/solve_cholesky.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: solve_cholesky.F90 3 | ! 4 | ! Purpose: 5 | ! Given a positive definite matrix A of dimension n * n, and a column vector 6 | ! b of dimension n, returns the solution x to A.x = b. This function makes 7 | ! approximately n^3 / 6 (+ n^2) multiplications. 8 | ! 9 | ! Description and Algorithm details: 10 | ! Calls SLATEC or LAPACK. 11 | ! 12 | ! Arguments: 13 | ! Name Type In/Out/Both Description 14 | ! ------------------------------------------------------------------------------ 15 | ! A float array In Positive definite matrix A 16 | ! b float array In RHS vector to A.x = b 17 | ! x float array Both Solution vector to A.x = b 18 | ! n integer In Dimensions of A; loop limit 19 | ! status integer Out Status flag: 0 = Success, 1 = Not positive 20 | ! definite 21 | ! 22 | ! History: 23 | ! 2001/05/18, TN: Original version. 24 | ! 2001/06/05, TN: Return if decomposition fails 25 | ! 2017/10/24, GN: Change to use LINPACK/SLATEC or LAPACK. 26 | ! 27 | ! Bugs: 28 | ! None known. 29 | !------------------------------------------------------------------------------- 30 | 31 | subroutine Solve_Cholesky(A, b, x, n, status) 32 | 33 | implicit none 34 | 35 | integer, intent(in) :: n 36 | real, dimension(:,:), intent(in) :: A 37 | real, dimension(:), intent(in) :: b 38 | real, dimension(:), intent(inout) :: x 39 | integer, intent(out) :: status 40 | 41 | real, dimension(n,n) :: D 42 | #ifdef USE_SLATEC 43 | real :: work(n) 44 | #endif 45 | status = 0 46 | 47 | D = A 48 | #ifdef USE_SLATEC 49 | call spofa(D, n, n, status) 50 | if (status /= 0) return 51 | 52 | x = b 53 | call spofs(D, n, n, x, 2, status, work); 54 | if (status .lt. 0) return 55 | #else 56 | call spotrf("u", n, D, n, status) 57 | if (status /= 0) return 58 | 59 | x = b 60 | call spotrs("u", n, 1, D, n, x, n, status); 61 | if (status /= 0) return 62 | #endif 63 | end subroutine Solve_Cholesky 64 | -------------------------------------------------------------------------------- /src/testInterp.F90: -------------------------------------------------------------------------------- 1 | !------------------------------------------------------------------------------- 2 | ! Name: testInterp.F90 3 | ! 4 | ! Purpose: 5 | ! 6 | ! Description and Algorithm details: 7 | ! 8 | ! Arguments: 9 | ! Name Type In/Out/Both Description 10 | ! 11 | ! History: 12 | ! 13 | ! Bugs: 14 | ! None known. 15 | !------------------------------------------------------------------------------- 16 | 17 | program testInterp 18 | 19 | use test_int_def 20 | 21 | implicit none 22 | 23 | integer :: i, j 24 | real :: xGrid(5), yGrid(5) 25 | real :: FInt, dFdx, dFdy 26 | integer :: nx, ny 27 | real :: xstep, ystep 28 | real :: curX, CurY 29 | real :: F(1,5,5) 30 | 31 | xstep = 1. 32 | ystep = 2. 33 | nx = 5 34 | ny = 5 35 | 36 | do i = 1, 5 37 | xGrid(i) = real(i) 38 | yGrid(i) = real(2.0*i) 39 | do j = 1, 5 40 | F(1,i,j) = real(i*j) 41 | end do 42 | end do 43 | 44 | write(*,'(a,5(f4.1, 1x))') 'X grid ',(xGrid(i), i=1,5) 45 | write(*,'(a,5(f4.1, 1x))') 'Y grid ',(yGrid(i), i=1,5) 46 | 47 | CurX = xGrid(2) 48 | CurY = yGrid(2) 49 | 50 | call Interp3dLUT(1, F, xGrid, yGrid, xstep, ystep, CurX, CurY, & 51 | FInt, dFdx, dFdy) 52 | write(*,*)' Interpolated values: ', FInt, dFdx, dFdy 53 | write(*,*) 54 | 55 | CurX = xGrid(3) 56 | CurY = yGrid(3) 57 | 58 | call Interp3dLUT(1, F, xGrid, yGrid, xstep, ystep, CurX, CurY, & 59 | FInt, dFdx, dFdy) 60 | write(*,*)' Interpolated values: ', FInt, dFdx, dFdy 61 | write(*,*) 62 | 63 | CurX = xGrid(3) + xstep/2 64 | CurY = yGrid(3) + ystep/2 65 | 66 | call Interp3dLUT(1, F, xGrid, yGrid, xstep, ystep, CurX, CurY, & 67 | FInt, dFdx, dFdy) 68 | write(*,*)' Interpolated values: ', FInt, dFdx, dFdy 69 | 70 | end program testInterp 71 | -------------------------------------------------------------------------------- /tools/orac.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Run pre, main, and post processors for ORAC 3 | # 27 Jun 2016, AP: Initial version 4 | # 08 Jul 2016, AP: Debugging against more awkward python environments 5 | # 25 Apr 2018. AP: Tidy code more sensibly into a module 6 | 7 | import warnings 8 | from argparse import ArgumentParser 9 | from pyorac.arguments import (args_common, args_cc4cl, args_preproc, 10 | args_main, args_postproc) 11 | from pyorac.colour_print import colour_print 12 | from pyorac.definitions import COLOURING, OracError, OracWarning 13 | from pyorac.run import process_all 14 | from pyorac.util import warning_format 15 | 16 | warnings.formatwarning = warning_format 17 | warnings.filterwarnings('always', category=OracWarning) 18 | 19 | 20 | # Define parser 21 | pars = ArgumentParser( 22 | description='Run the full ORAC suite on a given Level 1B file.' 23 | ) 24 | pars.add_argument('target', type=str, help='Level 1B file to be processed') 25 | args_common(pars) 26 | args_cc4cl(pars) 27 | args_preproc(pars) 28 | args_main(pars) 29 | args_postproc(pars) 30 | args = pars.parse_args() 31 | 32 | try: 33 | jid, _ = process_all(args) 34 | 35 | if args.script_verbose and args.batch: 36 | print("Job queued with ID {}".format(jid)) 37 | 38 | except OracError as err: 39 | colour_print('ERROR) ' + str(err), COLOURING['error']) 40 | except KeyboardInterrupt: 41 | colour_print('Execution halted by user.', COLOURING['error']) 42 | -------------------------------------------------------------------------------- /tools/pyorac/__init__.py: -------------------------------------------------------------------------------- 1 | import pyorac.local_defaults as defaults 2 | from pyorac.swath import Swath as Swath 3 | 4 | __author__ = "Adam Povey" 5 | __version__ = "3.01" 6 | __website__ = "https://github.com/ORAC-CC/orac" 7 | -------------------------------------------------------------------------------- /tools/setup.py: -------------------------------------------------------------------------------- 1 | import os.path 2 | 3 | from setuptools import setup, find_packages, Command 4 | from pkg_resources import require, DistributionNotFound, VersionConflict 5 | from pyorac import __version__, __website__ 6 | 7 | root_path = os.path.dirname(__file__) 8 | 9 | dependencies = ["cartopy", 10 | "cftime", 11 | "python-dateutil", 12 | "h5py", 13 | "matplotlib>=3.0", 14 | "netcdf4>=1.0", 15 | "numpy>=1.16", 16 | "scipy>=0.15.0", 17 | "opencv"] 18 | 19 | optional_dependencies = { 20 | "nv": ["nvector"], 21 | } 22 | 23 | test_dependencies = [] 24 | 25 | 26 | class CheckDep(Command): 27 | """ 28 | Command to check that the required dependencies are installed on the system 29 | """ 30 | description = "Checks that the required dependencies are installed on the system" 31 | user_options = [] 32 | 33 | def initialize_options(self): 34 | pass 35 | 36 | def finalize_options(self): 37 | pass 38 | 39 | def run(self): 40 | 41 | for dep in dependencies: 42 | try: 43 | require(dep) 44 | print(dep + " ...[ok]") 45 | except (DistributionNotFound, VersionConflict): 46 | print(dep + "... MISSING!") 47 | 48 | 49 | # Extract long-description from README 50 | # README = open(os.path.join(root_path, '..', 'README'), 'rb').read().decode('utf-8') 51 | 52 | setup( 53 | name='pyorac', 54 | version=__version__, 55 | description='Wrapper for calling ORAC executables', 56 | # long_description=README, 57 | maintainer='A.C. Povey', 58 | maintainer_email='adam.povey@physics.ox.ac.uk', 59 | url=__website__, 60 | packages=find_packages(), 61 | scripts=['orac.py', 'regression.py', 'single_process.py'], 62 | cmdclass={"checkdep": CheckDep}, 63 | install_requires=dependencies, 64 | extras_require=optional_dependencies, 65 | tests_require=test_dependencies 66 | ) 67 | -------------------------------------------------------------------------------- /tools/single_process.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Run preprocessor for ORAC community code 3 | # 16 Feb 2016, AP: Initial version 4 | # 24 Jun 2016, AP: P2.7 rewrite 5 | # 08 Jul 2016, AP: Debugging against more awkward python environments 6 | # 09 Mar 2017, GT: Improved support for use with batch queuing systems 7 | # 25 Apr 2018. AP: Tidy code more sensibly into a module 8 | 9 | import os.path 10 | import warnings 11 | from argparse import ArgumentParser 12 | 13 | from pyorac.arguments import (args_common, args_cc4cl, args_preproc, 14 | args_main, args_postproc, check_args_common, 15 | check_args_cc4cl) 16 | from pyorac.colour_print import colour_print 17 | from pyorac.definitions import COLOURING, FileName, OracError, OracWarning 18 | from pyorac.local_defaults import LOG_DIR 19 | from pyorac.run import process_post, process_pre, process_main 20 | from pyorac.util import warning_format 21 | 22 | warnings.formatwarning = warning_format 23 | warnings.filterwarnings('always', category=OracWarning) 24 | 25 | 26 | # Define parser 27 | pars = ArgumentParser(description='Run one part of ORAC on a given file. Note ' 28 | 'that this *DOES NOT* consider default settings for each ' 29 | 'aerosol phase.') 30 | pars.add_argument('target', type=str, help='File to be processed.') 31 | args_common(pars) 32 | args_cc4cl(pars) 33 | args_preproc(pars) 34 | args_main(pars) 35 | args_postproc(pars) 36 | args = pars.parse_args() 37 | 38 | 39 | args = check_args_common(args) 40 | args = check_args_cc4cl(args) 41 | log_path = os.path.join(args.out_dir, LOG_DIR) 42 | 43 | try: 44 | inst = FileName(args.in_dir, args.target) 45 | 46 | if inst.oractype in ('primary', 'secondary'): 47 | jid, _ = process_post(args, log_path) 48 | 49 | elif inst.oractype is None: 50 | jid, _ = process_pre(args, log_path) 51 | 52 | elif inst.oractype in ('alb', 'clf', 'config', 'geo', 'loc', 'lsf', 53 | 'lwrtm', 'msi', 'prtm', 'swrtm'): 54 | jid, _ = process_main(args, log_path) 55 | 56 | else: 57 | raise OracError("Could not determine processing type. Please pass " 58 | "the filename of a valid ORAC input.") 59 | 60 | if args.script_verbose and args.batch: 61 | print("Job queued with ID {}".format(jid)) 62 | 63 | except OracError as err: 64 | colour_print('ERROR) ' + str(err), COLOURING['error']) 65 | except KeyboardInterrupt: 66 | colour_print('Execution halted by user.', COLOURING['error']) 67 | -------------------------------------------------------------------------------- /tools/slstr_ml/README.md: -------------------------------------------------------------------------------- 1 | # Python scripts for NN processing in SLSTR 2 | These scripts are useful for working with NN processing of cloudmasks, primarily for Sentinel-3 but potentially for other sensors too. 3 | 4 | # Requires, all available on conda: 5 | - Satpy: https://github.com/pytroll/satpy/ 6 | - Matplotlib, https://github.com/matplotlib/matplotlib 7 | - Numpy, https://github.com/numpy/numpy 8 | - Click, https://github.com/pallets/click 9 | - Cartopy, https://github.com/SciTools/cartopy 10 | - pyhdf, https://github.com/fhs/pyhdf 11 | - keras, https://github.com/keras-team/keras 12 | 13 | 14 | ### `satpy_read_SLSTR.py`: 15 | This loads an SLSTR granule and plots various channels, RGB composites and QA flags. 16 | Can be run from the command line (see below) or as part of another script by calling the `plot` function. 17 | Command line options: 18 | 19 | `--idir`: The input directory that contains SLSTR files. 20 | 21 | `--odir`: Where to save images (if you are). 22 | 23 | `--save`: A flag indicating whether you wish to save plots to disk (True / False) 24 | 25 | `--show`: A flag indicating if you want to show plots on the screen (True / False) 26 | 27 | `--verbose`: A flag indicating whether to print info to the command line (True / False) 28 | 29 | ### `DataLoader.py`: 30 | TBD 31 | ### `SLSTR_NN.py`: 32 | TBD 33 | ### `Visualisation.py`: 34 | TBD 35 | --------------------------------------------------------------------------------