gdal_translate NetCDF to GeoTiff file conversion not working - gdal

I am new to geospatial analytics and using NetCDF and GeoTIFF files. I am trying to convert the NetCDF file into GeoTIFF file. I came across this reference: netcdf-to-geotiff-file-conversion. I have successfully installed and can run gdal_translate in my MacOS terminal. However, I get this message I am trying to understand what this means and what I am missing? This appears to be warning, however it didn't generate any output.
My code executed:
gdal_translate some_nc_file_name.nc output.tif
Error/Message:
Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute
Input file contains subdatasets. Please, select one of them for reading.
Here is my data output I previewed in Python:

You appear to have multiple variables in the file, so need to select one. Example (following https://nsidc.org/support/how/how-convert-golive-netcdf-variables-geotiff).
gdal_translate NETCDF:"Input_FileName.nc":variable_name Output_FileName.tif
Based on the warning message, the netCDF file lacks certain important attributes, so some issues may exist with the coordinates etc. in the tif.

Related

trouble with utf-8 with julia and jupyterlab

I'm reading the csv file at https://github.com/VinitaSilaparasetty/julia-beginners/blob/master/data/nba/nba19-20.csv
I get a DataFrame and I save it as XLSX. When I try to read it in jupyterlab I get the error the file is not UTF-8 encoded and therefore the file is not read.
This is my code:
using HTTP, XLSX, CSV, DataFrames
df = CSV.read(HTTP.get("https://raw.githubusercontent.com/VinitaSilaparasetty/julia-beginners/master/data/nba/nba19-20.csv").body)
# first(df,5) # first shows the top five rows ok
XLSX.writetable("data/nba/nba19-20.XLSX", collect(eachcol(df)), names(df), overwrite = true)
The file is saved in my data folder. When I try to open it with jupyterlab, I get a pop up with the file is not UTF-8 encoded and the file is not opened.
When I try to open the file in Ubuntu (with LibreOffice) I do not see anything suspicious.
As I'm new to Julia I'm struggling to understand where the problem lies or how to fix it.
I tried to see if I could encode the dataframe in UTF-8 (after saving the file to disk) with
data = DataFrame(CSV.File(open(read,"data/nba/nba19-20.csv", enc"utf-8")))
But I did not see any change. Any suggestion is welcome.
Do you have the jupyterlab-spreadsheet plugin installed? JupyterLab by default doesn't support opening xlsx files (it isn't mentioned in the file formats list here for example).
See also this similar question involving Python pandas (which says pretty much the same thing).

Change resolution of converted images using Sphinx ImageMagick extension sphinx.ext.imgconverter

We are using Python-Sphinx to build our end user manuals.
In order to automatically convert our assorted graphic file formats like we are using the Sphinx Extension sphinx.ext.imgconverter, which utilizes ImageMagick to convert our graphic file formats to graphic formats, which the given build target can understand.
For detailed information see: sphinx.ext.imgconverter
Unfortunately, the output of the converted images does not satisfy our needs. A main issue is the low resolution of the converted images, which gives pixelated outcomes.
Therefore I included the following line to my conf.py:
image_converter_args=["-density 300"]
Now, the build process fails and leaves me with the following error message.
Extension error:
convert exited with error:
[stderr]
magick.exe: unrecognized option `-density 300' at CLI arg 1 # fatal/magick-cli.c/ProcessCommandOptions/428.
Can someone please help me?
The arguments should be a list.
image_converter_args=["-density", "300"]
Where "-density" is the operator argument, and "300" is the value argument.

Ansys multiphysics: blank output file

I have a model of a heating process on Ansys Multiphysics, V11.
After running the simulation, I have a script to plot a temperature profile:
!---------------- POST PROCESSING -----------------------
/post1 ! tdatabase postprocessor
!---define profile temperature
path,s_temp1,2,,100 ! define a path
ppath,1,,dop/2,0,0 ! create a path point
ppath,2,,dop/2,1.5,0 ! create a path point
PDEF,surf_t1,TEMP, ,noav ! print a path
plpath,surf_t1 ! plot a path
What I now need, is to save the resulting path in a text file. I have already looked online for a solution, and found the following code to do it, which I appended after the lines above:
/OUTPUT,filename,extension
PRPATH,surf_t1
/OUTPUT
Ansys generates the file filename.extension but it is empty. I tried to place the OUTPUT command in a few locations in the script, but without any success.
I suspect I need to define something else, but I have no idea where to look, as Ansys documentation online is terribly chaotic, and all internet pages I've opened before writing this question are not better.
A final note: Ansys V11 is an old version of the software, but I don't want to upgrade it and fit the old model to the new software.
For the output of the simulation (which includes all calculation steps, and sub-steps description and node-by-node results) the output must be declared in the beginning of the code, and not in the postprocessing phase.
Declaring
/OUTPUT,filename,extension
in the preamble of the main script makes such that the output is stored in the right location, with the desired extension. At the end of the scripts, you must then declare
/OUTPUT
to reset the output file location for ANSYS.
The output to the PATH call made in the postprocessing script is however not printed in the file.
It is convenient to use
*CFOPEN,file,ext
*VWRITE,Vector(1,1).Vector(1,2)
(2F12.6)
*CFCLOSE
where Vector(1,1) is a two column array created by *DIM, and stores your data to output to file
As this is a special command, run it from file i.e. macro_output.mac

Open a .cfile from rtl_sdr after convert with GNU Radio

I have a binary file (capture.bin) from the rtl_sdr tool. I convert it to a .cfile with this manual http://sdr.osmocom.org/trac/wiki/rtl-sdr#Usingthedata
Where can I get the data in this file? The goal is to get a numerical format output from the the source. Is this possible?
That actually is covered by a GNU Radio FAQ entry.
What is the file format of a file_sink? How can I read files produced by a file sink?
All files are in pure binary format. Just bits. That’s it. A floating point data stream is saved as 32 bits in the file, one after the other. A complex signal has 32 bits for the real part and 32 bits for the imaginary part. Reading back a complex number means reading in 32 bits, saving that to the real part of a complex data structure, and then reading in the next 32 bits as the imaginary part of the data structure. And just keep reading the data.
Take a look at the Octave and Python files in gr-utils for reading in data using Octave and Python’s Scipy module.
The exception to the format is when using the metadata file format. These files are produced by the File Meta Sink: http://gnuradio.org/doc/doxygen/classgr_1_1blocks_1_1file__meta__sink.html block and read by the File Meta Source block. >See the manual page on the metadata file format for more information about how to deal with these files.
A one-line Python command to read the entire file into a numpy array is:
f = scipy.fromfile(open("filename"), dtype=scipy.uint8)
Replace the dtype with scipy.int16, scipy.int32, scipy.float32, scipy.complex64 or >whatever type you were using.
Update
scipy.fromfile will be deprecated in v2.0 so instead use numpy library
f = numpy.fromfile(open("filename"), dtype=numpy.uint8)

Display variables using CBC MPS input in NEOS

Am trying to use NEOS to solve a linear program using MPS input.
The MPS file is fine, but apparently you need a "paramaters file" as well to tell the solver what to do (min/max etc.). However I can't find any information on this online anywhere.
So far I have got NEOS to solve a maximization problem and display the objective function. However I cannot get it to display the variables.
Does anyone know what code I should add to the paramters file to tell NEOS/CBC to display the resulting variables?
The parameter file consists of a list of Cbc (standalone) commands in a file (one per line). The format of the commands is (quoting the documentation):
One command per line (and no -)
abcd? gives list of possibilities, if only one + explanation
abcd?? adds explanation, if only one fuller help(LATER)
abcd without value (where expected) gives current value
abcd value or abcd = value sets value
The commands are the following:
? dualT(olerance) primalT(olerance) inf(easibilityWeight)
integerT(olerance) inc(rement) allow(ableGap) ratio(Gap)
fix(OnDj) tighten(Factor) log(Level) slog(Level)
maxN(odes) strong(Branching) direction error(sAllowed)
gomory(Cuts) probing(Cuts) knapsack(Cuts) oddhole(Cuts)
clique(Cuts) round(ingHeuristic) cost(Strategy) keepN(ames)
scaling directory solver import
export save(Model) restore(Model) presolve
initialS(olve) branch(AndBound) sol(ution) max(imize)
min(imize) time(Limit) exit stop
quit - stdin unitTest
miplib ver(sion)
To see the solution values, you should include the line sol - after the min or max line of your parameter file.
If this doesn't work you can submit the problem to NEOS in AMPL format via this page. In addition to model and data files, it accepts a commands file where you can use statements to solve the problem and display the solution, for example:
solve;
display _varname, _var;
This post describes how to convert MPS to AMPL.